You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2004/03/26 18:20:48 UTC

DO NOT REPLY [Bug 27989] New: - using scope="application" does not work with action & useBean

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27989>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=27989

using scope="application" does not work with action & useBean

           Summary: using scope="application" does not work with action &
                    useBean
           Product: Tomcat 5
           Version: 5.0.16
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Unknown
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: jlaughto@cisco.com


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

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org