PDA

View Full Version : jsp blueprints


Duffman12
11-15-2007, 07:29 PM
i have a chunk of html that i use over and over with only a few things slightly different. here's an example template:
<div class=poo> this is div # <b> 3 </b> </div>
that's a simplification of what i have. i want to be able to call a function or write a jsp tag or something and give it a number (in this case, 3), and have it print all that with the number in place of the 3. i'm sure this is possible and simple, i'm just new to jsp and need some direciton. thanks!

shyam
11-15-2007, 07:51 PM
i want to be able to call a function or write a jsp tag or something and give it a number (in this case, 3), and have it print all that with the number in place of the 3.
both solutions will work though the custom tag solution seems like an overkill for the task

Duffman12
11-16-2007, 07:33 PM
so for the function method, i would just make a scriptlet that munches a bunch of strings? something like:

function writePooClass(theNumber){

String output = "<div class=poo> this is div # <b>";
output += theNumber;
output += "</b> </div>";

out.print(output);
}

this method seems like it would be tedious for bigger templates.

would a custom tag work better for a bigger chunk of html?