File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes how to dynamically generate  jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "how to dynamically generate  jsp " Watch "how to dynamically generate  jsp " New topic

how to dynamically generate jsp

jegan arumugam

Joined: Jan 10, 2001
Posts: 3
dear friends,
well i have a requirement to create a tool which have to dynamically generate jsp pages by over riding the existing templates.i;e to create new look and feel for the pages when ever it needs by changing the gifs,font colors and background colors this can be achieved is it possible thru taglibs or is there any other way to do this.hopefully i need help from anyone of u friends.please kindly send me your views to define a solution for my problem.thanking u all
with regards
[This message has been edited by jegan arumugam (edited February 15, 2001).]
Marius Holm
Ranch Hand

Joined: Sep 11, 2000
Posts: 84
Hi Jegan!
There are several ways to perform this task. The perhaps most 'proper' way could be using a combination of XML/XSL and stylesheets, but unfortunately browsers are not that standardised yet, so the safest way, as I view it, would be to perform the work server-side.
That means to dynamically build your HTML on request, or in your case, whenever you need to change the look.
I don't know exactly what you mean with taglibs, that would be libraries of tags, fair enough, but you don't say anything about how you intend to use those libraries. But it sounds reasonable...
You say you need to change the look and feel, I assume the tool is not required to edit the content/text on the page?
You could anyway try to use XML/XSL on the server, if your server supports it. If you don't have any experience with XML, then seize the opportunity now to gain some! It will be valuable later. If your server don't support it, change it.
Another possible way would of course be to build up the page programmatically, adding text and markup from different sources. Some HTML structures might be somewhat complex to generate correctly in every situation, if you insert markup as text.
That depends on the surrounding and the inside content.
If your tool is to produce a fixed set of templates, it is of course easier than if it is required to produce any web page.
I have been working with similar tasks, so if you provide more detail, I might be able to give you more concrete advice, and maybe some code samples.
Good luck!
jegan arumugam

Joined: Jan 10, 2001
Posts: 3
hi marius,
it was good to receive your mail.thanks for your response.well, we basically have to change the entire content of the page including text and other fields in it.i couldnt get any clear picture from your mail about how to use xml/xsl,so if u can please expalin me in detail how to do it in xml/xsl that would be helpfull.more over we are storing the data to be used for the change like fontcolor,style etc in a if we have to use xml then we have to generate xml every time.apart from this is it possible to use only xsl taking data from database or xml is the only way.
about the taglibs i mentioned its just the same as u said libraries of tags using the tagsupport class in that i thaught of writing some customised tags for our requirement and then calling those tags in our jsp and passing the parameters dynamically.i still havent started in working anyway but if u can help me in any regard i will be thankfull to marius help me in any way u can.i hope now u got a clear picture of what my requirement is all about.
thanks again
with regards
I agree. Here's the link:
subject: how to dynamically generate jsp
It's not a secret anymore!