Announcement Announcement Module
Collapse
No announcement yet.
multiple views in single view Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • multiple views in single view

    hello all,

    i have been trying to get multiple views (.jsp) to display in one single view (.jsp)....each view having its own controller.

    in the part c:out, it does return the correct value (demo.jsp)....
    and when we hardcode the line <jsp:include page="demo.jsp"/> it DOES work....
    but the line <jsp:include page="${model.chooser.banner}"/> DOES NOT display demo.jsp.

    the file main.jsp is shown below:

    <%@ page import="bus.*"%>
    <%@ page import="web.*"%>
    <%@ include file="/WEB-INF/jsp/include.jsp" %>
    <html>
    <head><title>Main</title></head>
    <body>
    <pre><c:out value="${model.chooser.banner}"/></pre>
    <table>
    <tr>
    <td> <jsp:include page="${model.chooser.banner}"/> </td>
    </tr>
    </table>
    </body>
    </html>


    any help or ideas would be appreciated.

    thanks in advance,
    vincent disco

  • #2
    correction- c:out

    damn faces....

    correction: c : out

    Comment


    • #3
      The jsp:include tag doesn't support JSTL expressions except in the latest servlet engines that support the JSP-2.0 spec.

      One solution is to hold the value of model.chooser.banner as a page script variable. For example:

      Code:
      <% String banner = ( (YourModelClass) pageContext.findAttribute ( "model" ) )
               .getChooser ()
               .getBanner ();
      %>
      <jsp:include page="<%= banner %>" />
      I'm sure the first line can be done more elegantly but it being a Sunday morning...

      Comment

      Working...
      X