在Portal里加入Struts的应用程序的主要步骤:
一:在Portal中加入Struts程序
<script type="text/javascript"> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> |
(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
中的目录结构一致
.
<script type="text/javascript"> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> |
<?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="success"/>
</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目录下.
选择struts的config文件
本例中选择jpf-struts-config-test.xml
加入配置文件
选择一个Action作为portlet的入口
然后将生成的portlets加入portal即可.