
在Portal里加入Struts的應用程序的主要步驟:
一:在Portal中加入Struts程序
(1) 將struts應用程序復制到你的webapp中的新目錄中。你所選擇的放置struts應用程序的目錄將成為用于portal中應用程序的struts模塊路徑。比如,如果你的struts應用程序目錄是test,那么你的應用程序的模塊就是/test。將針對你的struts應用程序的struts-config.xml復制到WEB-INF/.pageflow-struts-generated/下,更改其文件名,命名規則為jpf-struts-config-<dir>.xml,本例子中為jpf-struts-config-test.xml. 使用這種命名規則允許用在 portal 中的行為 servlet動態地注冊struts應用程序模塊。
(2) 將下面的內容添加到struts的配置文件中:
<controller className="com.bea.wlw.netui.pageflow.config.PageFlowControllerConfig" multipartClass="com.bea.wlw.netui.pageflow.upload.PageFlowMultipartRequestHandler" inputForward="true" processorClass="com.bea.wlw.netui.pageflow.PageFlowRequestProcessor">
<set-property value="true" property="isReturnToPageDisabled"/>
<set-property value="true" property="isReturnToActionDisabled"/>
</controller>
(3) 將相應的struts里所需要的java文件copy到WEB-INF/src下面,本例中為teststruts里.
(4) 對新加入的jpf-struts-config-<dir>.xml根據目錄做相應的調整,使之與workshop中的目錄結構一致.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<!-- Generated from /test/TestController.jpf on Thu Mar 30 23:22:05 CST 2006 -->
<struts-config>
<form-beans/>
<global-exceptions/>
<global-forwards/>
<form-beans>
<form-bean name="userActionForm" type="teststruts.UserActionForm" />
</form-beans>
<action-mappings>
<!--action validate="false" scope="request" type="test.TestController" path="/begin">
<forward path="/index.jsp" name="suclearcase/" target="_blank" >ccess"/>
</action-->
<action validate="false" scope="request" path="/startAction" type="teststruts.StartAction">
<forward name="success" path="/login.jsp" />
</action>
<action validate="false" scope="request" name="userActionForm" path="/loginAction" type="teststruts.LoginAction">
<forward name="success" path="/success.jsp" />
<forward name="err" path="/err.jsp" />
</action>
</action-mappings>
<controller className="com.bea.wlw.netui.pageflow.config.PageFlowControllerConfig" multipartClass="com.bea.wlw.netui.pageflow.upload.PageFlowMultipartRequestHandler" inputForward="true" processorClass="com.bea.wlw.netui.pageflow.PageFlowRequestProcessor">
<set-property value="true" property="isReturnToPageDisabled"/>
<set-property value="true" property="isReturnToActionDisabled"/>
</controller>
</struts-config>
二.將Struts程序配置為Portlets
在test目錄下新建portlets
選擇建立Struts Portlets
注意:要為Struts生成portlet,Struts里的必須以Action作為入口,不能以JSP作為其入口.
為Struts選擇Module URI,本例中選擇test目錄,即生成的portlet放在test目錄下.
MILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">選擇struts的config文件
本例中選擇jpf-struts-config-test.xml
加入配置文件
選擇一個Action作為portlet的入口
然后將生成的portlets加入portal即可.
|