Jsp1.jsp Sample

This topic inludes the source code for the Jsp1.jsp Sample.

Sample Location

This sample is located in the following directory in your WebLogic Workshop installation:

BEA_HOME/weblogic81/samples/workshop/SamplesApp/WebApp/struts/strutsInterop/

Sample Source Code


01 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
02 <%@ taglib uri="netui-tags-html.tld" prefix="netui" %>
03 
04 <html>
05     <head>
06         <title>Struts Interop/Merge Example</title>
07       <netui:base/>
08       <link href="../../resources/css/style.css" type="text/css" rel="stylesheet"/>
09     </head>
10    
11    <body bgcolor=white style="margin:0">
12 
13    <jsp:include page="/resources/jsp/header.jsp"/>
14 
15     <blockquote>
16       
17         <h3 align="center">This page, Jsp1.jsp, is part of page flow strutsInteropController</h3>
18         <hr width="95%"/>
19         <br/>
20 
21         <p>After reading the following explanation about this Struts Interop/Merge
22         example, please click the Continue link near the bottom of the page.
23          
24         <p>This example demonstrates the complete interoperability between page flows
25         and Struts.  The strutsInteropController page flow instantiates a form bean,
26         JpfFormBean, then passes this form to the Struts module: strutsModule.  </p>
27         
28         <p>The Struts module will then alter the contents of the form and pass it back 
29         to the page flow. Because page flow forms derive from Struts forms, this 
30         sharing of the form bean is possible.</p>
31         
32         <p>Page flows by default scope form bean instances to the request.  But because
33         in this example we want to pass the form bean from the page flow to the struts
34         module, strutsModule, we must scope the form bean to the session.  We do this
35         by using the "struts-merge" attribute on the "@jpf:controller" annotation in
36         the strutsInteropController.jpf source file.  This attribute will cause the
37         contents of the specified Struts XML file to be merged-in with the generated
38         jpf-struts-config-strutsInterop.xml file. In the event of a naming conflict, artifacts in 
39         the Struts "merge" file always takes precedence.</p>
40         
41         <p>The form bean we use in this example has a single field, "field1".  At each step
42         the action (whether page flow or Strutswill update the value of "field1" so you an see
43         that the same instance of the form is being passed around.</p>
44          
45         <p>Also note that the Jsp1.jsp (this JSPand Jsp3.jsp pages are part of the
46         page flow, while Jsp2.jsp is associated with the Struts module. </p>
47 
48         <center>
49             <font color="red" size="4">
50                 <netui:form action="jpfAction1">
51                    <netui:label value="{actionForm.field1}"/>
52                 </netui:form>
53             </font>
54             <br/>
55             <netui:anchor action="jpfAction1">Continue</netui:anchor>
56         </center>
57         
58         <p>&nbsp;</p>
59                 
60         <p>&nbsp;</p>
61       
62     </blockquote>
63     </body>
64 </html>