Bug 27989 - using scope="application" does not work with action & useBean
Summary: using scope="application" does not work with action & useBean
Status: RESOLVED INVALID
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Unknown (show other bugs)
Version: 5.0.16
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-26 17:20 UTC by John Laughton
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Laughton 2004-03-26 17:20:44 UTC
I am trying to create a bean that will be around for as long as the web app
(effectively static)

I did this
in structs-config.xml

 <form-bean name="drfForm" type="com.cisco.iptplatform.forms.DRFForm"/>


<!--Backup-->
        <action path="/drfSetup" type="com.cisco.iptplatform.actions.DRFAction"
 name="drfForm" scope="application" input="failure">
<forward name="success" path="/WEB-INF/pages/drfSetup.jsp"/>
<forward name="failure" path="/WEB-INF/pages/drfSetup.jsp"/>
</action>
        <action path="/drfStartBackup"
type="com.cisco.iptplatform.actions.DRFAction"  name="drfForm"
scope="application" input="failure">
<forward name="success" path="/WEB-INF/pages/drfStartBackup.jsp"/>
<forward name="failure" path="/WEB-INF/pages/drfStartBackup.jsp"/>
</action>
        <action path="/drfStartRestore"
type="com.cisco.iptplatform.actions.DRFAction"  name="drfForm"
scope="application" input="failure">
<forward name="success" path="/WEB-INF/pages/drfStartRestore.jsp"/>
<forward name="failure" path="/WEB-INF/pages/drfStartRestore.jsp"/>
</action>



in the jsp pages, I do this

<jsp:useBean id="drfForm" scope="application"
    class="com.cisco.iptplatform.forms.DRFForm"/>

<%
drfForm.setSecure("secure");  // set initial to secure
%>
<html:form action="/drfStartBackup">
....
<td>
   <html:text property="userID">
   </html:text>
</td>
....
<td>
   <html:radio property="secure" value="secure"/> Secure
</td>
....



I then use a similar jsp page to read the contents of drfForm

The problem is that the things I set with useBean I can read with useBean, but
the things I set with the html:text I can only see with html:text

I figure that two instances of the bean are being created, but I do not see how
to make it one ?
If I use scope="session" it seems to work OK, but the bean will be lost if I
switch sessions
Comment 1 Torsten Fohrer 2004-03-28 18:23:27 UTC
please send those request to the struct user mailing list.