Sie sind auf Seite 1von 6

Web.xml(web.

xml):
<!-- Action Servlet Configuration --> <servlet> <servlet-name> Action </servlet-name> <servlet-class> org.apache.struts.action.ActionServlet </servlet-class> <init-param> <param-name>config</param-name> <param-value> /WEB-INF/conf/struts-config.xml, /WEB-INF/conf/struts-config-rt.xml, /WEB-INF/conf/view-beans-rt.xml, /WEB-INF/conf/form-beans-rt.xml </param-value> </init-param> <init-param> <param-name>validate</param-name> <param-value>true</param-value> </init-param> </servlet>

Struts-config.xml(struts-config.xml):
<!-- ========== Plug-in Definitions =================================== --> <plug-in className="org.apache.struts.validator.ValidatorPlugIn"> <set-property property="pathnames" value="/WEB-INF/conf/validation-rt.xml" /> </plug-in>

<plug-in className="org.apache.struts.tiles.TilesPlugin"> <set-property property="definitions-config" value="/WEB-INF/conf/tiles-defs-rt.xml" />

<set-property property="definitions-debug" value="1" /> <set-property property="definitions-parser-details" value="0" /> <set-property property="definitions-parser-validate" value="true" /> </plug-in>

Tab creation:
Tab_root-rt.xml(tab_root-rt.xml):
<root bundle="rt.messages"> <path>/</path> <tab nameKey="tab.report" path="/report/customerReport" order="11"> <filter-check> <filter-or> <filter-role name="UserAdmin"/> <filter-and> <filter-or> <filter-license tag="portal.framework.basic"/> </filter-or> <filter-role name="OrganizationAdmin"/> </filter-and> </filter-or> </filter-check> </tab> </root>

Struts-config-rt.xml(struts-config-rt.xml):
<struts-config> <action-mappings> <action path="/report/customerReport" type="com.broadvision.report.action.CustomerReportAction" name="reportForm" scope="request"> <forward name="success" path=".rt.customer.report"/> </action> <action path="/report/customerDetail" type="com.broadvision.report.action.CustomerDetailAction" name="reportForm" scope="request"> <forward name="success" path=".rt.customer.detail"/> </action> <action path="/report/saveCustomerDetail" type="com.broadvision.report.action.CustomerDetailAction" name="reportForm" scope="request"> <forward name="success" path=".rt.customer.detail"/> </action> </action-mappings>

<!-- ========== Message Resources Definition ========================== --> <message-resources key="rt.messages" parameter="com.broadvision.report.ApplicationResources_rt" null="false"/> </struts-config>

ApplicationResources_rt.properties:
tab.report=Report menu.customer.report=Customer Report report.customer.pageTitle=Customer Detail Form report.customer.detail=Please Fill detail report.customer.name=Customer Name report.customer.company=Company Name report.customer.address=Address report.customer.email=Email report.customer.finish=Finish

Tiles-defs-rt.xml(tiles-defs-rt.xml):
<tiles-definitions> <definition name=".rt.customer.report" extends=".mc.home.default"> <put name="body" value=".rt.customer.report.body" type="definition"/> </definition> <definition name=".rt.customer.report.body" extends=".mc.common.body"> <put name="mainBody" value="/rt/jsp/report.jsp"/> </definition> <definition name=".rt.customer.detail" extends=".mc.home.default"> <put name="body" value=".rt.customer.detail.body" type="definition"/> </definition> <definition name=".rt.customer.detail.body" extends=".mc.common.body"> <put name="mainBody" value="/rt/jsp/customerDetail.jsp"/> </definition> </tiles-definitions>

CustomerReportAction.java
public class CustomerReportAction extends BaseAction{ private static String VIEW_BEAN ="customerReportForm";

public ActionForward processExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)throws Exception { System.out.println( "Starting CustomerReportAction"); System.out.println( "Starting CustomerReportAction ");

return mapping.findForward("success");} }

Report.jsp(report.jsp) :

View-beans-rt.xml:
<struts-config> <form-beans> <form-bean name="customerReportForm" type="org.apache.struts.action.DynaActionForm"> <description>For customer report</description> <form-property name="CUST_LIST" type="java.lang.String" /> </form-bean> </form-beans> </struts-config>

Form-beans-rt.xml:
<struts-config> <form-beans> <form-bean name="reportForm" type="org.apache.struts.validator.DynaValidatorForm"> <description> Customer detail. </description> <form-property name="name" type="java.lang.String"></form-property> <form-property name="companyName" type="java.lang.String"></form-property> <form-property name="address" type="java.lang.String"></form-property> <form-property name="email" type="java.lang.String"></form-property> </form-bean> </form-beans> </struts-config>

Menu_report-rt.xml:
<root bundle="rt.messages"> <menuItem nameKey="menu.customer.report" path="/report/customerReport" order="1"> </menuItem> </root>

Das könnte Ihnen auch gefallen