I think part of the problem is that Akshay had not stated his terms completely, which prompted us to wildy throw solutions to an undefined problem at him. So with that, Akshay, what specifically do you need to do? Dynamically/Statically set a value before form submission? Where does the value come from? Server side? Client side? What software are you using (Tomcat, Ajax [which library], struts version)?
On 7/13/06, Adam Gordon <[EMAIL PROTECTED]> wrote:
I'm confused, as long as the "property" attribute of your <html:XXX> tags match the appropriate methods in the bean, you get it for free. I.e., Struts uses reflection to find the name of the setter methods on the bean and calls them when the form is submitted. Monkeyden also just mentioned another way. Just know that anyone can see your hidden fields with the right browser - Firefox has that feature built in - so they're not really secret and thus, you should probably also at least use server-side validation to keep these values from being manipulated into an invalid value by an unfriendly user. -Adam -----Original Message----- From: Akshay Ahooja [mailto:[EMAIL PROTECTED] Sent: Thursday, 13 July 2006 10:55 To: Struts Users Mailing List Subject: Re: Calling a struts action from Javascript Hmm ok that makes sense and the form submits.. The problem is I need to store some values in the Bean before/while I submit the form. Is there anyway to store the value in the bean so when teh form submits it stores the needed values. I tried using <html:form action="actionname.do?id=<%=variable%>" but it does not work out.... Thanks, Akshay On 7/13/06, Adam Gordon <[EMAIL PROTECTED]> wrote: > > I've not used any AJAX widgets, but what you say sounds logical if you > want > to submit the form at this point. > > I assume the widget is not in its own form but rather one of several/many > other widgets in the form so submitting the form submits ALL the values, > not > just the one? I guess it really doesn't matter though unless you care > about > the page refreshing. > > -Adam > > -----Original Message----- > From: Akshay Ahooja [mailto:[EMAIL PROTECTED] > Sent: Thursday, 13 July 2006 09:43 > To: Struts Users Mailing List > Subject: Re: Calling a struts action from Javascript > > I am using Dojo AJAX Inline Edit widget - and when the save button is > pressed it automatically calls an onSave JS handler ... I believe you have > to do the submit in JS in this case? > > -Akshay > > On 7/13/06, Adam Gordon <[EMAIL PROTECTED]> wrote: > > > > That really depends on what you are actually trying to do. We use J/S > to > > make XML HTTP requests (using AJAX) to make requests without having to > > reload the page. We do this to display "dialogs" in the same browser > > window, e.g., to show report details. > > > > If you want other examples, Google's Gmail uses AJAX all over the place. > > > > If you just want to submit the form, you don't even need J/S, you can > use > > <html:submit> which will render a button to submit the form (it just > needs > > to be inside the <html:form><html:form/> elements. > > > > -Adam > > > > -----Original Message----- > > From: Akshay Ahooja [mailto:[EMAIL PROTECTED] > > Sent: Thursday, 13 July 2006 08:59 > > To: Struts Users Mailing List > > Subject: Calling a struts action from Javascript > > > > Hi, > > > > Does anyone know how to call a Struts action using Javacript... > > > > I am using: > > <html:form action+"..."> > > > > ... > > > > </html:form> > > > > > > I know for regular form tags (<form>) you can use: > > document.formname.submit > > ()... > > > > How would you do it for <html:form>? I have to use this because I am > using > > the Struts Bridge in Jetspeed-2... > > > > > > Thanks, > > > > Akshay > > > > > >