Establishing a basic page flow
In this chapter, we will see how to create some basic page flows for the library portlet we have just created.
Create a new page
Add one new JSP file called “update.jsp” inside “docroot/html/library” and put some dummy contents and Save this file.
<h1>Add / Edit Form</h1>
Modify view.jsp
1. Open view.jsp
2. remove the line - “This is the <b>Library Portlet</b> portlet in View mode.”
3. enter the code to link to “update.jsp”
4. check the portlet and you should see a link to “update.jsp”.
Create init.jsp
create a new file init.jsp where all common stuff will be put. This file in turn will be included in all
other JSP's of this portlet. This way, we need not have to repeat the same code again and again in all
JSP files.
Remove these lines from view.jsp and paste into init.jsp
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<portlet:defineObjects />
insert this line at the top of all other JSP files we have so far.
<%@ include file="/html/library/init.jsp" %>
Create a link to come back.
1. re-open update.jsp and give a link back to the main page.
2. <a href="<portlet:renderURL/>">« Go Back</a>
Suite : http://rsuna.blogspot.com/2013/11/creating-form-to-add-book.html
In this chapter, we will see how to create some basic page flows for the library portlet we have just created.
Create a new page
Add one new JSP file called “update.jsp” inside “docroot/html/library” and put some dummy contents and Save this file.
<h1>Add / Edit Form</h1>
Modify view.jsp
1. Open view.jsp
2. remove the line - “This is the <b>Library Portlet</b> portlet in View mode.”
3. enter the code to link to “update.jsp”
4. check the portlet and you should see a link to “update.jsp”.
<portlet:renderURL var="updateBookURL">
<portlet:param name="jspPage" value="/html/library/update.jsp"/>
</portlet:renderURL>
<br/><a href="<%= updateBookURL %>">Add new Book »</a>
Create init.jsp
create a new file init.jsp where all common stuff will be put. This file in turn will be included in all
other JSP's of this portlet. This way, we need not have to repeat the same code again and again in all
JSP files.
Remove these lines from view.jsp and paste into init.jsp
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<portlet:defineObjects />
insert this line at the top of all other JSP files we have so far.
<%@ include file="/html/library/init.jsp" %>
Create a link to come back.
1. re-open update.jsp and give a link back to the main page.
2. <a href="<portlet:renderURL/>">« Go Back</a>
Suite : http://rsuna.blogspot.com/2013/11/creating-form-to-add-book.html



0 commentaires:
Enregistrer un commentaire