File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Servlets
Bookmark "Reoccurring HTML Block" Watch "Reoccurring HTML Block" New topic

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.
Bhuvana Madhav

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

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?
I agree. Here's the link:
subject: Reoccurring HTML Block
It's not a secret anymore!