struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Thompson <elephant...@gmail.com>
Subject Re: Struts2 Validation with Spring convention plugin
Date Tue, 26 Jan 2010 16:59:23 GMT
I'm guessing that you have something like

this.myList = populateList();

inside your execute() method.  When validation fails, it just sends you back
to the jsp without redoing execute(), so of course the list will be null.

-Brian



On Tue, Jan 26, 2010 at 10:26 AM, nani2ratna <nani2ratna@gmail.com> wrote:

>
> Hi Brian,
> I have seen that interface.
> If I got more than one action method in one action class.
> Then when ever you execute/call method(action) in that action class,
> this prepare method will be called and this setting of list will be
> executed.
>
> But My main question why the list setting to null value.
> Isn't it a big, can't we fix it.
>
> And in my company i fought with everybody to bring struts2 into project.
> And now i don't have any answer to this, untill any guys help me.
>
> Thanks
> RS
>
>
>
> Brian Thompson-5 wrote:
> >
> > You might look into using the Preparable interface [1].  It's useful for
> > these types of situations; just add the code to generate the list into a
> > prepare() method on your action class instead of in execute().
> >
> > Hope this helps,
> >
> > -Brian
> >
> > [1] -
> >
> http://www.opensymphony.com/xwork/api/com/opensymphony/xwork2/Preparable.html
> >
> >
> >
> > On Tue, Jan 26, 2010 at 7:22 AM, nani2ratna <nani2ratna@gmail.com>
> wrote:
> >
> >>
> >> Hi,
> >>
> >> I am using struts2, spring with spring convention plugin.
> >> SO all my action classes has been specified in application-Context.xml.
> >> One of my action class got Bean as a property. So I can dealt with the
> >> bean
> >> properties in JSP.
> >>
> >> The problem, when I am working with my validation i am getting Error
> >> messages repeated problem.
> >> Solution for this one is change scope to prototype.
> >>
> >> Now I got another problem, I got a list box in jsp page. If validation
> >> fails
> >> I am getting the following error.
> >> could not be resolved as a collection/array/map/enumeration/iterator
> type
> >>
> >> This is happening because, list in Javabean becoming null when
> validation
> >> fails.
> >>
> >> Then i changed scope="request". And i have added cglib.jar.
> >> Now i am getting following error.
> >>
> >> org.springframework.beans.factory.BeanCreationException: Error creating
> >> bean
> >> with name 'scopedTarget.pmaction': Scope 'request' is not active for the
> >> current thread; consider defining a scoped proxy for this bean if you
> >> intend
> >> to refer to it from a singleton; nested exception is
> >> java.lang.IllegalStateException: No thread-bound request found: Are you
> >> referring to request attributes outside of an actual web request, or
> >> processing a request outside of the originally receiving thread? If you
> >> are
> >> actually operating within a web request and still receive this message,
> >> your
> >> code is probably running outside of DispatcherServlet/DispatcherPortlet:
> >> In
> >> this case, use RequestContextListener or RequestContextFilter to expose
> >> the
> >> current request.
> >>
> >>
> >> So if you have list box in jsp page and need to do validation on that
> jsp
> >> page. ANd you configured all your action classes in Spring appContext
> >> file.
> >> You wont succeed.
> >>
> >> Is that correct. Or is there any solution.
> >>
> >> Thanks and Regards
> >> RS
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/Struts2-Validation-with-Spring-convention-plugin-tp27322517p27322517.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
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/Struts2-Validation-with-Spring-convention-plugin-tp27322517p27325427.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
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message