You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by vhumble <vn...@gnsi.com> on 2009/03/04 21:50:09 UTC
prepare method not working
Hi,
I am implementing prepare method to populate the values in the list if
validation fails and we need to present the same page back to the user.
Even after implementing the prepare method, I still get the same error as
before and when I debug with eclipse, i never enter into prepare method. I
am using basic struts-default stack and in this stack, prepare comes before
validation.
Is there anything else that I need to do to get prepare method working like
specifically implementing preparable interface.
Attached are the code snippets.
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="true" />
<constant name="struts.devMode" value="false" />
<constant name="struts.objectFactory"
value="org.apache.struts2.spring.StrutsSpringObjectFactory" />
<package name="ESG" namespace="/ESG_TPMS" extends="struts-default">
<action name="AddTestAccount" class="esg.sc.net.AddTestAccount">
<result name="input">/WEB-INF/jsp/AddTestAccount.jsp</result>
<result name="error">/WEB-INF/jsp/AddTestAccount.jsp</result>
</action>
<action name="RefreshCompanyList"
class="esg.sc.net.RefreshCompanyList">
<result>/WEB-INF/jsp/companyList.jsp</result>
<result name="error">/WEB-INF/jsp/blank.jsp</result>
</action>
Attachment of jsp page: AddTestAccount.jsp
http://www.nabble.com/file/p22339038/AddTestAccount.jsp AddTestAccount.jsp
Attachment of Action Classes:
http://www.nabble.com/file/p22339038/AddAccount.java AddAccount.java
http://www.nabble.com/file/p22339038/RefreshCompanyList.java
RefreshCompanyList.java
Thanks for your help
--
View this message in context: http://www.nabble.com/prepare-method-not-working-tp22339038p22339038.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: prepare method not working
Posted by markbeek <ma...@carolina.rr.com>.
vhumble wrote:
>
> Even after implementing the prepare method, I still get the same error as
> before and when I debug with eclipse, i never enter into prepare method. I
> am using basic struts-default stack and in this stack, prepare comes
> before validation.
>
You do need to implement the Preparable interface. Otherwise the prepare
interceptor will not be able to call your prepare method.
Chapter 10 of Budi Kurniawan's book Struts 2 Design and Programming has a
good explanation of how to use the prepare interceptor.
--
View this message in context: http://www.nabble.com/prepare-method-not-working-tp22339038p22366253.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: prepare method not working
Posted by Dave Newton <ne...@yahoo.com>.
vhumble wrote:
> Thank you. As of now I am not implementing Preparable. But I will try
> implementing it and see. I thought the order of interceptors in
> struts-default package will automatically take precedence and get applied as
> validation happens automatically.
It does, but validation != preparable. The preparable interceptor looks
for implementors of Preparable.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: prepare method not working
Posted by vhumble <vn...@gnsi.com>.
Thanks Dave. It is working after I implemented the Preparable interface
vhumble wrote:
>
> Thank you. As of now I am not implementing Preparable. But I will try
> implementing it and see. I thought the order of interceptors in
> struts-default package will automatically take precedence and get applied
> as validation happens automatically.
>
>
> newton.dave wrote:
>>
>> vhumble wrote:
>>> Is there anything else that I need to do to get prepare method working
>>> like
>>> specifically implementing preparable interface.
>>
>> Are you, or are you not, implementing Preparable? You need to, AFAIK. Is
>> there documentation that suggests otherwise?
>>
>> Dave
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/prepare-method-not-working-tp22339038p22361719.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: prepare method not working
Posted by vhumble <vn...@gnsi.com>.
Thank you. As of now I am not implementing Preparable. But I will try
implementing it and see. I thought the order of interceptors in
struts-default package will automatically take precedence and get applied as
validation happens automatically.
newton.dave wrote:
>
> vhumble wrote:
>> Is there anything else that I need to do to get prepare method working
>> like
>> specifically implementing preparable interface.
>
> Are you, or are you not, implementing Preparable? You need to, AFAIK. Is
> there documentation that suggests otherwise?
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/prepare-method-not-working-tp22339038p22352228.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: prepare method not working
Posted by Dave Newton <ne...@yahoo.com>.
vhumble wrote:
> Is there anything else that I need to do to get prepare method working like
> specifically implementing preparable interface.
Are you, or are you not, implementing Preparable? You need to, AFAIK. Is
there documentation that suggests otherwise?
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org