File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Portals and Portlets and the fly likes How to combine jsp pages? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "How to combine jsp pages?" Watch "How to combine jsp pages?" New topic
Author

How to combine jsp pages?

Ramya Sree Kalagiri
Greenhorn

Joined: Dec 18, 2012
Posts: 2
Hi,
I'm using spring portlet MVC, and Liferay 6.1 CE. I have 3 jsp pages for example addDetails.jsp, editDetails.jsp and viewDetails.jsp, I would like to use single jsp page for all the 3 actions(viewing, editing and adding details) instead of 3 jsp pages. Will view and edit mode of portlet will help to achieve this? Please help me. Thanks in advance
Philip Thamaravelil
Ranch Hand

Joined: Feb 09, 2006
Posts: 99
In general, this is done by passing a parameter to the jsp to determine how to display the page DOM elements.

For example, passing a "mode" parameter ('view', 'update') to the jsp would allow for this.

If "mode" == "view" then
display readonly..
else if "mode"== "update"
display form elements to save the data.
end
Ramya Sree Kalagiri
Greenhorn

Joined: Dec 18, 2012
Posts: 2
Hi Philip,
Thank you for the reply. I implemented this idea already and it is working fine, bt I would like to use view and edit mode of portlet. Isn't it a better idea to use view and edit modes instead of using the parameters. I'm allways confused with difference between view and edit mode, can you explain me briefly?
Philip Thamaravelil
Ranch Hand

Joined: Feb 09, 2006
Posts: 99
Hi Ramya,
You certainly can use the edit or view mode of the portlet for this purpose. At a high level, in your Portlet class you will have a method to implement doEdit(...) just as you have doView(...), and doAction(). When you define youre link to edit the record in the view, you'll need to specify in the link to use "doEdit". Of course, these method names are only a high-level view and vary based on your portlet container specification/implementation (JSR 168, JSR 286, IBM, etc..). Hope that helps.

Cheers,
Philip
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to combine jsp pages?