jspinclude

How to read Action attributes from JSP fragments included with <jsp:include />?

不羁岁月 提交于 2019-12-06 15:54:11
Trying to call an Action's getter from an included JSP, I get null: MyAction.java private String message = "The message I want to read..."; public String getMessage() { return message; } main.jsp <%@taglib prefix="s" uri="/struts-tags" %> <html> <head></head> <body> <div> I'm a DIV in main.jsp </div> <jsp:include page="fragment.jsp" /> <body> </html> fragment.jsp <%@taglib prefix="s" uri="/struts-tags" %> <div> I'm a DIV from fragment.jsp <br/> Message from Action: <s:property value="message" /> </div> How can I get the attribute value in JSP fragment ? Use <s:include value="somePage.jsp">

How to pass a parameter to an included page with JSF 1.2

天涯浪子 提交于 2019-12-06 14:55:59
Is this possible to pass a parameter to an included page in JSF1.2 environment? I have a page a.jsp in which b.jsp is included twice (I tested all jsp:include, a4j:include, c:import) once at top of the page and once at the bottom. I want to figure out in b.jsp if it's now including in top or in bottom of a.jsp. BTW, I do not have facelets. There the <jsp:param> tag is for. E.g. <jsp:include page="/WEB-INF/include.jsp"> <jsp:param name="position" value="top" /> </jsp:include> ... <jsp:include page="/WEB-INF/include.jsp"> <jsp:param name="position" value="bottom" /> </jsp:include> With the above

How to load Html page which is outside application context using JSP include or c:import or symlink

六眼飞鱼酱① 提交于 2019-12-06 05:10:11
I need to load some html pages created dynamically by some other application into my application jsp page using jsp include tag <jsp:include page="${Htmlpath}" /> OR <jsp:include page="D:\MySharedHTML\test.html" /> . My idea is to have a shared folder on server like "MySharedHTML" and let other application create html files there and my app will access by giving full path. But jsp include is saying "requested resource D:\MySharedHTML\test.html is not available". Any inputs how to do it. Thanks In Advance. It has to be available by an URL. The D:\MySharedHTML\test.html is very definitely not a

why jsp:include parameters not visible

不问归期 提交于 2019-12-05 12:16:16
I have exactly the same basic question about accessing jsp:param values as this poster; following his example exactly does not work for me. The parameters passed in via jsp:include don't seem to show up in the included file. Is there something peculiar about my setup? Caller: <div> <jsp:include page="../../../common/callee.jsp"> <jsp:param name="justinVar" value="primary" /> </jsp:include> </div> callee.jsp: <i>method 1: [</i><b><%= request.getParameter("justinVar") %></b><i>]</i> <p/> <i>method 2: [</i><b>${param.justinVar}</b><i>]</i> <p/> <i>method 3: [</i><b>${justinVar}</b><i>]</i> <p/>

unable to add a cookie included in JSP via jsp:include

别来无恙 提交于 2019-12-05 10:13:10
Cookies are not getting added to the browser when the code adding the cookie is part of a fragment of JSP (includes.jsp) included in the primary page (main.jsp) via JSP:INCLUDE. The code works fine when it is part of the primary page (main.jsp). However, I need to add the cookie via the fragment since that fragment is used in dozens of pages where I want the cookie to get added. Note: The jsp:include is part of the header section of main.jsp (the fragment also adds a number of javascript and css references) Here is the snippet: Cookie cookie = new Cookie ("test","test cookie"); cookie

JSP - Can I use <jsp:attribute> inside <c:if>? Exception: “Must use jsp:body to specify tag body”

一曲冷凌霜 提交于 2019-12-05 06:58:14
I have the following inside a JSP: <c:if test="${true}"> <jsp:attribute name="extraInlineComplianceJavascript"> window.isSummaryComplianceLinkVisible = '${TabList.isSummaryComplianceLinkVisible}'; window.isDetailComplianceLinkVisible = '${TabList.isDetailComplianceLinkVisible}'; window.complianceSummaryReportTag = '${helper.complianceSummaryReportTag}'; window.complianceDetailReportTag = '${helper.complianceReportTag}'; </jsp:attribute> </c:if> As is, I get the following exception: Must use jsp:body to specify tag body for <MyTag if jsp:attribute is used. If I remove the outermost <c:if> tags,

How to implement a “include” jsp tag?

穿精又带淫゛_ 提交于 2019-12-05 04:42:06
问题 I need to define a jsp tag which named "include". It should be used as: <cms:include page="/aaa.jsp" /> It has an attribute page which points to another jsp, and it will include the content of that jsp and render it. Is there any existing tag lib can do this? Or please give me some advises of implementing it, thanks! UPDATE From Ramesh PVK's answer, I know there is a standard <jsp:include> fit my need. But per my project's requirements, I can use the name jsp:include , but cms:include . I've

Scope of jsp:useBean

你离开我真会死。 提交于 2019-12-04 09:50:04
问题 home.jsp <jsp:useBean id="username" class="java.lang.String" scope="application"/> <% username="Jitendra"; %> <jsp:include page="include.jsp"/> include.jsp <%=username%> This gives an error saying “username” is undefined in include.jsp, even though the scope of Bean is application… 回答1: As to your problem, anything which you declare locally using the old fashioned scriptlets is not linked with a jsp:useBean . Also, declaring a local scriptlet variable is not visible in the included pages, you

Howto re-use War resources between Wars with Maven War Plugin

独自空忆成欢 提交于 2019-12-04 04:47:59
问题 Under a Java EE enviroment, I have a web page built including several JSP files. Lets say one of the included JSP is header.jsp . Can be very similar to the one used by Stackoverflow, showing info about the user, links etc. This JSP is linked to a java controller to fetch user info, and is part of my WAR file including all the web application. To develop it I used Eclipse and to build and package it I use Maven. Now I need to build a new webApplication (so a new war) and I want to reuse the

How to implement a “include” jsp tag?

大憨熊 提交于 2019-12-03 22:11:48
I need to define a jsp tag which named "include". It should be used as: <cms:include page="/aaa.jsp" /> It has an attribute page which points to another jsp, and it will include the content of that jsp and render it. Is there any existing tag lib can do this? Or please give me some advises of implementing it, thanks! UPDATE From Ramesh PVK's answer, I know there is a standard <jsp:include> fit my need. But per my project's requirements, I can use the name jsp:include , but cms:include . I've already defined some other tags which have prefix cms , and the include one should have the same prefix