-
In the J2EE Navigator, select all packages from the WebBookStruts project and choose Copy from the context menu.
Figure 14-8. Copy the java files from the Web to the portlet project
-
Select the Java Source folder from the StrutsBookPortlet project and choose Paste from the context menu.
-
Copy all JSP from the WebBookStruts/Web Content folder to the StrutsBookPortlet/Web Content folder.
-
Delete index.jsp from the StrutsBookPortlet/Web Content folder.
-
In the StrutsBookPortlet/Web Content folder, rename addABook.jsp to index.jsp .
-
Open index.jsp. Change the lines:
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
to:
<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %> <%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
-
Remove all tags between <head> and </head> , then remove all head and body tags.
-
Repeat steps f and g for the remaining two JSPs in StrutsBookPortlet.
-
Delete struts-config.xml from the StrutsBookPortlet/Web Content/WEB-INF folder.
-
Copy struts-config.xml from WebBookStruts/Web Content/WEB-INF folder to the StrutsBookPortlet/Web Content/WEB-INF folder.
-
Open StrutsBookPortlet/Web Content/WEB-INF/struts-config.xml. The Struts config editor opens. Switch to the XML Source tab.
-
Include the following code before the message-resources tag:
<!-- ============================= Controller Configuration --> <controller processorClass="com.ibm.wps.portlets.struts.WpsRequestProcessor"> </controller>
Note : Because WebSphere Portal does not support the back button of the Web browser, it can be difficult to navigate back through a number of screens to a location earlier in the browser history. To browse back from the addABook.Result.jsp or error.jsp, we have to add a homeFromStatic forward to ort action mapping which references the static content.
-
Switch to the Global Forwards tab of the Struts configuration editor. Click the New button. Enter a forward name of homeFromStatic and a path of /index.jsp .
Figure 14-9. The Struts configuration editor
-
Open the addABookResponse.jsp file. Insert the following code snippet before the </html> tag.
<html:link forward="homeFromStatic">Back to index</html:link>
-
Repeat the last step for the error.jsp.
-
Save and close the struts-config.xml file.