aspose file tools*
The moose likes Struts and the fly likes constant content in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "constant content in jsp" Watch "constant content in jsp" New topic
Author

constant content in jsp

Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

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?


SCJP6, SCWCD5, OCE:EJBD6.
BLOG: http://leakfromjavaheap.blogspot.com
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

Use Tiles Tiles, Can easily integrate tiles with Struts2


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

Thanks but let's assume that I have Struts2 and JPSs only.
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

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

Joined: Apr 20, 2009
Posts: 804
    
    1

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

Joined: Aug 01, 2007
Posts: 485


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.


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: constant content in jsp