You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by rohit <ro...@in-rev.com> on 2012/12/03 09:42:59 UTC

Prototype beans

We are defining struts action classes in spring as prototype bean, in this while editing a particular bean a new object is being inserted, I can imagine this would be because of prototype nature of beans.

How can we achieve edit with prototype beans?

Regards,
Rohit


Re: Prototype beans

Posted by Lukasz Lenart <lu...@apache.org>.
2012/12/3 Rohit Gupta <ro...@simplify360.com>:
> I am using XML approach, it works fine when the type is not prototype,
> understandable so since the same instance is used across requests.

As I understand you have been using session scoped actions or even
singletons - and edit worked because the instance was there all the
time (in session bean). But thus is wrong :-)

You must load instance from backend on each request - load, apply
changes from a form, save.


Regards
-- 
Ɓukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Prototype beans

Posted by Umesh Awasthi <um...@gmail.com>.
Not sure if i am able to understand your question
Can you clarify what you mean by
*How can we achieve edit with prototype beans*

In particular *edit*
On Mon, Dec 3, 2012 at 2:49 PM, Puneet Babbar 2 <pb...@sapient.com>wrote:

> Are you using annotations or xml approach to work with struts? And have
> you checked what happens when you don't define your struts actions as
> prototype?
>
> -Puneet
>
> -----Original Message-----
> From: rohit [mailto:rohit@in-rev.com]
> Sent: Monday, December 03, 2012 2:13 PM
> To: user@struts.apache.org
> Subject: Prototype beans
>
>
> We are defining struts action classes in spring as prototype bean, in this
> while editing a particular bean a new object is being inserted, I can
> imagine this would be because of prototype nature of beans.
>
> How can we achieve edit with prototype beans?
>
> Regards,
> Rohit
>
>


-- 
With Regards
Umesh Awasthi
http://www.travellingrants.com/

Re: Prototype beans

Posted by Rohit Gupta <ro...@simplify360.com>.
I am using XML approach, it works fine when the type is not prototype,
understandable so since the same instance is used across requests.



On 03/12/12 2:49 PM, "Puneet Babbar 2" <pb...@sapient.com> wrote:

>Are you using annotations or xml approach to work with struts? And have
>you checked what happens when you don't define your struts actions as
>prototype?
>
>-Puneet
>
>-----Original Message-----
>From: rohit [mailto:rohit@in-rev.com]
>Sent: Monday, December 03, 2012 2:13 PM
>To: user@struts.apache.org
>Subject: Prototype beans
>
>
>We are defining struts action classes in spring as prototype bean, in
>this while editing a particular bean a new object is being inserted, I
>can imagine this would be because of prototype nature of beans.
>
>How can we achieve edit with prototype beans?
>
>Regards,
>Rohit
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Prototype beans

Posted by Puneet Babbar 2 <pb...@sapient.com>.
Are you using annotations or xml approach to work with struts? And have you checked what happens when you don't define your struts actions as prototype?

-Puneet

-----Original Message-----
From: rohit [mailto:rohit@in-rev.com] 
Sent: Monday, December 03, 2012 2:13 PM
To: user@struts.apache.org
Subject: Prototype beans


We are defining struts action classes in spring as prototype bean, in this while editing a particular bean a new object is being inserted, I can imagine this would be because of prototype nature of beans.

How can we achieve edit with prototype beans?

Regards,
Rohit