Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp:include inside c:forEach

 
Muni K Reddy
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
    Marshal
    Pie
    Posts: 64631
    86
    IntelliJ IDE Java jQuery Mac Mac OS X
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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.
     
    Muni K Reddy
    Ranch Hand
    Posts: 74
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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!
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic