This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to combine jsp pages?
 
Similar Threads
Why is Spring bean lifecycle so elaborate?
JSP pages list view and grid view
hibernate 4 and spring 3.1.2 issue with LocalSessionFactoryBuilder
Problem in I18N in Spring
Spring Security for compartmentalized, multi-org web application