You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Chetan Sahasrabudhe <ch...@wisorindia.soft.net> on 2003/02/26 11:12:43 UTC
[Q] FORM BEAN SCOPE
BlankAll you ppl who have developed struts, can you please help me in this problem.
I have asked this question on struts mailing list, but no one is giving me
answer to this.
I have session scope in both action mappings
I have attached my struts-config along with this mail.
btw in my jsp i have form bean saying
JSP 1
<html:form action="/ominterfaceinfo.do" focus="sOMName" onsubmit="return
validateWIGAdminWizardForm(this);">
JSP 2
<html:form action="/translator.do" onsubmit="return
validateWIGAdminWizardForm(this);">
now, when I call jsp1 the bean is getting created
but when I move to jsp 2 , again new bean is created. I know this coz I have written default constructor in
my FormBean class and printing a message in it by System.out.println()
And thatz the problem area.
Thanks
Chetan
Regards
Chetan
_______________________________
|
| The trouble with being punctual
| is that nobody's there to appreciate it.
|
|
|_______________________________
RE: [Q] FORM BEAN SCOPE
Posted by James Mitchell <jm...@apache.org>.
He resolved this on the users list.
It was his code removing the bean from session.
--
James Mitchell
Software Engineer/Struts Evangelist
> -----Original Message-----
> From: Ted Husted [mailto:husted@apache.org]
> Sent: Wednesday, February 26, 2003 8:12 AM
> To: Struts Developers List
> Subject: Re: [Q] FORM BEAN SCOPE
>
>
> I don't see an obvious error in your configuration. If the Release
> Candidate is ignoring scope, then this would be a problem, and you
> should file a bugzilla ticket. Ideally, you could include a
> Struts TestCase
>
> http://strutstestcase.sourceforge.net/
>
> demonstrating the problem.
>
> There is another ticket in there regarding ActionForm lifecycle,
>
> http://issues.apache.org/bugzilla/show_bug.cgi?id=17273
>
> but that seems unrelated.
>
> -Ted.
>
> Chetan Sahasrabudhe wrote:
> > All you ppl who have developed struts, can you please help
> me in this
> > problem.
> > I have asked this question on struts mailing list, but no
> one is giving me
> > answer to this.
> >
> > I have session scope in both action mappings
> > I have attached my struts-config along with this mail.
> >
> > btw in my jsp i have form bean saying
> >
> > JSP 1
> > <html:form action="/ominterfaceinfo.do" focus="sOMName"
> onsubmit="return
> > validateWIGAdminWizardForm(this);">
> >
> > JSP 2
> > <html:form action="/translator.do" onsubmit="return
> > validateWIGAdminWizardForm(this);">
> >
> >
> > now, when I call jsp1 the bean is getting created
> > but when I move to jsp 2 , again new bean is created. I
> know this coz I
> > have written default constructor in
> > my FormBean class and printing a message in it by
> System.out.println()
> >
> > And thatz the problem area.
> >
> > Thanks
> > Chetan
> > Regards
> > Chetan
> > _______________________________
> > |
> > | The trouble with being punctual
> > | is that nobody's there to appreciate it.
> > |
> > |
> > |_______________________________
> >
> >
> >
> >
> >
> --------------------------------------------------------------
> ----------
> >
> > <?xml version="1.0" encoding="ISO-8859-1" ?>
> >
> > <!DOCTYPE struts-config PUBLIC
> > "-//Apache Software Foundation//DTD Struts
> Configuration 1.1//EN"
> >
> "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
> >
> > <!--
> > This is the Struts configuration file for the WIGAdmin
> application,
> > using the proposed new syntax.
> >
> > NOTE: You would only flesh out the details in the "form-bean"
> > declarations if you had a generator tool that used
> them to create
> > the corresponding Java classes for you. Otherwise, you would
> > need only the "form-bean" element itself, with the
> corresponding
> > "name" and "type" attributes.
> > -->
> >
> >
> > <struts-config>
> >
> >
> > <!-- ========== Data Source Configuration
> =============================== -->
> > <!--
> > <data-sources>
> > <data-source>
> > <set-property property="autoCommit"
> > value="false"/>
> > <set-property property="description"
> > value="Example Data Source Configuration"/>
> > <set-property property="driverClass"
> > value="org.postgresql.Driver"/>
> > <set-property property="maxCount"
> > value="4"/>
> > <set-property property="minCount"
> > value="2"/>
> > <set-property property="password"
> > value="mypassword"/>
> > <set-property property="url"
> >
> value="jdbc:postgresql://localhost/mydatabase"/>
> > <set-property property="user"
> > value="myusername"/>
> > </data-source>
> > </data-sources>
> > -->
> > <!-- ========== Form Bean Definitions
> =================================== -->
> > <form-beans>
> >
> > <form-bean name="wigadminwizardform"
> >
> type="wigadmin.struts.forms.WIGAdminWizardForm">
> > <form-property name="nOMId" type="int"/>
> > <form-property name="sOMName" type="java.lang.String"/>
> > <form-property name="sTransactionType" type="java.lang.String"/>
> > <form-property name="sServerName" type="java.lang.String"/>
> > <form-property name="sPortNumber" type="java.lang.String"/>
> > <form-property name="chkExistingOMName" type="boolean"/>
> > <form-property name="sExistingOMName" type="java.lang.String"/>
> > <form-property name="alExistingOMName"
> type="java.util.Collection"/>
> >
> > <form-property name="sTranslatorType" type="java.lang.String"/>
> > <form-property name="sBatchFileName" type="java.lang.String"/>
> > <form-property name="sWisorMainBatchFileName"
> type="java.lang.String"/>
> > <form-property name="colTranslatorType"
> type="java.util.Collection"/>
> > </form-bean>
> >
> > </form-beans>
> >
> >
> > <!-- ========== Global Forward Definitions
> ============================== -->
> > <global-forwards>
> > <!-- Adding global forward definition for
> OMInterfaceInfo jsp -->
> > <forward name="ominterfaceinfo" path="/ominterfaceinfo.jsp"/>
> > <forward name="success" path="/wigadmin.html"/>
> > <forward name="tpinterfaceinfo" path="/TPInterfaceInfo.html"/>
> > <forward name="translator" path="/translator.jsp"/>
> > </global-forwards>
> >
> >
> > <!-- ========== Action Mapping Definitions
> ============================== -->
> > <action-mappings>
> >
> > <!-- adding aciton mapping information,
> > this will deligate request to OMInterfaceInfoAction
> > class for WIGAdminWizardForm bean -->
> >
> > <!-- Order Manager Interface Information -->
> > <action path="/ominterfaceinfo"
> > type="wigadmin.struts.action.OMInterfaceInfoAction"
> > name="wigadminwizardform"
> > input="ominterfaceinfo"
> > validate="true">
> >
> > </action>
> >
> > <!-- Translator Information -->
> > <action path="/translator"
> > type="wigadmin.struts.action.TranslatorAction"
> > name="wigadminwizardform"
> > input="translator"
> > validate="true">
> > </action>
> >
> >
> > </action-mappings>
> >
> >
> > <!-- ========== Controller Configuration
> ================================ -->
> >
> > <controller>
> > <!-- The "input" parameter on "action" elements is the name of a
> > local or global "forward" rather than a
> module-relative path -->
> > <set-property property="inputForward" value="true"/>
> > <set-property property="locale" value="true"/>
> > </controller>
> >
> >
> > <!-- ========== Message Resources Definitions
> =========================== -->
> >
> > <message-resources
> parameter="wigadmin.struts.properties.ApplicationResources">
> >
> > </message-resources>
> >
> >
> > <!-- ========== Plug Ins Configuration
> ================================== -->
> > <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
> > <set-property property="pathnames"
> > value="/WEB-INF/validator-rules.xml,
> > /WEB-INF/validation.xml"/>
> > </plug-in>
> >
> > </struts-config>
> >
> >
> >
> --------------------------------------------------------------
> ----------
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-dev-help@jakarta.apache.org
>
>
> --
> Ted Husted,
> Struts in Action <http://husted.com/struts/book.html>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-dev-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org
Re: [Q] FORM BEAN SCOPE
Posted by Ted Husted <hu...@apache.org>.
I don't see an obvious error in your configuration. If the Release
Candidate is ignoring scope, then this would be a problem, and you
should file a bugzilla ticket. Ideally, you could include a Struts TestCase
http://strutstestcase.sourceforge.net/
demonstrating the problem.
There is another ticket in there regarding ActionForm lifecycle,
http://issues.apache.org/bugzilla/show_bug.cgi?id=17273
but that seems unrelated.
-Ted.
Chetan Sahasrabudhe wrote:
> All you ppl who have developed struts, can you please help me in this
> problem.
> I have asked this question on struts mailing list, but no one is giving me
> answer to this.
>
> I have session scope in both action mappings
> I have attached my struts-config along with this mail.
>
> btw in my jsp i have form bean saying
>
> JSP 1
> <html:form action="/ominterfaceinfo.do" focus="sOMName" onsubmit="return
> validateWIGAdminWizardForm(this);">
>
> JSP 2
> <html:form action="/translator.do" onsubmit="return
> validateWIGAdminWizardForm(this);">
>
>
> now, when I call jsp1 the bean is getting created
> but when I move to jsp 2 , again new bean is created. I know this coz I
> have written default constructor in
> my FormBean class and printing a message in it by System.out.println()
>
> And thatz the problem area.
>
> Thanks
> Chetan
> Regards
> Chetan
> _______________________________
> |
> | The trouble with being punctual
> | is that nobody's there to appreciate it.
> |
> |
> |_______________________________
>
>
>
>
> ------------------------------------------------------------------------
>
> <?xml version="1.0" encoding="ISO-8859-1" ?>
>
> <!DOCTYPE struts-config PUBLIC
> "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
> "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
>
> <!--
> This is the Struts configuration file for the WIGAdmin application,
> using the proposed new syntax.
>
> NOTE: You would only flesh out the details in the "form-bean"
> declarations if you had a generator tool that used them to create
> the corresponding Java classes for you. Otherwise, you would
> need only the "form-bean" element itself, with the corresponding
> "name" and "type" attributes.
> -->
>
>
> <struts-config>
>
>
> <!-- ========== Data Source Configuration =============================== -->
> <!--
> <data-sources>
> <data-source>
> <set-property property="autoCommit"
> value="false"/>
> <set-property property="description"
> value="Example Data Source Configuration"/>
> <set-property property="driverClass"
> value="org.postgresql.Driver"/>
> <set-property property="maxCount"
> value="4"/>
> <set-property property="minCount"
> value="2"/>
> <set-property property="password"
> value="mypassword"/>
> <set-property property="url"
> value="jdbc:postgresql://localhost/mydatabase"/>
> <set-property property="user"
> value="myusername"/>
> </data-source>
> </data-sources>
> -->
> <!-- ========== Form Bean Definitions =================================== -->
> <form-beans>
>
> <form-bean name="wigadminwizardform"
> type="wigadmin.struts.forms.WIGAdminWizardForm">
> <form-property name="nOMId" type="int"/>
> <form-property name="sOMName" type="java.lang.String"/>
> <form-property name="sTransactionType" type="java.lang.String"/>
> <form-property name="sServerName" type="java.lang.String"/>
> <form-property name="sPortNumber" type="java.lang.String"/>
> <form-property name="chkExistingOMName" type="boolean"/>
> <form-property name="sExistingOMName" type="java.lang.String"/>
> <form-property name="alExistingOMName" type="java.util.Collection"/>
>
> <form-property name="sTranslatorType" type="java.lang.String"/>
> <form-property name="sBatchFileName" type="java.lang.String"/>
> <form-property name="sWisorMainBatchFileName" type="java.lang.String"/>
> <form-property name="colTranslatorType" type="java.util.Collection"/>
> </form-bean>
>
> </form-beans>
>
>
> <!-- ========== Global Forward Definitions ============================== -->
> <global-forwards>
> <!-- Adding global forward definition for OMInterfaceInfo jsp -->
> <forward name="ominterfaceinfo" path="/ominterfaceinfo.jsp"/>
> <forward name="success" path="/wigadmin.html"/>
> <forward name="tpinterfaceinfo" path="/TPInterfaceInfo.html"/>
> <forward name="translator" path="/translator.jsp"/>
> </global-forwards>
>
>
> <!-- ========== Action Mapping Definitions ============================== -->
> <action-mappings>
>
> <!-- adding aciton mapping information,
> this will deligate request to OMInterfaceInfoAction
> class for WIGAdminWizardForm bean -->
>
> <!-- Order Manager Interface Information -->
> <action path="/ominterfaceinfo"
> type="wigadmin.struts.action.OMInterfaceInfoAction"
> name="wigadminwizardform"
> input="ominterfaceinfo"
> validate="true">
>
> </action>
>
> <!-- Translator Information -->
> <action path="/translator"
> type="wigadmin.struts.action.TranslatorAction"
> name="wigadminwizardform"
> input="translator"
> validate="true">
> </action>
>
>
> </action-mappings>
>
>
> <!-- ========== Controller Configuration ================================ -->
>
> <controller>
> <!-- The "input" parameter on "action" elements is the name of a
> local or global "forward" rather than a module-relative path -->
> <set-property property="inputForward" value="true"/>
> <set-property property="locale" value="true"/>
> </controller>
>
>
> <!-- ========== Message Resources Definitions =========================== -->
>
> <message-resources parameter="wigadmin.struts.properties.ApplicationResources">
>
> </message-resources>
>
>
> <!-- ========== Plug Ins Configuration ================================== -->
> <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
> <set-property property="pathnames"
> value="/WEB-INF/validator-rules.xml,
> /WEB-INF/validation.xml"/>
> </plug-in>
>
> </struts-config>
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-dev-help@jakarta.apache.org
--
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org
RE: [Q] FORM BEAN SCOPE
Posted by James Mitchell <jm...@apache.org>.
I know its frustrating, but let's keep this on struts-users side where
it belongs.
--
James Mitchell
Software Engineer/Struts Evangelist
-----Original Message-----
From: Chetan Sahasrabudhe [mailto:chetans@wisorindia.soft.net]
Sent: Wednesday, February 26, 2003 5:13 AM
To: Struts Developers List
Subject: [Q] FORM BEAN SCOPE
All you ppl who have developed struts, can you please help me in this
problem.
I have asked this question on struts mailing list, but no one is giving
me
answer to this.
I have session scope in both action mappings
I have attached my struts-config along with this mail.
btw in my jsp i have form bean saying
JSP 1
<html:form action="/ominterfaceinfo.do" focus="sOMName" onsubmit="return
validateWIGAdminWizardForm(this);">
JSP 2
<html:form action="/translator.do" onsubmit="return
validateWIGAdminWizardForm(this);">
now, when I call jsp1 the bean is getting created
but when I move to jsp 2 , again new bean is created. I know this coz I
have written default constructor in
my FormBean class and printing a message in it by System.out.println()
And thatz the problem area.
Thanks
Chetan
Regards
Chetan
_______________________________
|
| The trouble with being punctual
| is that nobody's there to appreciate it.
|
|
|_______________________________