include « JSTL « JSP-Servlet Q&A

1. How to include a file depending on a request attribute using the include directive

I would like to include a file depending on a request attribute value.

${theme} -> themeA
To sum up. I would like something like this:
<%@ include file="../themes/${theme}/jsp/content/welcome.jsp"%>
Any easy workaround?

2. Redirection from jsp:include page

I want the user to be redirected to Login.jsp if the "role" stored in Session Scope doesn't match with the Request Parameter "accessRole" HomePage.jsp

<jsp:include page="Header.jsp">
<jsp:param value="d" name="accessRole" />
<c:if test="${sessionScope.role!=param.accessRole}">
<c:redirect url="Login.jsp"/> 
The above ...

3. Logging every jsp:include

I want to log every <jsp:include> tag. Does the JavaServer Pages Standard Tag Library (JSTL) support logging and if so, how do I enable it?

4. How can you store JSP buffered output from an include/import to a variable?

I don't want to use any Java code, I just want to use <jsp:include> or <c:import> or something to that effect. So that I can use

<c:set var="myPage" value="bufferedPageOutput" />
to output ...

5. Pass page scope attributes to a JSP using pagecontext.include for use in JSTL?

We're using this JSP template solution almost verbatim at work: When it gets JSP pages to be included, it uses pageContext.include, which leaves us with one problem, and that is ...

6. JSP request parameter is returning null on a jsp include with Weblogic

I am having trouble with the jsp:include tag. I have code like the following:

<jsp:include page="./Address.jsp">
    <jsp:param value="30" name="tabIndex"/>
    <jsp:param value="true" name="showBox"/>
    <jsp:param ...

7. JSTL XML Transforms not working with nested XSL includes

I have a bit of JSP that does this:

<c:import url="/xsl/Transformer.xsl" var="xslt" />
<x:transform doc="${actionBean.dom}" xslt="${xslt}" xsltSystemId="/xsl/">
This transforms the XML exactly as expected so long as Transformer.xsl contains no <xsl:include> tags or so ...

8. Why would I use a templating engine? jsp include and jstl vs tiles, freemarker, velocity, sitemesh

I'm about to choose to way to organize my view (with spring-mvc, but that should matter much) There are 6 options as far as I see (though they are not mutually exclusive):

  • tiles
  • sitemesh
  • freemarker
  • velocity
  • <jsp:include>
  • <%@ ...

9. jsp include page parameter using a HashMap in a request attribute

I'd like to pass the HTML page title to an included jsp page but the title is passed to the view in a request attribute that happens to be a hashMap ...

10. Insert html elements dynamically into a template of jsp file

I want to insert some html elements dynamically into a template of jsp file. I know I can do this by using a code snippet of javascript, but I wonder is there ...

11. JSTL taglibs not recognized when declared in common header

I had the idea a while back to put all of my taglib declarations (uri's, etc) in a common header file so I don't have to manually write them into all ...

12. Why my included JSP file won't get processed correctly?

I am trying (and learning) to build a java web framework, and in the process of developing its' code generator based on the content of the database. In the view making ...

13. performance difference between and

I know the performance difference between the following two

  1. Include directive (<%@ include file="test.jsp" %>): This includes the contents of the file during the compilation phase—i.e., when the page is converted to ...

14. Why is this include not working in jsp?

I want to conditionally include a css file in my jsp page based on some parameter:

<c:if test="${ == 'txmart'}">

15. Page sections JSP/JSTL

I'm used to work in PHP. There I would make a Page Class with methods for writing menus headers and footers and call those methods from my script. This way was ...

16. Passing c:forEach variable to a jsp:include

I am trying to access some JSTL variables that were set on a JSTL for-loop in an include. Example:

<c:forEach items="${cart.entries}" var="entry">
 <jsp:include page="helper.jsp"></jsp:include>
Inside helper.jsp I want to be able to reference the ...

17. JSP include doesnt work, jstl import work, so what difference does it make?

JSP include doesnt work, jstl import work, so what difference does it make? I am using WAS 7 server, any clue folks?

18. jsp include and jstl questions

19. JSTL: key field includes a period (.)

I'm having problems changing the following tag to the JSTL My attempt at the : My variable foo is not getting out there correctly. It's out there, but is of type String rather than the hoped for type of "SomeClass". The key for the session variable includes a ...

23. Is JSTL 1.1 included in the book?

24. jsp:include in a sql:transaction

25. jsp:include and include file

26. Create and Read Files with name including special characters (, , ,)

Create and Read File Called .arc Cordial Greetings: How you can see the filename have a (n with tilde, u with diaresis, etc ) I need create a file with the method. String defDir = "/home/cepagi/Documents/"; //for Linux case String defDir = "c:\\cepagi\Documents"; //for Windows case String MyFileName = ".arc"; File file2 = new File(defDir+MyFileName); o FileOutputStream MyFileOutputStream = new ...

27. Including external file in JSP

Hello everyybody, I am developing a J2EE web application using JSP (on weblogic server). The whole project is extracted into a EAR archive and deployed on the server. So the root of the project is /, and dinamically I can't edit a file of the project run-time. But, from a JSP, I must include a file that is outside the project, ...

28. Include Servlet in jsp

29. jsp:include tag won't do as expected