This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Creating of dynamic jsp

 
Venkat Aditya
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any way to create dynamic jsp pages. jsp page constructs at runtime which can be included in struts
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
Venkat Aditya
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thak you for you suggestion . can you post the steps for the same.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you could just use the response object from your action and create your web pages within your actions and write them out (returning null).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic