This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Struts and the fly likes Creating of dynamic jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Creating of dynamic jsp" Watch "Creating of dynamic jsp" New topic
Author

Creating of dynamic jsp

Venkat Aditya
Greenhorn

Joined: Jul 13, 2007
Posts: 6
Is there any way to create dynamic jsp pages. jsp page constructs at runtime which can be included in struts
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Yes, it's possible to do this. One possibility would be to use the classes in the java.io package to physically write the JSP to a file somewhere in your Web Context directory or one of its subdirectories. You could then create an ActionForward that forwards to that JSP. Example code in your Action class:


Merrill
Consultant, Sima Solutions
Venkat Aditya
Greenhorn

Joined: Jul 13, 2007
Posts: 6
Thak you for you suggestion . can you post the steps for the same.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
This link contains sample code for writing to a file using the java.io package. I've already given you sample code for dynamically forwarding to a JSP.
Nick Williamson
Ranch Hand

Joined: Jan 06, 2007
Posts: 73
you could just use the response object from your action and create your web pages within your actions and write them out (returning null).
 
Don't get me started about those stupid light bulbs.
 
subject: Creating of dynamic jsp
 
jQuery in Action, 3rd edition