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
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
else if "mode"== "update"
display form elements to save the data.
Ramya Sree Kalagiri
Joined: Dec 18, 2012
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?
Joined: Feb 09, 2006
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.