RE: passing object in request from jsp to action
No, you weren't wrong. You cant set an attribute in the request uri. Those are only parameters, and there is no way from the jsp to populate an attribute and send it along with the request. Al -Original Message- From: Apte, Dhanashree (Noblestar) [mailto:[EMAIL PROTECTED] Sent: Thursday, March 31, 2005 1:21 PM To: 'Struts Users Mailing List' Subject: RE: passing object in request from jsp to action the same... my bad I wrote request.getParameter() instead of request.getAttribute(). :) Sorry! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: passing object in request from jsp to action
You serialize the object sort of. At least for a hacky solution. That is you add each attribute of it to the request. Lets say I have an object user I wish to pass and user has firstname and lastname as whatever. Going to actionA: Then in my action I can create a user object by getting all the user. parameters and instantiating one. It's a VERY hacky way of doing things in struts. What you are trying to do is go directly to a JSP and then go to an action (or at least it sounds like that to me). A MUCH better solution (and frankly imho the right way to do it in struts) is to use a dynaActionForm for actionA... Instead of going directly to JSPA go to /prepActionA.do (note you CAN skip this if you do not have to prepopulate the object for presentation. But I would personally not go directly to a jsp in my application. Another possibility is to use a DispatchAction and create a method to do the prepopulation and another to do your processing) If you Already have a form for ActionA then you can also just add another attribute to the form. In my example I would add an attribute "user" of type User to the form. In that Action set up the dynaActionForm much like the example code I sent you showing how to pass objects around in the request. The DynaActionForm for my example above would have a property of type User. Then in my form I can see and edit those fields using etc. if I do not want the user to edit them, but must pass the object on, then use I think what you are trying to do can be seen in action using Matt Raible's (your welcome Matt for the shameless plug :) Equinox framework where he does something almost exactly like this. Equinox can be seen at: https://equinox.dev.java.net/framework-comparison/ Baring any of the above working I would seriously reconsider the design of this particular set of logic. But I am sure something like the above will work for you. Al - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: passing object in request from jsp to action
You cant. Not from a jsp. The request is already processed by the time you see the jsp and is no longer available. All you can do coming FROM a jsp TO an action is to use the request parameters. This is no different than if you were going from jsp1 to jsp2 directly so it should be familiar to you. Al -Original Message- From: temp temp [mailto:[EMAIL PROTECTED] Sent: Thursday, March 31, 2005 1:22 PM To: Struts Users Mailing List; Hubert Rabago Subject: Re: passing object in request from jsp to action By submitting a form to the action how can I pass some object using request.setAttribute ?could you guide me with this. thanks & regards --- Hubert Rabago <[EMAIL PROTECTED]> wrote: > Once the JSP has been rendered, processing for that > request is done. > Anything placed in request attributes while the JSP > was processing are > gone. To pass data from the generated HTML to an > action, you need to > submit a form or include request parameters in a > link. Another option > is to store the object in session scope. > > Hubert > > > On Thu, 31 Mar 2005 11:10:36 -0800 (PST), temp temp > <[EMAIL PROTECTED]> wrote: > > I want pass an object from a jsp to an struts > action > > in request attribute. > > > > I have a jsp it got link to an action upon click > the > > action is invoked. How can I pass object to this > > action using request Attribute. > > thanks & regards > > > > __ > > Do you Yahoo!? > > Yahoo! Small Business - Try our new resources > site! > > http://smallbusiness.yahoo.com/resources/ > > > > > - > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > __ Yahoo! Messenger Show us what our next emoticon should look like. Join the fun. http://www.advision.webevents.yahoo.com/emoticontest - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: passing object in request from jsp to action
When a form is submitted, data is passed as parameters, not attributes. You can access the data using request.getParameter(), as Dhanashree illustrated. > > Once the JSP has been rendered, processing for that request is done. > > Anything placed in request attributes while the JSP > > was processing are gone. Hubert On Thu, 31 Mar 2005 11:21:46 -0800 (PST), temp temp <[EMAIL PROTECTED]> wrote: > By submitting a form to the action how can I pass some > object using request.setAttribute ?could you guide me > with this. > thanks & regards > > > --- Hubert Rabago <[EMAIL PROTECTED]> wrote: > > Once the JSP has been rendered, processing for that > > request is done. > > Anything placed in request attributes while the JSP > > was processing are > > gone. To pass data from the generated HTML to an > > action, you need to > > submit a form or include request parameters in a > > link. Another option > > is to store the object in session scope. > > > > Hubert > > > > > > On Thu, 31 Mar 2005 11:10:36 -0800 (PST), temp temp > > <[EMAIL PROTECTED]> wrote: > > > I want pass an object from a jsp to an struts > > action > > > in request attribute. > > > > > > I have a jsp it got link to an action upon click > > the > > > action is invoked. How can I pass object to this > > > action using request Attribute. > > > thanks & regards > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: passing object in request from jsp to action
Due to the nature of HTTP, you cannot pass an object from the client's browser to the Action. Instead you either need to a. pass the form fields/request parameters you need to build your object again or b. store the Object in the session so you can retrieve it when the Action is called. I don't know of any other way... > -Original Message- > From: temp temp [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 31, 2005 2:22 PM > To: Struts Users Mailing List; Hubert Rabago > Subject: Re: passing object in request from jsp to action > > > By submitting a form to the action how can I pass some > object using request.setAttribute ?could you guide me > with this. > thanks & regards > > > --- Hubert Rabago <[EMAIL PROTECTED]> wrote: > > Once the JSP has been rendered, processing for that > > request is done. > > Anything placed in request attributes while the JSP > > was processing are > > gone. To pass data from the generated HTML to an > > action, you need to > > submit a form or include request parameters in a > > link. Another option > > is to store the object in session scope. > > > > Hubert > > > > > > On Thu, 31 Mar 2005 11:10:36 -0800 (PST), temp temp > > <[EMAIL PROTECTED]> wrote: > > > I want pass an object from a jsp to an struts > > action > > > in request attribute. > > > > > > I have a jsp it got link to an action upon click > > the > > > action is invoked. How can I pass object to this > > > action using request Attribute. > > > thanks & regards > > > > > > __ > > > Do you Yahoo!? > > > Yahoo! Small Business - Try our new resources > > site! > > > http://smallbusiness.yahoo.com/resources/ > > > > > > > > > - > > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > > > > > > > - > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > > > > __ > Yahoo! Messenger > Show us what our next emoticon should look like. Join the fun. > http://www.advision.webevents.yahoo.com/emoticontest > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: passing object in request from jsp to action
. how can I pass object through query String ? thanks & regards --- "Apte, Dhanashree (Noblestar)" <[EMAIL PROTECTED]> wrote: > the same... my bad I wrote request.getParameter() > instead of > request.getAttribute(). > :) Sorry! > > The solution below should work for you... > -Original Message- > From: temp temp [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 31, 2005 1:18 PM > To: Struts Users Mailing List > Subject: RE: passing object in request from jsp to > action > > I want to use request.getAttribute("string",object); > thanks & regards > > --- "Apte, Dhanashree (Noblestar)" > <[EMAIL PROTECTED]> wrote: > > ... meaning in the Action you want to reference it > by doing > > request.getParameter("someAttribute"); > > Is that correct? If so, on the jsp, in the link to > your action, add > > that parameter as well. Instead of just > > > > use > >. > > > > Hope this helps, > > Dhanashree. > > > > -Original Message- > > From: temp temp [mailto:[EMAIL PROTECTED] > > Sent: Thursday, March 31, 2005 1:11 PM > > To: user@struts.apache.org > > Subject: passing object in request from jsp to > action > > > > I want pass an object from a jsp to an struts > action in request > > attribute. > > > > I have a jsp it got link to an action upon click > the action is > > invoked. How can I pass object to this action > using request > > Attribute. > > thanks & regards > > > > > > > > > > __ > > Do you Yahoo!? > > Yahoo! Small Business - Try our new resources > site! > > http://smallbusiness.yahoo.com/resources/ > > > > > - > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > > > > __ > Do you Yahoo!? > Take Yahoo! Mail with you! Get it on your mobile > phone. > http://mobile.yahoo.com/maildemo > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: passing object in request from jsp to action
By submitting a form to the action how can I pass some object using request.setAttribute ?could you guide me with this. thanks & regards --- Hubert Rabago <[EMAIL PROTECTED]> wrote: > Once the JSP has been rendered, processing for that > request is done. > Anything placed in request attributes while the JSP > was processing are > gone. To pass data from the generated HTML to an > action, you need to > submit a form or include request parameters in a > link. Another option > is to store the object in session scope. > > Hubert > > > On Thu, 31 Mar 2005 11:10:36 -0800 (PST), temp temp > <[EMAIL PROTECTED]> wrote: > > I want pass an object from a jsp to an struts > action > > in request attribute. > > > > I have a jsp it got link to an action upon click > the > > action is invoked. How can I pass object to this > > action using request Attribute. > > thanks & regards > > > > __ > > Do you Yahoo!? > > Yahoo! Small Business - Try our new resources > site! > > http://smallbusiness.yahoo.com/resources/ > > > > > - > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > __ Yahoo! Messenger Show us what our next emoticon should look like. Join the fun. http://www.advision.webevents.yahoo.com/emoticontest - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: passing object in request from jsp to action
the same... my bad I wrote request.getParameter() instead of request.getAttribute(). :) Sorry! The solution below should work for you... -Original Message- From: temp temp [mailto:[EMAIL PROTECTED] Sent: Thursday, March 31, 2005 1:18 PM To: Struts Users Mailing List Subject: RE: passing object in request from jsp to action I want to use request.getAttribute("string",object); thanks & regards --- "Apte, Dhanashree (Noblestar)" <[EMAIL PROTECTED]> wrote: > ... meaning in the Action you want to reference it by doing > request.getParameter("someAttribute"); > Is that correct? If so, on the jsp, in the link to your action, add > that parameter as well. Instead of just > > use >. > > Hope this helps, > Dhanashree. > > -Original Message- > From: temp temp [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 31, 2005 1:11 PM > To: user@struts.apache.org > Subject: passing object in request from jsp to action > > I want pass an object from a jsp to an struts action in request > attribute. > > I have a jsp it got link to an action upon click the action is > invoked. How can I pass object to this action using request > Attribute. > thanks & regards > > > > > __ > Do you Yahoo!? > Yahoo! Small Business - Try our new resources site! > http://smallbusiness.yahoo.com/resources/ > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > __ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: passing object in request from jsp to action
I want to use request.getAttribute("string",object); thanks & regards --- "Apte, Dhanashree (Noblestar)" <[EMAIL PROTECTED]> wrote: > ... meaning in the Action you want to reference it > by doing > request.getParameter("someAttribute"); > Is that correct? If so, on the jsp, in the link to > your action, add that > parameter as well. Instead of just > > use >. > > Hope this helps, > Dhanashree. > > -Original Message- > From: temp temp [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 31, 2005 1:11 PM > To: user@struts.apache.org > Subject: passing object in request from jsp to > action > > I want pass an object from a jsp to an struts > action in request attribute. > > I have a jsp it got link to an action upon click > the action is invoked. How > can I pass object to this action using request > Attribute. > thanks & regards > > > > > __ > Do you Yahoo!? > Yahoo! Small Business - Try our new resources site! > http://smallbusiness.yahoo.com/resources/ > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > __ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: passing object in request from jsp to action
Once the JSP has been rendered, processing for that request is done. Anything placed in request attributes while the JSP was processing are gone. To pass data from the generated HTML to an action, you need to submit a form or include request parameters in a link. Another option is to store the object in session scope. Hubert On Thu, 31 Mar 2005 11:10:36 -0800 (PST), temp temp <[EMAIL PROTECTED]> wrote: > I want pass an object from a jsp to an struts action > in request attribute. > > I have a jsp it got link to an action upon click the > action is invoked. How can I pass object to this > action using request Attribute. > thanks & regards > > __ > Do you Yahoo!? > Yahoo! Small Business - Try our new resources site! > http://smallbusiness.yahoo.com/resources/ > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: passing object in request from jsp to action
... meaning in the Action you want to reference it by doing request.getParameter("someAttribute"); Is that correct? If so, on the jsp, in the link to your action, add that parameter as well. Instead of just use . Hope this helps, Dhanashree. -Original Message- From: temp temp [mailto:[EMAIL PROTECTED] Sent: Thursday, March 31, 2005 1:11 PM To: user@struts.apache.org Subject: passing object in request from jsp to action I want pass an object from a jsp to an struts action in request attribute. I have a jsp it got link to an action upon click the action is invoked. How can I pass object to this action using request Attribute. thanks & regards __ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]