Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

constant content in jsp

 
Lucas Smith
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy!

I have a problem that is rather very simple but I want to solve it in elegant way.

Some parts of my JPSs are constant - header, menu and footer. I want to change one part only.

I use Struts2 framework. Scenario:
1. User clicks a position from menu.
2. Struts action is executed.
3. JSP presents result of the action.

Where can I incorporate that constant content?
 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use Tiles Tiles, Can easily integrate tiles with Struts2
 
Lucas Smith
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks but let's assume that I have Struts2 and JPSs only.
 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, we can do it. Let us consider a scenario we have a payment section and that is getting used in different modules we can whole put logic payment.jsp and we can include jsp using the tag



but your action class should hold data what we are displaying in payment.jsp. So whenever we want payment section just include this page that's it.
 
Lucas Smith
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, I know that there is 'include' action (even in raw JSP) but I am a little confused with other issue.

Scenario:
1. User clicks 'Submit' button and data is sent to Struts Action.
2. Struts action does something with data and delegates result to JSP.

And my question is:
Which JSP page should be defined as the result of struts action? Please remember that headline and menu are constants and they have to be presented as well as the data which was returned from the action.
 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

And my question is:
Which JSP page should be defined as the result of struts action? Please remember that headline and menu are constants and they have to be presented as well as the data which was returned from the action.

Create two jsp for menu.jsp and headline.jsp. Include these two jsp's in resultant jsp.(Considered menu.jsp, headline.jsp having static content)
And for dynamic content there is another solution.

You can include the above tag in a jsp. It's providing capability of calling an action in a jsp.

Regard's
Mohan.


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic