This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes Reoccurring HTML Block Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Reoccurring HTML Block" Watch "Reoccurring HTML Block" New topic
Author

Reoccurring HTML Block

Drew Lane
Ranch Hand

Joined: May 13, 2001
Posts: 296
I am wondering if anyone has a suggestion on how to best handle this situation:
I've got a reoccuring block of HTML that needs to be displayed in my JSP page (or servlet). The number of occurances of this block of HTML will depened upon a varialble that is received by the page.

So my question is this - what is the best way to store this block of HTML? Should I store it as JSP file and do a JSP include as needed?
One more twist: There are a few variables in each HTML block that may change with each occurance, so I am not sure if I can change those variables using the include method mentioned above.
Thanks!
Drew
Bhuvana Madhav
Greenhorn

Joined: Sep 24, 2001
Posts: 5
You can very well have that specific block of html as a jsp file and include it in the main page.The variables avaliable in the main jsp will be avaliable in the include jsp too. so you wont have any pbm in changing the values in yr include file.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

pbm? yr?
Anyway, you can open and close scriptlet tags inside a loop if you want:

Not very pretty but is this what you're (yr?) looking for?
Dave.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reoccurring HTML Block