Configuring the Struts Extensions

Configuring the Struts Extensions consists of the following steps:

  1. Create JSP files that calls various Struts actions. For example, the following JSP codes call the creditcardprocess action when a user submits the credit card application form:
    <btt:form action="/creditcardprocess">		<CENTER>
    <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=640><TR><TD>
    		<INPUT TYPE="radio" NAME="nextEventName" VALUE="OK">
    		<btt:label text="Process_my_selection"/>
    </TD></TR><TR><TD>
    		<INPUT TYPE="radio" NAME="nextEventName" VALUE="Cancel" CHECKED>
    		<btt:label text="Cancel_credit_card_application"/>
    </TD></TR><TR><TD COLSPAN=2 ALIGN="center">
    		<INPUT TYPE="submit" VALUE="<btt:label text="Continue"/>">
    </TD></TR></TABLE>
    </CENTER>
    </btt:form>
  2. Configure the Struts actions in the Struts configuration file. The following is an example showing the definition of the creadcardprocess action configuration.
    <action name="creditCardForm" 
    	path="/creditcardprocess"
     	className="com.ibm.btt.struts.config.BTTEJBActionMapping" 
    	type="com.ibm.btt.struts.actions.EJBAction" 
    	input="/creditCardConfirmationPage.jsp" 
    	invokerId="creditcardprocessinvoker">
    			<forward name="success" path="/creditCardProcessedPage.jsp"/>
    			<forward name="cancel" contextRelative="true" path="/btt/html/accountSummary/accountinquiry.jsp"/>
    </action>
    In the example above, the Struts action will call the invoker named creditcardprocessinvoker to invoke the corresponding business process or Single Action EJB to process the credit card application request. Then, depending on the response the invoker gets, the Struts action will display the creditCardProcessedPage.jsp page or the accountinquiry.jsp page.
  3. Register your Struts configuration files with the web.xml file of your application EAR. Here is an example:
    <servlet id="Servlet_1111028199453">
    	<servlet-name>action</servlet-name>
    	<servlet-class>com.ibm.btt.struts.base.BTTActionServlet</servlet-class>
    		<init-param>
    		<param-name>config/btt/html/creditCard</param-name>
    		<param-value>/WEB-INF/struts-config_creditCard.xml</param-value>
    		</init-param>
    </servlet>
  4. Register your CHA configuration file with the web.xml file of your application EAR. Here is an example:
    <servlet id="Servlet_1111028199453">
    	<servlet-name>action</servlet-name>
    	<servlet-class>com.ibm.btt.struts.base.BTTActionServlet</servlet-class>
    		<init-param>
    		<param-name>config/btt/html/creditCard</param-name>
    		<param-value>/WEB-INF/struts-config_creditCard.xml</param-value>
    		</init-param>
    </servlet>

You can use the Struts Editor BTT Extensions Tool to generate the Struts configuration files.

See more examples of JSP files and Struts configurations files in the BTTHTMLSample.ear file in your <tookit_root>/samples directory.
Related information
The Apache Struts Framework: The Struts Configuration File