wood burning stoves 2.0*
The moose likes JSP and the fly likes jsp:include  inside  c:forEach Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp:include  inside  c:forEach" Watch "jsp:include  inside  c:forEach" New topic

jsp:include inside c:forEach

Muni K Reddy
Ranch Hand

Joined: Aug 23, 2007
Posts: 74
Sorry to bother you with this one guys! Ive been experimenting a bit with JSTL and EL.
All I would like to do is, to print a table like this:
The movie list is:
  • Matrix
  • Titanic
  • --> Image of a Ship goes here which is fetched from some other jsp using <jsp:include>
  • Speed
  • Casino Royale[/b]
  • The image above is printed when the for loop encounters a variable called "Titanic".

    Here's the main display page: (display.jsp)[/b]
    The controller ContServlet(which sets an attribute movieList, which is holding a String array)[/b]

    .. and the head file(head.jsp) which is intended to be pasted just after "Titanic"

    The result Iam getting is something like this
    The movie list is:
  • ->> The Image from head.jsp
  • Matrix
  • Titanic
  • Speed
  • Casino Royale[/b]

  • Why does this happen? Why doesnt it print the head.jsp after "Titanic"?

    Many thanks!!

    [ September 03, 2007: Message edited by: Muni K Reddy ]
    [ September 03, 2007: Message edited by: Bear Bibeault ]
    Bear Bibeault
    Author and ninkuma

    Joined: Jan 10, 2002
    Posts: 60774

    I removed the bolding from your post -- it was giving me a headache and made the post hard to read. I'd advise against the overuse of bold in future posts.

    You might try specifying flush on the include, but why are you doing an include for just an image?

    And, I'd suggest exploring the use of tag files in place of includes in general.

    [Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
    Muni K Reddy
    Ranch Hand

    Joined: Aug 23, 2007
    Posts: 74
    Thanks Bear!
    Did you mean this?

    I used the flush now but the result is the same!

    I am sure I wont be using a logic like this for sure in future. I was just trying to find out how <jsp:include> reacts when inside a <c:forEach>. Nesting tags like this, I thought would make me understand each tag better!

    PS: Ive noted your tip about bold text. Thanks!
    It is sorta covered in the JavaRanch Style Guide.
    subject: jsp:include inside c:forEach
    Similar Threads
    c:forEach tag
    deploying jstl problem
    JSTL does not show values
    Doubt in Attribute with JSTL.Thanks!
    JSTL pg 437 HFSJ