RE: JSP read value from ActionForm
> Date: Thu, 4 Jul 2013 15:41:16 -0400 > From: em...@encs.concordia.ca > To: user@struts.apache.org > Subject: JSP read value from ActionForm > > Hello, > > May I know how to read a parameter value in JSP page for the following > situation please? > > (1) Struts2Action.java > ... String list_size = MG>In Java code on server sideMG>package > org.apache.struts.webapp.exercise;MG>public class TestBean extends ActionForm > {MG>ArrayList list=new > ArrayList(5);MG>list.add("First");MG>list.add("Second");MG>list.add("Third");MG>list.add("Fourth");MG>list.add("Fifth");MG>int > list_size=list.size();MG>log.debug("List size="+list_size);MG>} MG>(JSP > Client)MG><%@taglib prefix="s" uri="/struts-tags" %> <%@ taglib uri="http://struts.apache.org/tags-bean"; prefix="bean" %> OR <% java.util.ArrayList list = new java.util.ArrayList(); list.add("First"); list.add("Second"); list.add("Third"); list.add("Fourth"); list.add("Fifth"); pageContext.setAttribute("list", list, PageContext.PAGE_SCOPE);%>size is <%= list.size() %> > getter/setter for list_size > > (2) result.jsp > size = <%= list_size%> > /> > > Is there a simple way to assign Struts2Action.list_size to s:select.size > filed in the result.jsp file? > > Thanks a lot! > EL > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org >
JSP read value from ActionForm
Hello, May I know how to read a parameter value in JSP page for the following situation please? (1) Struts2Action.java ... String list_size = list.size(); ... getter/setter for list_size (2) result.jsp /> Is there a simple way to assign Struts2Action.list_size to s:select.size filed in the result.jsp file? Thanks a lot! EL - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Mapping a dynamic html form with ActionForm
Hi, no, i was thinking about plain text field with only answer text as its value. But if You want to make xml from some things on your page than You probably need to use javascript. Best greetings, Paweł Wielgus. 2010/7/2 Jawahar Nayak : > > is this "response text " the xml what I talk about my above thread. > > I need to make that xml and setting response to and hidden text field. And > that text is read in Action. > > Is this what you suggesting ? To set the xml, I need to do javascript... am > i getting correct ? > > > > > Paweł Wielgus wrote: >> >> Hi Jawahar, >> what i would do is create one html:form's with 3 different response >> presentation parts, one for every question type. >> But the submit of such a form can always go to same action and have >> one field "response". Then in action You can check if this question >> has predefined answer and if yes select it as a response or if not use >> a response text from form. >> >> Best greetings, >> Paweł Wielgus. >> >> 2010/7/1 Jawahar Nayak : >>> >>> One Solution what I am thinking... I don't know is it possible or not >>> >>> - Creating a simple html form >>> - On submitting, I will make a xml of user response i.e. Options >>> selected, >>> and not selected for examle >>> >>> >>> ... >>> >>> >>> >>> >>> >>> >>> then setting this xml string to ResponseActionForm - which have only one >>> string property. >>> >>> >>> Is it possible ? How to do that ? >>> >>> >>> -- >>> View this message in context: >>> http://old.nabble.com/Mapping-a-dynamic-html-form-with-ActionForm-tp29045058p29045132.html >>> Sent from the Struts - User mailing list archive at Nabble.com. >>> >>> >>> - >>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>> For additional commands, e-mail: user-h...@struts.apache.org >>> >>> >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> >> > > -- > View this message in context: > http://old.nabble.com/Mapping-a-dynamic-html-form-with-ActionForm-tp29045058p29054947.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Mapping a dynamic html form with ActionForm
is this "response text " the xml what I talk about my above thread. I need to make that xml and setting response to and hidden text field. And that text is read in Action. Is this what you suggesting ? To set the xml, I need to do javascript... am i getting correct ? Paweł Wielgus wrote: > > Hi Jawahar, > what i would do is create one html:form's with 3 different response > presentation parts, one for every question type. > But the submit of such a form can always go to same action and have > one field "response". Then in action You can check if this question > has predefined answer and if yes select it as a response or if not use > a response text from form. > > Best greetings, > Paweł Wielgus. > > 2010/7/1 Jawahar Nayak : >> >> One Solution what I am thinking... I don't know is it possible or not >> >> - Creating a simple html form >> - On submitting, I will make a xml of user response i.e. Options >> selected, >> and not selected for examle >> >> >> ... >> >> >> >> >> >> >> then setting this xml string to ResponseActionForm - which have only one >> string property. >> >> >> Is it possible ? How to do that ? >> >> >> -- >> View this message in context: >> http://old.nabble.com/Mapping-a-dynamic-html-form-with-ActionForm-tp29045058p29045132.html >> Sent from the Struts - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> > > ----- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > -- View this message in context: http://old.nabble.com/Mapping-a-dynamic-html-form-with-ActionForm-tp29045058p29054947.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Mapping a dynamic html form with ActionForm
Hi Jawahar, what i would do is create one html:form's with 3 different response presentation parts, one for every question type. But the submit of such a form can always go to same action and have one field "response". Then in action You can check if this question has predefined answer and if yes select it as a response or if not use a response text from form. Best greetings, Paweł Wielgus. 2010/7/1 Jawahar Nayak : > > One Solution what I am thinking... I don't know is it possible or not > > - Creating a simple html form > - On submitting, I will make a xml of user response i.e. Options selected, > and not selected for examle > > > ... > > > > > > > then setting this xml string to ResponseActionForm - which have only one > string property. > > > Is it possible ? How to do that ? > > > -- > View this message in context: > http://old.nabble.com/Mapping-a-dynamic-html-form-with-ActionForm-tp29045058p29045132.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Mapping a dynamic html form with ActionForm
One Solution what I am thinking... I don't know is it possible or not - Creating a simple html form - On submitting, I will make a xml of user response i.e. Options selected, and not selected for examle ... then setting this xml string to ResponseActionForm - which have only one string property. Is it possible ? How to do that ? -- View this message in context: http://old.nabble.com/Mapping-a-dynamic-html-form-with-ActionForm-tp29045058p29045132.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Mapping a dynamic html form with ActionForm
Hi, I am developing a application which looks like and online exam. But the format of questions are not same. Questions may be desriptive, Objective and of Multiple choice. I have a page shownextquestion.jsp. This read the next question from database to be shown to user. It checks if the question is Description, then it show a Textarea using the tag... if the question is Objective... then it show Radio buttons, according to options available in question. Some question may have 4 options and some question may have 6 option I want to use tag so that its data can be mapped to ActionForm. But the fields in ActionForm need to be defined in advance, we we want to show on html form. - I want to know, what structure should I follow to design and implement my application with such requirement. Can I make use of tag and ActionForm OR I should not use them completely. Thanks -- View this message in context: http://old.nabble.com/Mapping-a-dynamic-html-form-with-ActionForm-tp29045058p29045058.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Can a collection property have its changes saved back to the ActionForm?
Apologies all, I am editing my solution below for clarity and accuracy: - Original Message From: Andrew Sharpe To: Struts Users Mailing List Sent: Mon, March 22, 2010 8:44:42 AM Subject: Re: Can a collection property have its changes saved back to the ActionForm? Thanks Adam. I ended up using your solution. I'm not thrilled about the user seeing the listbox items get auto selected after they submit the form, but the code is certainly cleaner than adding and removing hidden controls. For the archives, here's what I went with: JSP function setStatus() { var emailSelect = document.getElementById("emailSelect"); emailSelect.multiple = true; emailSelect.focus(); // This is needed to force IE to execute the line above. for (var i = 0; i < emailSelect.length; i++) { emailSelect.options[i].selected = true; } } ACTIONFORM private String[] addresses; public String[] getAddresses() { return addresses; } public void setAddresses(String[] value) { addresses = value; } private final List oldAddresses = new ArrayList(); public List getOldAddresses() { return oldAddresses; } Thanks again, Andrew - Original Message From: adam pinder To: user@struts.apache.org Sent: Thu, March 18, 2010 6:11:27 AM Subject: RE: Can a collection property have its changes saved back to the ActionForm? you want to save the options in the select not a selected option... if you make the select a multiple select and in javascript you select all options are all the option values sent to the server against the same parameter name (turn on parameter interceptor logging to check)... if so, add a set method in your action with the same name as the select element that accepts a string array, like setNewRole(String[] newRoles) inside this method you can initialise your proper ArrayList and add the elements from the string array into it. you still need the javascript to select options but at least you're not creating new elements. i haven't checked if multiple selects sends its parameters in this way but it works when multiple checkbox elements all have the same name and are sent as name/values pair. ps. if i've misunderstood and you just want to save multiple selected options, then you can omit the javascript part which would be better. > Date: Wed, 17 Mar 2010 17:23:45 -0700 > From: andrewrwsha...@yahoo.com > Subject: Re: Can a collection property have its changes saved back to the > ActionForm? > To: user@struts.apache.org > > For the archives, the solution I'm going with is to have the javascript add > elements to the document corresponding to the new values in the select. The > names of the hidden elements will be indexed. Something like this: > > Action Form: > > public List getOldList() > > public String getSelectedValue() > > public void setNewList(int index, String value) > > JSP: > > > > > > > > > > Then the setNewList method gets called on the form with the new values from > the select box. > > If anyone has any better ideas I'm open to hearing them, but this seems to do > the trick. > > Andrew > > > > - Original Message > From: Andrew Sharpe > To: user@struts.apache.org > Sent: Mon, March 15, 2010 6:03:30 PM > Subject: Can a collection property have its changes saved back to the > ActionForm? > > Hello all, > > I have a List collection that I am displaying in an > and it is working great. The problem is that my > jsp page makes changes to that control via > javascript (adds new options, removes, etc). I would like these > changes to be saved back to the ActionForm, preferrably to the same > collection where it got its data from. > > Struts does not seem to do it by default, that is, the > tag seems to make use of the ActionForm's get > property, but not its set. If it is supposed to behave this way please > let me know and I will reexamine my syntax. Otherwise can someone tell > me the easiest way to do this? I am using Struts 1.3.8 and > unfortunately cannot upgrade to Struts 2. > > Many thanks in advance, > > Andrew > > > > __ > The new Internet Explorer® 8 - Faster, safer, easier. Optimized for Yahoo! > Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/ > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > __ &g
Re: Can a collection property have its changes saved back to the ActionForm?
Thanks Adam. I ended up using your solution. I'm not thrilled about the user seeing the listbox items get auto selected after they submit the form, but the code is certainly cleaner than adding and removing hidden controls. For the archives, here's what I went with: JSP function setStatus() { var emailSelect = document.getElementById("emailSelect"); emailSelect.multiple = true; emailSelect.focus(); // This is needed to force IE to execute the line above. for (var i = 0; i < emailSelect.length; i++) { emailSelect.options[i].selected = true; } } ACTIONFORM private String[] addresses; public String[] getAddresses() { return addresses; } public void setAddresses(String[] value) { addresses = value; } private final List oldAddresses = new ArrayList(); public List getOldAddresses() { return oldAddresses; } Thanks again, Andrew - Original Message From: adam pinder To: user@struts.apache.org Sent: Thu, March 18, 2010 6:11:27 AM Subject: RE: Can a collection property have its changes saved back to the ActionForm? you want to save the options in the select not a selected option... if you make the select a multiple select and in javascript you select all options are all the option values sent to the server against the same parameter name (turn on parameter interceptor logging to check)... if so, add a set method in your action with the same name as the select element that accepts a string array, like setNewRole(String[] newRoles) inside this method you can initialise your proper ArrayList and add the elements from the string array into it. you still need the javascript to select options but at least you're not creating new elements. i haven't checked if multiple selects sends its parameters in this way but it works when multiple checkbox elements all have the same name and are sent as name/values pair. ps. if i've misunderstood and you just want to save multiple selected options, then you can omit the javascript part which would be better. > Date: Wed, 17 Mar 2010 17:23:45 -0700 > From: andrewrwsha...@yahoo.com > Subject: Re: Can a collection property have its changes saved back to the > ActionForm? > To: user@struts.apache.org > > For the archives, the solution I'm going with is to have the javascript add > elements to the document corresponding to the new values in the select. The > names of the hidden elements will be indexed. Something like this: > > Action Form: > > public List getOldList() > > public String getSelectedValue() > > public void setNewList(int index, String value) > > JSP: > > > > > > > > > > Then the setNewList method gets called on the form with the new values from > the select box. > > If anyone has any better ideas I'm open to hearing them, but this seems to do > the trick. > > Andrew > > > > - Original Message > From: Andrew Sharpe > To: user@struts.apache.org > Sent: Mon, March 15, 2010 6:03:30 PM > Subject: Can a collection property have its changes saved back to the > ActionForm? > > Hello all, > > I have a List collection that I am displaying in an > and it is working great. The problem is that my > jsp page makes changes to that control via > javascript (adds new options, removes, etc). I would like these > changes to be saved back to the ActionForm, preferrably to the same > collection where it got its data from. > > Struts does not seem to do it by default, that is, the > tag seems to make use of the ActionForm's get > property, but not its set. If it is supposed to behave this way please > let me know and I will reexamine my syntax. Otherwise can someone tell > me the easiest way to do this? I am using Struts 1.3.8 and > unfortunately cannot upgrade to Struts 2. > > Many thanks in advance, > > Andrew > > > > __ > The new Internet Explorer® 8 - Faster, safer, easier. Optimized for Yahoo! > Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/ > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > __ > Looking for the perfect gift? Give the gift of Flickr! > > http://www.flickr.com/gift/ > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org >
RE: Can a collection property have its changes saved back to the ActionForm?
you want to save the options in the select not a selected option... if you make the select a multiple select and in javascript you select all options are all the option values sent to the server against the same parameter name (turn on parameter interceptor logging to check)... if so, add a set method in your action with the same name as the select element that accepts a string array, like setNewRole(String[] newRoles) inside this method you can initialise your proper ArrayList and add the elements from the string array into it. you still need the javascript to select options but at least you're not creating new elements. i haven't checked if multiple selects sends its parameters in this way but it works when multiple checkbox elements all have the same name and are sent as name/values pair. ps. if i've misunderstood and you just want to save multiple selected options, then you can omit the javascript part which would be better. > Date: Wed, 17 Mar 2010 17:23:45 -0700 > From: andrewrwsha...@yahoo.com > Subject: Re: Can a collection property have its changes saved back to the > ActionForm? > To: user@struts.apache.org > > For the archives, the solution I'm going with is to have the javascript add > elements to the document corresponding to the new values in the select. The > names of the hidden elements will be indexed. Something like this: > > Action Form: > > public List getOldList() > > public String getSelectedValue() > > public void setNewList(int index, String value) > > JSP: > > > > > > > > > > Then the setNewList method gets called on the form with the new values from > the select box. > > If anyone has any better ideas I'm open to hearing them, but this seems to do > the trick. > > Andrew > > > > - Original Message > From: Andrew Sharpe > To: user@struts.apache.org > Sent: Mon, March 15, 2010 6:03:30 PM > Subject: Can a collection property have its changes saved back to the > ActionForm? > > Hello all, > > I have a List collection that I am displaying in an > and it is working great. The problem is that my > jsp page makes changes to that control via > javascript (adds new options, removes, etc). I would like these > changes to be saved back to the ActionForm, preferrably to the same > collection where it got its data from. > > Struts does not seem to do it by default, that is, the > tag seems to make use of the ActionForm's get > property, but not its set. If it is supposed to behave this way please > let me know and I will reexamine my syntax. Otherwise can someone tell > me the easiest way to do this? I am using Struts 1.3.8 and > unfortunately cannot upgrade to Struts 2. > > Many thanks in advance, > > Andrew > > > > __ > The new Internet Explorer® 8 - Faster, safer, easier. Optimized for Yahoo! > Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/ > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > __ > Looking for the perfect gift? Give the gift of Flickr! > > http://www.flickr.com/gift/ > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > _ Got a cool Hotmail story? Tell us now http://clk.atdmt.com/UKM/go/195013117/direct/01/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Can a collection property have its changes saved back to the ActionForm?
For the archives, the solution I'm going with is to have the javascript add elements to the document corresponding to the new values in the select. The names of the hidden elements will be indexed. Something like this: Action Form: public List getOldList() public String getSelectedValue() public void setNewList(int index, String value) JSP: function saveSelect() { var selectControl = document.getElementById('myId); for (var i = 0; i < select.length; i++) { var hid = document.createElement("input"); hid.type = "hidden"; hid.name = "newList[" + i + "]"; hid.value = selectControl.options[i].value; document.forms[0].appendChild(hid); } } Then the setNewList method gets called on the form with the new values from the select box. If anyone has any better ideas I'm open to hearing them, but this seems to do the trick. Andrew - Original Message From: Andrew Sharpe To: user@struts.apache.org Sent: Mon, March 15, 2010 6:03:30 PM Subject: Can a collection property have its changes saved back to the ActionForm? Hello all, I have a List collection that I am displaying in an and it is working great. The problem is that my jsp page makes changes to that control via javascript (adds new options, removes, etc). I would like these changes to be saved back to the ActionForm, preferrably to the same collection where it got its data from. Struts does not seem to do it by default, that is, the tag seems to make use of the ActionForm's get property, but not its set. If it is supposed to behave this way please let me know and I will reexamine my syntax. Otherwise can someone tell me the easiest way to do this? I am using Struts 1.3.8 and unfortunately cannot upgrade to Struts 2. Many thanks in advance, Andrew __ The new Internet Explorer® 8 - Faster, safer, easier. Optimized for Yahoo! Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org __ Looking for the perfect gift? Give the gift of Flickr! http://www.flickr.com/gift/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Can a collection property have its changes saved back to the ActionForm?
Hello all, I have a List collection that I am displaying in an and it is working great. The problem is that my jsp page makes changes to that control via javascript (adds new options, removes, etc). I would like these changes to be saved back to the ActionForm, preferrably to the same collection where it got its data from. Struts does not seem to do it by default, that is, the tag seems to make use of the ActionForm's get property, but not its set. If it is supposed to behave this way please let me know and I will reexamine my syntax. Otherwise can someone tell me the easiest way to do this? I am using Struts 1.3.8 and unfortunately cannot upgrade to Struts 2. Many thanks in advance, Andrew __ The new Internet Explorer® 8 - Faster, safer, easier. Optimized for Yahoo! Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Losing ActionForm Data on submit
So, I have an issue where when I submit a form, instead of the corresponding ActionForm being populated with the correct field data, it remains unpopulated for a reason unknown to me. Here is the form on my JSP page(js functions provided for clarity, very simple): function encryptSSN(){ document.ssnLookupForm.submit(); } function showError(){ document.getElementById('error').style.display='block'; document.getElementById('box1').style.display='none'; } function validateSSN(){ var ssn = document.ssnLookupForm.ssn.value; if( /^\d{3}-\d{2}-\d{4}$/.test(ssn) == false ){ showError(); }else{ encryptSSN(); } } SSN: Format: XXX-XX- Encrypted Value: <%=ssnLookupForm.getEncryptedSSN()%> ------ This is the corresponding ActionForm: public class SSNLookupForm extends ActionForm{ private static Logger log = Logger.getLogger(SSNLookupForm.class.getName()); private String ssn = "XXX-XX-"; private String encryptedSSN = "[Encrypted Value]"; public String getSSN(){ return ssn; } public void setSSN(String ssn){ this.ssn = ssn; } public String getEncryptedSSN(){ return encryptedSSN; } public void setEncryptedSSN(String encryptedSSN){ this.encryptedSSN = encryptedSSN; } public void reset(ActionMapping mapping, HttpServletRequest request) { this.ssn = "XXX-XX-"; this.encryptedSSN= "[Encrypted Value]"; } } --- What should happen is that the user enters the SSN in xxx-xx- format into the box, and clicks the Encrypt button(the javascript validation works fine, I've tested it). Then, the form should get populated with the data so that the Action class can do the background work, and display the page with the SSN that was input and the value that was created from the encryption. I can't figure out why the data isn't being submitted. I tried using the Struts library tags like and and whatnot, but for some reason the elements wouldn't display on the page when I would use them, so I just reverted to the regular HTML counterparts. The problem is with the form being populated with the data, because I hard coded in a value for the SSN in my action class and the encryption happened perfectly fine and the page showed up as it should have, but I can't get user input data to make it to the form, and I'm totally at a loss. Any help would be greatly appreciated. Keep in mind this is the first time I've ever had to use anything like Struts. -- View this message in context: http://old.nabble.com/Losing-ActionForm-Data-on-submit-tp26627694p26627694.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: ActionForm is been called once only
Hi again, just to clarify, i'm talking about reset method inside any form that is a subclass of this one below: http://struts.apache.org/1.x/apidocs/org/apache/struts/action/ActionForm.html#reset(org.apache.struts.action.ActionMapping, javax.servlet.http.HttpServletRequest) and on every request to action this reset method is being called (for reseting checkboxes - most common scenario). I'm not familiar with any conditions like new session or anything else that would prevent this behaviour, but i'm not a struts1 guru so maybe i'm simply wrong. As for setting session param, it states that this form will be used across one session, it only means that this form will be creted when user/session makes first call and then used in all other actions where it is defined - good for wizard like scenarion, nothing less nothing more, still reset method in form object will be called on every request. Best greetings, Paweł Wielgus. 2009/8/29 sharadsingh : > > thanks Pawel for the help.. in the previous mail you told me about > configuring. So i was just going through my struts-config file where i saw > that i didnt specified the scope in the action mapping. Then i realized that > reset is called whenever there is a new session, which means by default the > scope was set to session, so i applied the attribute scope with "request" > and it started working fine as it works for you :) > > Paweł Wielgus wrote: >> >> Hi, >> i was thinking about redirect scenario where You load some page >> through a redirect so there are two actions involved, >> and after redirect only one action is called. But that's just a wild >> guesing, so please send struts-config.xml and the action that You are >> reffering and form, so maybe i or someone else will see something that >> is not wright. Normally it should work as You expect, because this is >> normal/standard struts behaviour. >> >> Best greetings, >> Paweł Wielgus. >> >> >> 2009/8/29 sharadsingh : >>> >>> well all the points you said is ok for me the only thing i dont know >>> about is >>> the configuration. What kind of configuration you are talking about? >>> Actually i am quite new to struts and so may be i dont know about some >>> in-depth concepts. >>> >>> >>> Paweł Wielgus wrote: >>>> >>>> Hi, >>>> if it's not browser fault, >>>> then maybe configuration, >>>> are You dealing with redirect in this case? >>>> Or maybe You have some king of logic inside form's reset method. >>>> One another thing is action beeing defined twice with two different >>>> forms? >>>> >>>> Other than that i don't know, >>>> reset works always for me. >>>> >>>> Best greeitings, >>>> Paweł Wielgus. >>>> >>>> 2009/8/28 sharadsingh : >>>>> >>>>> well i applied break points on both "actionform" and "action" of the >>>>> form >>>>> and >>>>> did both refresh and brand new request. It is been caught in both the >>>>> times >>>>> with the break point in the action but not in the actionform >>>>> >>>>> Paweł Wielgus wrote: >>>>>> >>>>>> Hi, >>>>>> what do You mean by saying: >>>>>> "if i try to open the page again" >>>>>> what does that mean for real? >>>>>> hitting F5 or refresh button in browser? >>>>>> or a real brand new request. >>>>>> >>>>>> Best greetings, >>>>>> Paweł Wielgus. >>>>>> >>>>>> >>>>>> 2009/8/28 sharadsingh : >>>>>>> >>>>>>> i have an action form which i use to collect form data and also to >>>>>>> set >>>>>>> them >>>>>>> back by populating the variables in the reset method. But the problem >>>>>>> is >>>>>>> that the reset method is been called only the first time i am opening >>>>>>> the >>>>>>> page which contains that form, if i try to open the page again the >>>>>>> reset >>>>>>> method wont be called at all. Please suggest me on this.., >>>>>>> -- >>>>>>> View this message in context: >>>>>>> http://www.nabble.com/ActionForm-is-been-called-once-only-tp25186640p25
Re: ActionForm is been called once only
thanks Pawel for the help.. in the previous mail you told me about configuring. So i was just going through my struts-config file where i saw that i didnt specified the scope in the action mapping. Then i realized that reset is called whenever there is a new session, which means by default the scope was set to session, so i applied the attribute scope with "request" and it started working fine as it works for you :) Paweł Wielgus wrote: > > Hi, > i was thinking about redirect scenario where You load some page > through a redirect so there are two actions involved, > and after redirect only one action is called. But that's just a wild > guesing, so please send struts-config.xml and the action that You are > reffering and form, so maybe i or someone else will see something that > is not wright. Normally it should work as You expect, because this is > normal/standard struts behaviour. > > Best greetings, > Paweł Wielgus. > > > 2009/8/29 sharadsingh : >> >> well all the points you said is ok for me the only thing i dont know >> about is >> the configuration. What kind of configuration you are talking about? >> Actually i am quite new to struts and so may be i dont know about some >> in-depth concepts. >> >> >> Paweł Wielgus wrote: >>> >>> Hi, >>> if it's not browser fault, >>> then maybe configuration, >>> are You dealing with redirect in this case? >>> Or maybe You have some king of logic inside form's reset method. >>> One another thing is action beeing defined twice with two different >>> forms? >>> >>> Other than that i don't know, >>> reset works always for me. >>> >>> Best greeitings, >>> Paweł Wielgus. >>> >>> 2009/8/28 sharadsingh : >>>> >>>> well i applied break points on both "actionform" and "action" of the >>>> form >>>> and >>>> did both refresh and brand new request. It is been caught in both the >>>> times >>>> with the break point in the action but not in the actionform >>>> >>>> Paweł Wielgus wrote: >>>>> >>>>> Hi, >>>>> what do You mean by saying: >>>>> "if i try to open the page again" >>>>> what does that mean for real? >>>>> hitting F5 or refresh button in browser? >>>>> or a real brand new request. >>>>> >>>>> Best greetings, >>>>> Paweł Wielgus. >>>>> >>>>> >>>>> 2009/8/28 sharadsingh : >>>>>> >>>>>> i have an action form which i use to collect form data and also to >>>>>> set >>>>>> them >>>>>> back by populating the variables in the reset method. But the problem >>>>>> is >>>>>> that the reset method is been called only the first time i am opening >>>>>> the >>>>>> page which contains that form, if i try to open the page again the >>>>>> reset >>>>>> method wont be called at all. Please suggest me on this.., >>>>>> -- >>>>>> View this message in context: >>>>>> http://www.nabble.com/ActionForm-is-been-called-once-only-tp25186640p25186640.html >>>>>> Sent from the Struts - User mailing list archive at Nabble.com. >>>>>> >>>>>> >>>>>> - >>>>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>>>>> For additional commands, e-mail: user-h...@struts.apache.org >>>>>> >>>>>> >>>>> >>>>> - >>>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>>>> For additional commands, e-mail: user-h...@struts.apache.org >>>>> >>>>> >>>>> >>>> >>>> -- >>>> View this message in context: >>>> http://www.nabble.com/ActionForm-is-been-called-once-only-tp25186640p25187345.html >>>> Sent from the Struts - User mailing list archive at Nabble.com. >>>> >>>> >>>> - >>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>>> For additional commands, e-mail: user-h...@struts.apache.org >>>> >>>> >>> >>> - >>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>> For additional commands, e-mail: user-h...@struts.apache.org >>> >>> >>> >> >> -- >> View this message in context: >> http://www.nabble.com/ActionForm-is-been-called-once-only-tp25186640p25200449.html >> Sent from the Struts - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > -- View this message in context: http://www.nabble.com/ActionForm-is-been-called-once-only-tp25186640p25202296.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: ActionForm is been called once only
Hi, i was thinking about redirect scenario where You load some page through a redirect so there are two actions involved, and after redirect only one action is called. But that's just a wild guesing, so please send struts-config.xml and the action that You are reffering and form, so maybe i or someone else will see something that is not wright. Normally it should work as You expect, because this is normal/standard struts behaviour. Best greetings, Paweł Wielgus. 2009/8/29 sharadsingh : > > well all the points you said is ok for me the only thing i dont know about is > the configuration. What kind of configuration you are talking about? > Actually i am quite new to struts and so may be i dont know about some > in-depth concepts. > > > Paweł Wielgus wrote: >> >> Hi, >> if it's not browser fault, >> then maybe configuration, >> are You dealing with redirect in this case? >> Or maybe You have some king of logic inside form's reset method. >> One another thing is action beeing defined twice with two different forms? >> >> Other than that i don't know, >> reset works always for me. >> >> Best greeitings, >> Paweł Wielgus. >> >> 2009/8/28 sharadsingh : >>> >>> well i applied break points on both "actionform" and "action" of the form >>> and >>> did both refresh and brand new request. It is been caught in both the >>> times >>> with the break point in the action but not in the actionform >>> >>> Paweł Wielgus wrote: >>>> >>>> Hi, >>>> what do You mean by saying: >>>> "if i try to open the page again" >>>> what does that mean for real? >>>> hitting F5 or refresh button in browser? >>>> or a real brand new request. >>>> >>>> Best greetings, >>>> Paweł Wielgus. >>>> >>>> >>>> 2009/8/28 sharadsingh : >>>>> >>>>> i have an action form which i use to collect form data and also to set >>>>> them >>>>> back by populating the variables in the reset method. But the problem >>>>> is >>>>> that the reset method is been called only the first time i am opening >>>>> the >>>>> page which contains that form, if i try to open the page again the >>>>> reset >>>>> method wont be called at all. Please suggest me on this.., >>>>> -- >>>>> View this message in context: >>>>> http://www.nabble.com/ActionForm-is-been-called-once-only-tp25186640p25186640.html >>>>> Sent from the Struts - User mailing list archive at Nabble.com. >>>>> >>>>> >>>>> - >>>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>>>> For additional commands, e-mail: user-h...@struts.apache.org >>>>> >>>>> >>>> >>>> - >>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>>> For additional commands, e-mail: user-h...@struts.apache.org >>>> >>>> >>>> >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/ActionForm-is-been-called-once-only-tp25186640p25187345.html >>> Sent from the Struts - User mailing list archive at Nabble.com. >>> >>> >>> - >>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>> For additional commands, e-mail: user-h...@struts.apache.org >>> >>> >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> >> > > -- > View this message in context: > http://www.nabble.com/ActionForm-is-been-called-once-only-tp25186640p25200449.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: ActionForm is been called once only
well all the points you said is ok for me the only thing i dont know about is the configuration. What kind of configuration you are talking about? Actually i am quite new to struts and so may be i dont know about some in-depth concepts. Paweł Wielgus wrote: > > Hi, > if it's not browser fault, > then maybe configuration, > are You dealing with redirect in this case? > Or maybe You have some king of logic inside form's reset method. > One another thing is action beeing defined twice with two different forms? > > Other than that i don't know, > reset works always for me. > > Best greeitings, > Paweł Wielgus. > > 2009/8/28 sharadsingh : >> >> well i applied break points on both "actionform" and "action" of the form >> and >> did both refresh and brand new request. It is been caught in both the >> times >> with the break point in the action but not in the actionform >> >> Paweł Wielgus wrote: >>> >>> Hi, >>> what do You mean by saying: >>> "if i try to open the page again" >>> what does that mean for real? >>> hitting F5 or refresh button in browser? >>> or a real brand new request. >>> >>> Best greetings, >>> Paweł Wielgus. >>> >>> >>> 2009/8/28 sharadsingh : >>>> >>>> i have an action form which i use to collect form data and also to set >>>> them >>>> back by populating the variables in the reset method. But the problem >>>> is >>>> that the reset method is been called only the first time i am opening >>>> the >>>> page which contains that form, if i try to open the page again the >>>> reset >>>> method wont be called at all. Please suggest me on this.., >>>> -- >>>> View this message in context: >>>> http://www.nabble.com/ActionForm-is-been-called-once-only-tp25186640p25186640.html >>>> Sent from the Struts - User mailing list archive at Nabble.com. >>>> >>>> >>>> ----- >>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>>> For additional commands, e-mail: user-h...@struts.apache.org >>>> >>>> >>> >>> - >>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>> For additional commands, e-mail: user-h...@struts.apache.org >>> >>> >>> >> >> -- >> View this message in context: >> http://www.nabble.com/ActionForm-is-been-called-once-only-tp25186640p25187345.html >> Sent from the Struts - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > -- View this message in context: http://www.nabble.com/ActionForm-is-been-called-once-only-tp25186640p25200449.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: ActionForm is been called once only
In the time between the first time you go to the page and the second time where in your application is the data supposed to be? Chris -Original Message- From: Paweł Wielgus To: Struts Users Mailing List Sent: Fri, Aug 28, 2009 5:34 am Subject: Re: ActionForm is been called once only Hi, what do You mean by saying: "if i try to open the page again" what does that mean for real? hitting F5 or refresh button in browser? or a real brand new request. Best greetings, Paweł Wielgus. 2009/8/28 sharadsingh : > > i have an action form which i use to collect form data and also to set them > back by populating the variables in the reset method. But the problem is > that the reset method is been called only the first time i am opening the > page which contains that form, if i try to open the page again the reset > method wont be called at all. Please suggest me on this.., > -- > View this message in context: > http://www.nabble.com/ActionForm-is-been-called-once-only-tp25186640p25186640.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-help @struts.apache.org
Re: ActionForm is been called once only
Hi, if it's not browser fault, then maybe configuration, are You dealing with redirect in this case? Or maybe You have some king of logic inside form's reset method. One another thing is action beeing defined twice with two different forms? Other than that i don't know, reset works always for me. Best greeitings, Paweł Wielgus. 2009/8/28 sharadsingh : > > well i applied break points on both "actionform" and "action" of the form and > did both refresh and brand new request. It is been caught in both the times > with the break point in the action but not in the actionform > > Paweł Wielgus wrote: >> >> Hi, >> what do You mean by saying: >> "if i try to open the page again" >> what does that mean for real? >> hitting F5 or refresh button in browser? >> or a real brand new request. >> >> Best greetings, >> Paweł Wielgus. >> >> >> 2009/8/28 sharadsingh : >>> >>> i have an action form which i use to collect form data and also to set >>> them >>> back by populating the variables in the reset method. But the problem is >>> that the reset method is been called only the first time i am opening the >>> page which contains that form, if i try to open the page again the reset >>> method wont be called at all. Please suggest me on this.., >>> -- >>> View this message in context: >>> http://www.nabble.com/ActionForm-is-been-called-once-only-tp25186640p25186640.html >>> Sent from the Struts - User mailing list archive at Nabble.com. >>> >>> >>> - >>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>> For additional commands, e-mail: user-h...@struts.apache.org >>> >>> >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> >> > > -- > View this message in context: > http://www.nabble.com/ActionForm-is-been-called-once-only-tp25186640p25187345.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: ActionForm is been called once only
well i applied break points on both "actionform" and "action" of the form and did both refresh and brand new request. It is been caught in both the times with the break point in the action but not in the actionform Paweł Wielgus wrote: > > Hi, > what do You mean by saying: > "if i try to open the page again" > what does that mean for real? > hitting F5 or refresh button in browser? > or a real brand new request. > > Best greetings, > Paweł Wielgus. > > > 2009/8/28 sharadsingh : >> >> i have an action form which i use to collect form data and also to set >> them >> back by populating the variables in the reset method. But the problem is >> that the reset method is been called only the first time i am opening the >> page which contains that form, if i try to open the page again the reset >> method wont be called at all. Please suggest me on this.., >> -- >> View this message in context: >> http://www.nabble.com/ActionForm-is-been-called-once-only-tp25186640p25186640.html >> Sent from the Struts - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > -- View this message in context: http://www.nabble.com/ActionForm-is-been-called-once-only-tp25186640p25187345.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: ActionForm is been called once only
Hi, what do You mean by saying: "if i try to open the page again" what does that mean for real? hitting F5 or refresh button in browser? or a real brand new request. Best greetings, Paweł Wielgus. 2009/8/28 sharadsingh : > > i have an action form which i use to collect form data and also to set them > back by populating the variables in the reset method. But the problem is > that the reset method is been called only the first time i am opening the > page which contains that form, if i try to open the page again the reset > method wont be called at all. Please suggest me on this.., > -- > View this message in context: > http://www.nabble.com/ActionForm-is-been-called-once-only-tp25186640p25186640.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
ActionForm is been called once only
i have an action form which i use to collect form data and also to set them back by populating the variables in the reset method. But the problem is that the reset method is been called only the first time i am opening the page which contains that form, if i try to open the page again the reset method wont be called at all. Please suggest me on this.., -- View this message in context: http://www.nabble.com/ActionForm-is-been-called-once-only-tp25186640p25186640.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Access ActionForm methods/varaibles in JSP
I suggest that you not embed Java code in JSPs in scriptlets like this. It's better to use Struts tags instead. Are you looking at using Struts 1 or Struts 2? Struts1 for now. Do you have a simple code. I am not sure I quite understand how you propose to use java code in JSP? Thanks, -- Lu Ying On Thu, Mar 5, 2009 at 3:22 PM, Emi Lu wrote: Good morning, In JSP file, may I know how to get action bean please? <% if(f1.getCode().equals('abc')) { %> ... ... <% } %> In JSP, I'd like to know how to call "methods, fields" in action form bean? Thanks a lot! -- Lu Ying - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Access ActionForm methods/varaibles in JSP
I suggest that you not embed Java code in JSPs in scriptlets like this. It's better to use Struts tags instead. Are you looking at using Struts 1 or Struts 2? jk On Thu, Mar 5, 2009 at 3:22 PM, Emi Lu wrote: > Good morning, > > In JSP file, may I know how to get action bean please? > > > <% > if(f1.getCode().equals('abc')) > { > > %> > ... ... > <% > } > %> > > > > > In JSP, I'd like to know how to call "methods, fields" in action form bean? > > Thanks a lot! > -- > Lu Ying > > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Access ActionForm methods/varaibles in JSP
Good morning, In JSP file, may I know how to get action bean please? <% if(f1.getCode().equals('abc')) { %> ... ... <% } %> In JSP, I'd like to know how to call "methods, fields" in action form bean? Thanks a lot! -- Lu Ying - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
[SOLVED] Re: DynaValidatorForm arrives as null (that of passed by ActionForm) in execute
Problem solved: I was using a wrong type in form-properties: java.lang._b_oolean sledge wrote: > > Struts 1.1; There's something I think I am doing not right.. Here is the > code: > > action .java: > public class EditColActionInit extends Action { > public ActionForward execute(ActionMapping mapping, ActionForm form, > HttpServletRequest request, HttpServletResponse > response) > throws Exception { > > // form arrives as null > DynaValidatorForm myForm = (DynaValidatorForm) form; > } > > struts-config: > type="org.apache.struts.validator.DynaValidatorForm"> > > > ... > type="webfabis.newRunVer2.controller.EditColActionInit" >name="newRunVer2EditColForm" >scope="request" >validate="true" >input="/NewRunVer2/editCol.jsp"> > >path="/mainMenu.jsp"/> >path="/NewRunVer2/editCol.jsp"/> > > ... > > > value="/webfabis/defaultroot/WEB-INF/validator-rules.xml, > /WEB-INF/validation.xml"/> > > > ... > validation.xml: > > > > > > > > ... > editCol.jsp: > > <%@ page contentType="text/html;charset=UTF-8" language="java" %> > <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> > <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> > <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> > > > > EditCol Program > href="/style/style.css" /> > > > style="background:white;" onsubmit="return > validateNewRunVer2EditColForm(this)"> > > > Label: > >property="label"/> > > >value="Update"/> > > > > > > > > pls help.! > > -- > sledge > -- View this message in context: http://www.nabble.com/DynaValidatorForm-arrives-as-null-%28that-of-passed-by-ActionForm%29-in-execute-tp22159345p22179785.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
DynaValidatorForm arrives as null (that of passed by ActionForm) in execute
Struts 1.1; There's something I think I am doing not right.. Here is the code: action .java: public class EditColActionInit extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // form arrives as null DynaValidatorForm myForm = (DynaValidatorForm) form; } struts-config: ... ... ... validation.xml: ... editCol.jsp: <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> EditCol Program Label: pls help.! -- sledge -- View this message in context: http://www.nabble.com/DynaValidatorForm-arrives-as-null-%28that-of-passed-by-ActionForm%29-in-execute-tp22159345p22159345.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
DynaValidatorForm is null (from ActionForm in execute)
Here is the code: action .java: public class EditColActionInit extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // form arrives as null DynaValidatorForm myForm = (DynaValidatorForm) form; } struts-config: ... ... ... validation.xml: pls help.! -- sledge -- View this message in context: http://www.nabble.com/DynaValidatorForm-is-null-%28from-ActionForm-in-execute%29-tp22120932p22120932.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Action and ActionForm newbie questions
Hi Dave, I am sorry if this question goes out of the range. Thanks for your answer !!! J. -- View this message in context: http://www.nabble.com/Action-and-ActionForm-newbie-questions-tp19692405p19721298.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action and ActionForm newbie questions
--- On Fri, 9/26/08, UseTheFork <[EMAIL PROTECTED]> wrote: > What is the proper way? There is no single "proper way". It depends on your environment, your application, and so on. In general your actions should be wrappers around calls to services, no matter how they're implemented. These questions are running pretty far afield of Struts. > iii) Dave, I don't understand your comment, can you > elaborate? What am I missing about Struts 2? Struts 2 doesn't use ActionForms. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action and ActionForm newbie questions
Hi Laurie and Dave, I am reading contradictory information from different sources on the Internet and I am getting confused. i) Assuming that I am writing a JSP page to register a new user using a form: I should implement an ActionForm to retrieve the data entered by the user, correct? I should also implement an Action to manage such registration, correct? ii) I can use Hibernate to have a new user created and saved automatically in the database. Where I am not clear is whether I should directly invoke my user bean in the Action and let Hibernate handle persistence or whether I should implement an EBJ and have the Action delegate the job? Some sources indicate that I should implement EBJ to perform such tasks. What is the proper way? iii) Dave, I don't understand your comment, can you elaborate? What am I missing about Struts 2? Thanks, J. -- View this message in context: http://www.nabble.com/Action-and-ActionForm-newbie-questions-tp19692405p19696185.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action and ActionForm newbie questions
I thought you were learning Struts 2. Dave --- On Fri, 9/26/08, UseTheFork wrote: > I am learning about Struts and I am trying to understand > the proper usage of > Actions and ActionForms. Can you tell me if the following > is correct? > > i) Actions are implemented as glue between the View (JSP > for example) and > the Model part (Hibernate for example) in MVC. Typically, > they should not > implement business logic, but call EJBs instead. > > ii) When the struts controller calls execute(...) on the > Action class, an > ActionForm class may be passed as a parameter (if such has > been implemented > and if struts has been configured properly). > > iii) An ActionForm contains the data entered by the user on > a HTML (or JSP > page) form. Some data validation can be performed. > > iv) Once the Action has finished its job, it returns the > next page to > display via an ActionForward object. > > Thanks, > > J. > -- > View this message in context: > http://www.nabble.com/Action-and-ActionForm-newbie-questions-tp19692405p19692405.html > Sent from the Struts - User mailing list archive at > Nabble.com. > > > - > 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: Action and ActionForm newbie questions
UseTheFork wrote: Hi, I am learning about Struts and I am trying to understand the proper usage of Actions and ActionForms. Can you tell me if the following is correct? i) Actions are implemented as glue between the View (JSP for example) and the Model part (Hibernate for example) in MVC. Typically, they should not implement business logic, but call EJBs instead. Call EJBs?? An ActionForm is the data transfer object between the action and the view template (JSP usually). Business logic belongs in the action, or a service API the action interacts with. Talking to EJBs is firmly in the business logic domain and unrelated to ActionForms. ii) When the struts controller calls execute(...) on the Action class, an ActionForm class may be passed as a parameter (if such has been implemented and if struts has been configured properly). iii) An ActionForm contains the data entered by the user on a HTML (or JSP page) form. Some data validation can be performed. iv) Once the Action has finished its job, it returns the next page to display via an ActionForward object. Yes. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Action and ActionForm newbie questions
Hi, I am learning about Struts and I am trying to understand the proper usage of Actions and ActionForms. Can you tell me if the following is correct? i) Actions are implemented as glue between the View (JSP for example) and the Model part (Hibernate for example) in MVC. Typically, they should not implement business logic, but call EJBs instead. ii) When the struts controller calls execute(...) on the Action class, an ActionForm class may be passed as a parameter (if such has been implemented and if struts has been configured properly). iii) An ActionForm contains the data entered by the user on a HTML (or JSP page) form. Some data validation can be performed. iv) Once the Action has finished its job, it returns the next page to display via an ActionForward object. Thanks, J. -- View this message in context: http://www.nabble.com/Action-and-ActionForm-newbie-questions-tp19692405p19692405.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Generate a ActionForm for a dynamically generated list of Properties
Hello all, I have to create a JSP which gets a list of questions from the database with the possible answers. The number of questions may vary from time to time. The questions might request the user to select 1 answer or some times it can be more than 1 selection. My problem is, how to capture these selected answers for each question when the user hits the submit button. The normal scenario for html:form is to have the properties hardcoded with names which are there in the ActionForm corresponding to that Action. But the problem here is, I can't specify the properties for the ActionForm cause the properties change. I hope the problem is clear for you and anticipating a response. Thanks and regards -- Ransika De Silva SCMAD 1.0, SCJP 1.4, BSc.(Hons) Information Systems
RE: Problem from defining JavaBean as an attribute inside ActionForm
Its working now. Thank you very much for the replies. The problem was that the naming convention (it was like sStreet, sCity and the getter/setters were getStreet, getCity etc.)of my attributes and I did not initialize the inside bean in the ActionForm. Thanks & Regards, Chandra. > To: user@struts.apache.org> From: [EMAIL PROTECTED]> Subject: Re: Problem > from defining JavaBean as an attribute inside ActionForm> Date: Thu, 3 Jul > 2008 14:56:09 -0400> > Oh, and another thought: are you initializing > ActionForm's empAddress > field somewhere? It may cause problems if it is > null when Struts tries > to set its properties. Struts 2 can automatically > create instances of > beans in that situation, but Struts 1 doesn't.> > L.> > > Laurie Harper wrote:> > What you have below all looks fine; it should work as > you expected. What > > does your form bean definition look like? Is the form > bean correctly > > referenced by the action mapping the form is submitted to? > Post the > > relevant bits of configuration and the full stack trace; maybe > that will > > allow someone to see the problem.> > > > L.> > > > Chandramouli > P wrote:> >> Hi,> >> > >> I have the below scenario:> >> > >> I have a java > bean as below:> >> > >> public class Address> >> {> >> private String city;> > >> private String state;> >> > >> and public getters/setters for the above > attributes;> >> }> >> > >> and I have the ActionForm as below:> >> > >> > import Address;> >> public class EmpForm extends ActionForm> >> {> >> private > String name;> >> private String empID;> >> private Address empAddress;> >> > > >> and public getters/setters for the aboev attribute;> >> }> >> > >> We are > using Struts 1.2.9 and writing the JSP page as below:> >> > >> action="/sampleAction.do">> >> > >> property="empID"/>> >> > >> property="empAddress.state"/>> >> > >> > >> I am getting the > below error while submitting the form:> >> > >> E SRVE0026E: [Servlet > Error]-[BeanUtils.populate]: > >> java.lang.IllegalArgumentException: No bean > specified at > >> > org.apache.commons.beanutils.PropertyUtils..getPropertyDescriptor(PropertyUtils.java(Compiled > > >> Code))> >> I have read somewhere that Struts version I am using does > support the > >> nested attributes for the and other tags. Are > there any > >> errors in the above code? Please help.> >> > >> Thanks & > Regards,> >> Chandra.> >> > _> >> Post > free property ads on Yello Classifieds now! www.yello.in> >> > http://ss1.richmedia.in/recurl.asp?pid=221> > > > -> To > unsubscribe, e-mail: [EMAIL PROTECTED]> For additional commands, e-mail: > [EMAIL PROTECTED]> _ Missed your favourite programme? Stop surfing TV channels and start planning your weekend TV viewing with our comprehensive TV Listing http://entertainment.in.msn.com/TV/TVListing.aspx
Re: Problem from defining JavaBean as an attribute inside ActionForm
> From day one, as far as I know. What? 4 years of blindness? What a mess, I have to go back to basis, bheee. :P Kind regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem from defining JavaBean as an attribute inside ActionForm
Lukasz Lenart wrote: For the record, Struts 1 definitely supports dot-notation access to sub-fields. That's not the problem here. Upsss... ;-) Could you clarify my doubts, from which version? From day one, as far as I know. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem from defining JavaBean as an attribute inside ActionForm
> For the record, Struts 1 definitely supports dot-notation access to > sub-fields. That's not the problem here. Upsss... ;-) Could you clarify my doubts, from which version? Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem from defining JavaBean as an attribute inside ActionForm
Oh, and another thought: are you initializing ActionForm's empAddress field somewhere? It may cause problems if it is null when Struts tries to set its properties. Struts 2 can automatically create instances of beans in that situation, but Struts 1 doesn't. L. Laurie Harper wrote: What you have below all looks fine; it should work as you expected. What does your form bean definition look like? Is the form bean correctly referenced by the action mapping the form is submitted to? Post the relevant bits of configuration and the full stack trace; maybe that will allow someone to see the problem. L. Chandramouli P wrote: Hi, I have the below scenario: I have a java bean as below: public class Address { private String city; private String state; and public getters/setters for the above attributes; } and I have the ActionForm as below: import Address; public class EmpForm extends ActionForm { private String name; private String empID; private Address empAddress; and public getters/setters for the aboev attribute; } We are using Struts 1.2.9 and writing the JSP page as below: I am getting the below error while submitting the form: E SRVE0026E: [Servlet Error]-[BeanUtils.populate]: java.lang.IllegalArgumentException: No bean specified at org.apache.commons.beanutils.PropertyUtils..getPropertyDescriptor(PropertyUtils.java(Compiled Code)) I have read somewhere that Struts version I am using does support the nested attributes for the and other tags. Are there any errors in the above code? Please help. Thanks & Regards, Chandra. _ Post free property ads on Yello Classifieds now! www.yello.in http://ss1.richmedia.in/recurl.asp?pid=221 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem from defining JavaBean as an attribute inside ActionForm
Lukasz Lenart wrote: We are using Struts 1.2.9 and writing the JSP page as below: As I remember, Struts 1 don't support such evaluation, you can use For the record, Struts 1 definitely supports dot-notation access to sub-fields. That's not the problem here. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem from defining JavaBean as an attribute inside ActionForm
What you have below all looks fine; it should work as you expected. What does your form bean definition look like? Is the form bean correctly referenced by the action mapping the form is submitted to? Post the relevant bits of configuration and the full stack trace; maybe that will allow someone to see the problem. L. Chandramouli P wrote: Hi, I have the below scenario: I have a java bean as below: public class Address { private String city; private String state; and public getters/setters for the above attributes; } and I have the ActionForm as below: import Address; public class EmpForm extends ActionForm { private String name; private String empID; private Address empAddress; and public getters/setters for the aboev attribute; } We are using Struts 1.2.9 and writing the JSP page as below: I am getting the below error while submitting the form: E SRVE0026E: [Servlet Error]-[BeanUtils.populate]: java.lang.IllegalArgumentException: No bean specified at org.apache.commons.beanutils.PropertyUtils..getPropertyDescriptor(PropertyUtils.java(Compiled Code)) I have read somewhere that Struts version I am using does support the nested attributes for the and other tags. Are there any errors in the above code? Please help. Thanks & Regards, Chandra. _ Post free property ads on Yello Classifieds now! www.yello.in http://ss1.richmedia.in/recurl.asp?pid=221 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem from defining JavaBean as an attribute inside ActionForm
Hi, Thanks for getting back to me. All I was trying to do is getting the inside bean's values along with the ActionForm, so that I can handle those in my Action class. Please suggest a best way to achieve that. Thanks & Regards, Chandra. > Date: Thu, 3 Jul 2008 08:05:08 +0200> From: [EMAIL PROTECTED]> To: > user@struts.apache.org> Subject: Re: Problem from defining JavaBean as an > attribute inside ActionForm> > Hi> > > We are using Struts 1.2.9 and writing > the JSP page as below:> >> > > > > > > > > property="empAddress.city"/>> > > > > > > As I remember, Struts 1 don't support such evaluation, you > can use> Nested Tags [1] , example are here [2]> > [1] > http://struts.apache.org/1.2.9/userGuide/struts-nested.html> [2] > http://www.mail-archive.com/[EMAIL PROTECTED]/msg47798.html> > > Regards> -- > > Lukasz> http://www.lenart.org.pl/> > > -> To > unsubscribe, e-mail: [EMAIL PROTECTED]> For additional commands, e-mail: > [EMAIL PROTECTED]> _ Post free property ads on Yello Classifieds now! www.yello.in http://ss1.richmedia.in/recurl.asp?pid=219
Re: Problem from defining JavaBean as an attribute inside ActionForm
Hi > We are using Struts 1.2.9 and writing the JSP page as below: > > > > > > > As I remember, Struts 1 don't support such evaluation, you can use Nested Tags [1] , example are here [2] [1] http://struts.apache.org/1.2.9/userGuide/struts-nested.html [2] http://www.mail-archive.com/[EMAIL PROTECTED]/msg47798.html Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem from defining JavaBean as an attribute inside ActionForm
Hi, I have the below scenario: I have a java bean as below: public class Address { private String city; private String state; and public getters/setters for the above attributes; } and I have the ActionForm as below: import Address; public class EmpForm extends ActionForm { private String name; private String empID; private Address empAddress; and public getters/setters for the aboev attribute; } We are using Struts 1.2.9 and writing the JSP page as below: I am getting the below error while submitting the form: E SRVE0026E: [Servlet Error]-[BeanUtils.populate]: java.lang.IllegalArgumentException: No bean specified at org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(PropertyUtils.java(Compiled Code)) I have read somewhere that Struts version I am using does support the nested attributes for the and other tags. Are there any errors in the above code? Please help. Thanks & Regards, Chandra. _ Post free property ads on Yello Classifieds now! www.yello.in http://ss1.richmedia.in/recurl.asp?pid=221
Re: How to get dynamic number of arguments into ActionForm
I accomplished this without using the DynaActionForm. Its somewhat a crude way but it works. When stuck with constraints what is one to do? Here is an example, in the JSP I have coded the form element: Once rendered in the HTML: In the form bean: private List beneficiaries = new ArrayList(); public BeneficiaryVO getBeneficiaries(int index) { while (index >= beneficiaries.size()) { beneficiaries.add(new BeneficiaryVO()); } return (BeneficiaryVO) beneficiaries.get(index); } HTH, Glenn
Re: How to get dynamic number of arguments into ActionForm
First thing is I can't use Struts 2.0. I think you didn't understand my problem. So i'm giving all the details from struts-config.xml file onwards... struts-config.xml pollsForm.jsp == If i use the above form the choices that are entered by user are recived in the ActionForm as follows: MultipleFormAction.java --- execute() === DynaActionForm dynaForm = (DynaActionForm)form; String[] choices = (String[]) dynaForm.get("choices"); System.out.println(""); for(int i=0;i"+choices[i]+""); } System.out.println(""); But if it use the choices fields in array form i.e., pollsForm.jsp == If i follow the above procedure i'm getting ArrayIndexOutOfBoundsException. I tried setting size attribute in element. But When that size exceeds i'm getting the same exception. So what i want is to add dynamic number of choce-fields in the above html-array type form and get them into my ActionForm object. Please friends help!!! On Mon, May 5, 2008 at 6:30 AM, Martin Gainty <[EMAIL PROTECTED]> wrote: > Why not use Autocompleter? > > When used on the "simple" theme, the autocompleter can be used like the > ComboBox. > When used on the "ajax" theme, the list can be retieved from an action. > > > http://struts.apache.org/2.0.6/struts2-core/apidocs/org/apache/struts2/components/Autocompleter.html > - Original Message - From: "Mead Lai" <[EMAIL PROTECTED]> > To: "Struts Users Mailing List" > Sent: Sunday, May 04, 2008 8:43 PM > Subject: Re: How to get dynamic number of arguments into ActionForm > > > > List type >> >> On Sun, May 4, 2008 at 7:51 PM, venkat reddy <[EMAIL PROTECTED]> >> wrote: >> >>> I'm using struts 1.2.7 >>> >>> I've a poll-posting-form in adminstrator section of my application. >>> format >>> of the form is as follows. >>> >>> pollsubject: String >>> lastDate:String >>> choice1:String >>> choice2:String >>> . >>> . >>> . >>> Add another option >>> >>> As you can see here, the number of choices are dynamic and i want to add >>> a >>> link to give the administrator another choice field. >>> >>> Now, how can i get these dynamic fields into my ActionForm and what type >>> of >>> object should i declare in tag. explain in detail plz >>> >>> >> - >> 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: How to get dynamic number of arguments into ActionForm
Why not use Autocompleter? When used on the "simple" theme, the autocompleter can be used like the ComboBox. When used on the "ajax" theme, the list can be retieved from an action. http://struts.apache.org/2.0.6/struts2-core/apidocs/org/apache/struts2/components/Autocompleter.html - Original Message - From: "Mead Lai" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" Sent: Sunday, May 04, 2008 8:43 PM Subject: Re: How to get dynamic number of arguments into ActionForm List type On Sun, May 4, 2008 at 7:51 PM, venkat reddy <[EMAIL PROTECTED]> wrote: I'm using struts 1.2.7 I've a poll-posting-form in adminstrator section of my application. format of the form is as follows. pollsubject: String lastDate:String choice1:String choice2:String . . . Add another option As you can see here, the number of choices are dynamic and i want to add a link to give the administrator another choice field. Now, how can i get these dynamic fields into my ActionForm and what type of object should i declare in tag. explain in detail plz - 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: How to get dynamic number of arguments into ActionForm
List type On Sun, May 4, 2008 at 7:51 PM, venkat reddy <[EMAIL PROTECTED]> wrote: > I'm using struts 1.2.7 > > I've a poll-posting-form in adminstrator section of my application. format > of the form is as follows. > > pollsubject: String > lastDate:String > choice1:String > choice2:String > . > . > . > Add another option > > As you can see here, the number of choices are dynamic and i want to add a > link to give the administrator another choice field. > > Now, how can i get these dynamic fields into my ActionForm and what type of > object should i declare in tag. explain in detail plz > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to get dynamic number of arguments into ActionForm
I'm using struts 1.2.7 I've a poll-posting-form in adminstrator section of my application. format of the form is as follows. pollsubject: String lastDate:String choice1:String choice2:String . . . Add another option As you can see here, the number of choices are dynamic and i want to add a link to give the administrator another choice field. Now, how can i get these dynamic fields into my ActionForm and what type of object should i declare in tag. explain in detail plz
Re: Struts 1 vs Struts 2 actionform execution and Struts2 POJO example
What I need is to have one action and many various (POJO) objects, which polulate and receive date from html form. POJO object should be selected by the form, which is displayed (or submited). But I realy don't know how to do this in Struts 2. newton.dave wrote: > > --- bugs_ <[EMAIL PROTECTED]> wrote: >> Can me anybody give a simple example: How to use an POJO object in Struts >> 2 >> (instead of ActionForm)? > > http://struts.apache.org/2.x/docs/hello-world.html > > See the form creation/using the form bits. > > Dave > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Struts-1-vs-Struts-2-actionform-execution-and-Struts2-POJO-example-tp16143242p16176349.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 1 vs Struts 2 actionform execution and Struts2 POJO example
--- bugs_ <[EMAIL PROTECTED]> wrote: > Can me anybody give a simple example: How to use an POJO object in Struts 2 > (instead of ActionForm)? http://struts.apache.org/2.x/docs/hello-world.html See the form creation/using the form bits. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts 1 vs Struts 2 actionform execution and Struts2 POJO example
In struts 1. I have basic.jsp page with form: ... When I open basic.jsp it is autamatically created basicForm (which is configured at the basic action) And thanks this values in the form are automatically filled. Know anybody how to simulate this in Struts 2? or Can me anybody give a simple example: How to use an POJO object in Struts 2 (instead of ActionForm)? -- View this message in context: http://www.nabble.com/Struts-1-vs-Struts-2-actionform-execution-and-Struts2-POJO-example-tp16143242p16143242.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts1.1 - Value of ActionForm in second Action that is chained
mule_user wrote: This is the scenario using Struts 1.1: User Interface -> MyAction1 (input is Form1)-> MyAction 2 (input is Form2) ->User Interface MyAction1 and MyAction2 are Action classes. MyAction1 and MyAction1 are configured in struts-config.xmxl. MyAction1 takes Form1 as input. MyAction2 takes Form2 as input. Form1 and Form2 are ActionForms. Following are the questions: 1. If Form1 and Form2 are of the same class, will Form2 get magically populated by the values obtained from Form1, when Action1 forwards to Action2? 2. Will Form2 values be empty? Provided it really is a forward and not a redirect then yes, I believe Action2's form will be populated the same as Action1's form was. 3. If Form1 and Form2 are of different class, then what value will Form2 have? Again assuming a forward, Form2 would get populated in the usual way, meaning that Form2 properties will be set if there are corresponding request parameters. The type of the form doesn't matter; it's the properties it defines that are significant. 4. If Form1 and Form2 are of the same class, then what value will Form2 have? That's the same question isn't it? 5. Is it a good idea to do Action chaining? Servlet chaining was never recommended. The simple answer is no; action chaining is considered an anti-pattern. That said, there are circumstances where it is appropriate, and there are people who disagree that it's an anti-pattern in the first place :-) However, I would recommend that you avoid doing it entirely until you're sure you understand what's going on when a request is processed. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts1.1 - Value of ActionForm in second Action that is chained
This is the scenario using Struts 1.1: User Interface -> MyAction1 (input is Form1)-> MyAction 2 (input is Form2) ->User Interface MyAction1 and MyAction2 are Action classes. MyAction1 and MyAction1 are configured in struts-config.xmxl. MyAction1 takes Form1 as input. MyAction2 takes Form2 as input. Form1 and Form2 are ActionForms. Following are the questions: 1. If Form1 and Form2 are of the same class, will Form2 get magically populated by the values obtained from Form1, when Action1 forwards to Action2? 2. Will Form2 values be empty? 3. If Form1 and Form2 are of different class, then what value will Form2 have? 4. If Form1 and Form2 are of the same class, then what value will Form2 have? 5. Is it a good idea to do Action chaining? Servlet chaining was never recommended. -- View this message in context: http://www.nabble.com/Struts1.1---Value-of-ActionForm-in-second-Action-that-is-chained-tp15600395p15600395.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to make ActionForm in session scope in Struts2
thanks for the reply. My intention is , i have a list in my action class and adding values to the list(for e.g. Company) from the DB and forwarding to the .jsp after the user enter the values ->moving to the action and saving the values in db and again forwardig to the .jsp at that time the (company)values is not in the list now it makes me again to fetch it from the db. What i felt here is its a performance issue by again hitting the db to get the values to add it in the list. Is there any way to retain the values in the list other than session because i have so may drop down like for e.g. country? Is there any way to achieve this task? thanks in advance Joseph nuwan chandrasoma-2 wrote: > > Hi, > > what you mean by ActionForm? in struts2 there is no such as ActionForm, > you can access the session from your action class and add any object to > the session as an attribute. > > http://struts.apache.org/2.x/docs/how-do-we-get-access-to-the-session.html > http://struts.apache.org/2.x/docs/how-can-we-access-the-httpservletrequest.html > > Thanks, > > Nuwan > > Jose4u wrote: >> hi All >> >> how to make Action Form and a form in session scope in strut 2 >> >> help needed. >> Thanks in advance >> Joseph >> > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/how-to-make-ActionForm-in-session-scope-in-Struts2-tf4604877.html#a13206773 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to make ActionForm in session scope in Struts2
Hi, what you mean by ActionForm? in struts2 there is no such as ActionForm, you can access the session from your action class and add any object to the session as an attribute. http://struts.apache.org/2.x/docs/how-do-we-get-access-to-the-session.html http://struts.apache.org/2.x/docs/how-can-we-access-the-httpservletrequest.html Thanks, Nuwan Jose4u wrote: hi All how to make Action Form and a form in session scope in strut 2 help needed. Thanks in advance Joseph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
how to make ActionForm in session scope
hi All how to make Action Form and a form in session scope in strut 2 help needed. Thanks in advance Joseph -- View this message in context: http://www.nabble.com/how-to-make-ActionForm-in-session-scope-tf4604877.html#a13148752 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session scoped ActionForm causing strange behaviour
Hi, Thanks a lot for your replies :-) I found the solution to my problem. It was a case of missing "name" parameter in the . I had used . It was showing the values from previous form object. Thanks a bunch! Regards, Ramita Antonio Petrelli-3 wrote: > > 2007/10/3, Ramita Gambhir <[EMAIL PROTECTED]>: >> >> Is there any way I can refresh the values in the Form object? > > > > What do you exactly mean with "refresh"? > > > I read >> somewhere reset() function is not called in session scoped forms. If I >> call >> reset(), can it help? > > > Probably, but you have to override it to clear your properties in your > ActionForm class. > > Antonio > > -- View this message in context: http://www.nabble.com/Session-scoped-ActionForm-causing-strange-behaviour-tf4560983.html#a13042125 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session scoped ActionForm causing strange behaviour
2007/10/3, Ramita Gambhir <[EMAIL PROTECTED]>: > > Is there any way I can refresh the values in the Form object? What do you exactly mean with "refresh"? I read > somewhere reset() function is not called in session scoped forms. If I > call > reset(), can it help? Probably, but you have to override it to clear your properties in your ActionForm class. Antonio
Re: Session scoped ActionForm causing strange behaviour
Hi Antonio, Thanks a lot for the reply :-) I need to put the form into session to make it work with DWR(I had some requirement). This part I cannot change. Is there any way I can refresh the values in the Form object? I read somewhere reset() function is not called in session scoped forms. If I call reset(), can it help? Thanks, Ramita Antonio Petrelli-3 wrote: > > 2007/10/3, Ramita Gambhir <[EMAIL PROTECTED]>: >> >> I integrated Struts with Ajax using DWR. For that I had to put the >> ActionForm in session scope. > > > > Why do you need to put it into session? > > Now I am facing a strange problem. >> >> When I change some values in the form, they are saved(marshalled) >> properly >> at the backend(an XML file). But in the JSP, it shows old values only. >> I suspect this is happening because of session scoped ActionForm. > > > Your suspect is right! The action form is persisted across the requests. > > > What's the basic difference between request-scoped and session-scoped form >> objects? > > > > That session scoped form objects are stored in session, so you don't clear > it after the end of the request. > > Immediate help is needed... > > > You get immediate help only if you pay someone... :-) > > Antonio > > -- View this message in context: http://www.nabble.com/Session-scoped-ActionForm-causing-strange-behaviour-tf4560983.html#a13016861 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session scoped ActionForm causing strange behaviour
2007/10/3, Ramita Gambhir <[EMAIL PROTECTED]>: > > I integrated Struts with Ajax using DWR. For that I had to put the > ActionForm in session scope. Why do you need to put it into session? Now I am facing a strange problem. > > When I change some values in the form, they are saved(marshalled) properly > at the backend(an XML file). But in the JSP, it shows old values only. > I suspect this is happening because of session scoped ActionForm. Your suspect is right! The action form is persisted across the requests. What's the basic difference between request-scoped and session-scoped form > objects? That session scoped form objects are stored in session, so you don't clear it after the end of the request. Immediate help is needed... You get immediate help only if you pay someone... :-) Antonio
Session scoped ActionForm causing strange behaviour
Hi all, I integrated Struts with Ajax using DWR. For that I had to put the ActionForm in session scope. Now I am facing a strange problem. When I change some values in the form, they are saved(marshalled) properly at the backend(an XML file). But in the JSP, it shows old values only. I suspect this is happening because of session scoped ActionForm. Its taking values from the existing Form object in the session. And its not unmarshalling it everytime. So what can I do to resolve this problem? Any pointers?? What's the basic difference between request-scoped and session-scoped form objects? Immediate help is needed... Thanks a lot in advance. Regards, Ramita -- View this message in context: http://www.nabble.com/Session-scoped-ActionForm-causing-strange-behaviour-tf4560983.html#a13016312 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reload a page after ActionForm
You can set redirect=true on the action mapping. On 9/19/07, Diego Ezquerro <[EMAIL PROTECTED]> wrote: > > Hi to everybody. > > I have a JSP that has a Tree that is modified by a submit button that > sends data to an ActionForm. > Inside this ActionForm class, the tree is modified but only if the page is > reloaded the tree is visually modified. > > How can I reload the page after de mapping.findForward sentence? > > Thanks a lot. > > Diego Ezquerro Bailac > Asturias, Spain > > > > __ > Correo Yahoo! > Espacio para todos tus mensajes, antivirus y antispam ¡gratis! > Regístrate ya - http://correo.espanol.yahoo.com/
Reload a page after ActionForm
Hi to everybody. I have a JSP that has a Tree that is modified by a submit button that sends data to an ActionForm. Inside this ActionForm class, the tree is modified but only if the page is reloaded the tree is visually modified. How can I reload the page after de mapping.findForward sentence? Thanks a lot. Diego Ezquerro Bailac Asturias, Spain __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! Regístrate ya - http://correo.espanol.yahoo.com/
Re: How to access the ActionForm in a JSP?
--- "REMIJAN, MICHAEL J [AG/1000]" wrote: > My question is how do get a reference to that action > object in the JSP page? The tutorials on the Struts2 > website showed examples using tags, but I > don't need to use tags. I just want to > display data. The current action is pushed on the OGNL stack. If a property is exposed by the action it can be accessed via an tag. If you're using S2 it would probably be better not to refer to "ActionForm"s as that has specific S1 meaning. I've patented this message; you may not use it next year. d. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to access the ActionForm in a JSP?
Oh, you know what, my bad... I'm on vacation this week and my brain is shut down even more than some would say it normally is... you asked about Struts2, and I answered for Struts1. Sorry about that, ignore what I said. For S2, let's say you have a String property "name" on your HelloWorldAction class, you can use: ...in your JSP to display it. You'll also need: <[EMAIL PROTECTED] prefix="s" uri="/struts-tags" %> ...to make that work. And of course, make sure you have an appropriate getter method on the Action too. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of "Practical Ajax Projects With Java Technology" (2006, Apress, ISBN 1-59059-695-1) and "JavaScript, DOM Scripting and Ajax Projects" (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! REMIJAN, MICHAEL J [AG/1000] wrote: So if I have "helloworld.action" defined as: /WEB-INF/jsp/helloworld.jsp Then I can retrieve the object with: MyActionForm form = (MyActionForm)request.getAttribute("helloworld"); ?? -Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 04, 2007 8:31 AM To: Struts Users Mailing List Subject: Re: How to access the ActionForm in a JSP? You can find the form as a request attribute with the same name you used in your config file, so: MyActionForm form = (MyActionForm)request.getAttribute("myFormName"); Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of "Practical Ajax Projects With Java Technology" (2006, Apress, ISBN 1-59059-695-1) and "JavaScript, DOM Scripting and Ajax Projects" (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! REMIJAN, MICHAEL J [AG/1000] wrote: Newbie question here. Suppose I have action, "helloworld.action" which I use to grab a bunch of data I wish to display on a JSP page. My question is how do get a reference to that action object in the JSP page? The tutorials on the Struts2 website showed examples using /> tags, but I don't need to use tags. I just want to display data. Michael J. Remijan - This e-mail message may contain privileged and/or confidential information, and is intended to be received only by persons entitled to receive such information. If you have received this e-mail in error, please notify the sender immediately. Please delete it and all attachments from any servers, hard drives or any other media. Other use of this e-mail by you is strictly prohibited. All e-mails and attachments sent and received are subject to monitoring, reading and archival by Monsanto. The recipient of this e-mail is solely responsible for checking for the presence of "Viruses" or other "Malware". Monsanto accepts no liability for any damage caused by any such code transmitted by or accompanying this e-mail or any attachment. - No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.485 / Virus Database: 269.13.3/986 - Release Date: 9/3/2007 9:31 AM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - This e-mail message may contain privileged and/or confidential information, and is intended to be received only by persons entitled to receive such information. If you have received this e-mail in error, please notify the sender immediately. Please delete it and all attachments from any servers, hard drives or any other media. Other use of this e-mail by you is strictly prohibited. All e-mails and attachments sent and received are subject to monitoring, reading and archival by Monsanto. The recipient of this e-mail is solely responsible for checking for the presence of "Viruses" or other "Malware". Monsanto accepts no liability for any damage caused by any such code transmitted by or accompanying this e-mail or any attachment.
RE: How to access the ActionForm in a JSP?
So if I have "helloworld.action" defined as: /WEB-INF/jsp/helloworld.jsp Then I can retrieve the object with: MyActionForm form = (MyActionForm)request.getAttribute("helloworld"); ?? -Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 04, 2007 8:31 AM To: Struts Users Mailing List Subject: Re: How to access the ActionForm in a JSP? You can find the form as a request attribute with the same name you used in your config file, so: MyActionForm form = (MyActionForm)request.getAttribute("myFormName"); Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of "Practical Ajax Projects With Java Technology" (2006, Apress, ISBN 1-59059-695-1) and "JavaScript, DOM Scripting and Ajax Projects" (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! REMIJAN, MICHAEL J [AG/1000] wrote: > Newbie question here. Suppose I have action, "helloworld.action" which > I use to grab a bunch of data I wish to display on a JSP page. My > question is how do get a reference to that action object in the JSP > page? The tutorials on the Struts2 website showed examples using /> tags, but I don't need to use tags. I just want to display > data. > > Michael J. Remijan > > > - > This e-mail message may contain privileged and/or confidential information, and is intended to be received only by persons entitled to receive such information. If you have received this e-mail in error, please notify the sender immediately. Please delete it and all attachments from any servers, hard drives or any other media. Other use of this e-mail by you is strictly prohibited. > > > All e-mails and attachments sent and received are subject to monitoring, reading and archival by Monsanto. The recipient of this e-mail is solely responsible for checking for the presence of "Viruses" or other "Malware". Monsanto accepts no liability for any damage caused by any such code transmitted by or accompanying this e-mail or any attachment. > - > > > > > > > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.5.485 / Virus Database: 269.13.3/986 - Release Date: 9/3/2007 9:31 AM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - This e-mail message may contain privileged and/or confidential information, and is intended to be received only by persons entitled to receive such information. If you have received this e-mail in error, please notify the sender immediately. Please delete it and all attachments from any servers, hard drives or any other media. Other use of this e-mail by you is strictly prohibited. All e-mails and attachments sent and received are subject to monitoring, reading and archival by Monsanto. The recipient of this e-mail is solely responsible for checking for the presence of "Viruses" or other "Malware". Monsanto accepts no liability for any damage caused by any such code transmitted by or accompanying this e-mail or any attachment. - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to access the ActionForm in a JSP?
You can find the form as a request attribute with the same name you used in your config file, so: MyActionForm form = (MyActionForm)request.getAttribute("myFormName"); Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of "Practical Ajax Projects With Java Technology" (2006, Apress, ISBN 1-59059-695-1) and "JavaScript, DOM Scripting and Ajax Projects" (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! REMIJAN, MICHAEL J [AG/1000] wrote: Newbie question here. Suppose I have action, "helloworld.action" which I use to grab a bunch of data I wish to display on a JSP page. My question is how do get a reference to that action object in the JSP page? The tutorials on the Struts2 website showed examples using tags, but I don't need to use tags. I just want to display data. Michael J. Remijan - This e-mail message may contain privileged and/or confidential information, and is intended to be received only by persons entitled to receive such information. If you have received this e-mail in error, please notify the sender immediately. Please delete it and all attachments from any servers, hard drives or any other media. Other use of this e-mail by you is strictly prohibited. All e-mails and attachments sent and received are subject to monitoring, reading and archival by Monsanto. The recipient of this e-mail is solely responsible for checking for the presence of "Viruses" or other "Malware". Monsanto accepts no liability for any damage caused by any such code transmitted by or accompanying this e-mail or any attachment. - No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.485 / Virus Database: 269.13.3/986 - Release Date: 9/3/2007 9:31 AM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to access the ActionForm in a JSP?
Newbie question here. Suppose I have action, "helloworld.action" which I use to grab a bunch of data I wish to display on a JSP page. My question is how do get a reference to that action object in the JSP page? The tutorials on the Struts2 website showed examples using tags, but I don't need to use tags. I just want to display data. Michael J. Remijan - This e-mail message may contain privileged and/or confidential information, and is intended to be received only by persons entitled to receive such information. If you have received this e-mail in error, please notify the sender immediately. Please delete it and all attachments from any servers, hard drives or any other media. Other use of this e-mail by you is strictly prohibited. All e-mails and attachments sent and received are subject to monitoring, reading and archival by Monsanto. The recipient of this e-mail is solely responsible for checking for the presence of "Viruses" or other "Malware". Monsanto accepts no liability for any damage caused by any such code transmitted by or accompanying this e-mail or any attachment. -
Re: Accessing ActionForm from JSP
How can I do that from the Scriplet ? TIA, Oleg. On 8/2/07, Aram Mkhitaryan <[EMAIL PROTECTED]> wrote: > > Try this > > ${actionFormName.propertyName} > > Best, > Aram > > Aram Mkhitaryan > > 52, 25 Lvovyan, Yerevan 375000, Armenia > > Mobile: +374 91 518456 > E-mail: [EMAIL PROTECTED] >
Re: Accessing ActionForm from JSP
pageContext.findAttribute() will return the ActionForm instance . On 8/2/07, Oleg Konovalov <[EMAIL PROTECTED]> wrote: > > Hi, > > How can I access an ActionForm from my JSP in Struts 1.2-1.3 ? > > Thank you, > Oleg. > -- Yoge, AdventNet, Inc. 925-965-6528 [EMAIL PROTECTED] site24x7.com
Re: Accessing ActionForm from JSP
Try this ${actionFormName.propertyName} Best, Aram Aram Mkhitaryan 52, 25 Lvovyan, Yerevan 375000, Armenia Mobile: +374 91 518456 E-mail: [EMAIL PROTECTED]
Accessing ActionForm from JSP
Hi, How can I access an ActionForm from my JSP in Struts 1.2-1.3 ? Thank you, Oleg.
Re: Prepopulate ActionForm bean with STruts
Peter Valencic wrote: Hello to all... I'am working on a large project for car assicuration. My question is if it's possible to prepopulate a form for example.. On page A user must enter policy number... then in actionForm bean i get datas from DB and depends on datas I must prepopulate a form B Anyone have some short example how to prepopulate a ActionForm..? I tryed to get actionForm bean from session but I'dont know if this is ok... for example this code is from my ActionForm which is on page A: public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { System.out.println(""); System.out.println("Action1"); session = request.getSession(); AO2formbean fmb = (AO3formbean) session.getAttribute("AO2formbean"); <--- this is a bean (ActionForm which is on page B) fmb.setName("c"); <-- here I set some data (prepopulate actionform bean from page B) session.setAttrribute("AO2formbean",fmb); <-- here I'store a bean in session... return mapping.findForward("ok"); } Is this correct or no? Hmm. How do you get AO2formbean into the session in the first place? More to the point, why are you trying to initialize the data for form B in the action for form A? I need 2 things first i must strore a bean in session because I must display some data from bean many times on different forms (pages).. second i must prepopulate fields displayed in next page (A -> B) I think you probably want to do a couple of things to meet this requirement: 1) for all the forms that need to share data, configure them to use the same session-scoped form 2) whenever a form requires data to be pre-populated, make sure you have an action to handle that; when you want to display that form, do so by calling (forwarding/redirecting to) the action that knows how to prepare it If that doesn't make sense, try posting a more complete example of what you're trying to do, including form-bean and action mappings from your config file as well as appropriate snippets of your action code. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Prepopulate ActionForm bean with STruts
Hello to all... I'am working on a large project for car assicuration. My question is if it's possible to prepopulate a form for example.. On page A user must enter policy number... then in actionForm bean i get datas from DB and depends on datas I must prepopulate a form B Anyone have some short example how to prepopulate a ActionForm..? I tryed to get actionForm bean from session but I'dont know if this is ok... for example this code is from my ActionForm which is on page A: public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { System.out.println(""); System.out.println("Action1"); session = request.getSession(); AO2formbean fmb = (AO3formbean) session.getAttribute("AO2formbean"); <--- this is a bean (ActionForm which is on page B) fmb.setName("c"); <-- here I set some data (prepopulate actionform bean from page B) session.setAttrribute("AO2formbean",fmb); <-- here I'store a bean in session... return mapping.findForward("ok"); } Is this correct or no? I need 2 things first i must strore a bean in session because I must display some data from bean many times on different forms (pages).. second i must prepopulate fields displayed in next page (A -> B) thnx for any help Peter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
prepopulating a form (how to prepopulate ActionForm before it is called)
Hello to all. I would like to populate a ActionForm bean .. for example I have 2 pages page A.jsp and page B.jsp on page A I have ActionForm and on page B I have ActionForm bean.. Is there a possibility to prepopulate ActionForm for page B from page A? example *public* ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) *throws* IOException, ServletException { System.out.println("Action 1"); HttpSession ses = request.getSession(*true*); System.out.println(ses.getId()); Abean bean = (Abean)form; Bbean bbean = *new* Bbean(); bbean.setIme("Franko"); ses.setAttribute("Bbean",bbean); *return* mapping.findForward("success"); } then on page B.jsp i display datas: <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%><%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> <%@ page contentType="text/html;charset=windows-1250"%> untitled To je B stran to je: ABean is ActionForm for page A.jsp and Bbean is ActionForm bean from page B.jsp what I like to do is to set some parameters which will be displayed when page B will be called... I'dont know is this what I have do is ok? I have develped a large project for car assicuration but when many users acess the page some of them get null values or exceptions (maybe I'am not doing it in the right way)? from the real life... On page A user must enter a policy number... Then the ActionForm for page A is called... in this action I acess the database and read some datas... With this datas i would like to prepopulate the page B so I declare a new bean which is ActionForm from page B and prepopulate it with some values... Then I store te bean in session variable. is this the right way? Anybody can give me some example? best regards
ActionForm
From: Ashuin Sharma Chamorro Sent: Tuesday, May 01, 2007 5:12 PM To: 'Struts Users Mailing List' Subject: ActionForm In which scope does the ActionForm lives??? In request or session?? Or what?? If in the Action Class I set some values to the form, do I have to add the form back to the request or what do I have to do so the success page will see the modified form??? Is it this scope ??(JSP ---form--- > Action.java form---> JSP ) Please help.
Re: ActionForm
It lives in whatever scope you tell it :-) There is a scope parameter on the action tag. It defaults to session. Objects persist until the holder is thrownaway. For requests, objects in request scope are thrown out when the request is thrown out. Objects in the session are thrown out when the session is thrown out, etc. Paul On 5/1/07, Ashuin Sharma Chamorro <[EMAIL PROTECTED]> wrote: In which scope does the ActionForm lives??? In request or session?? Or what?? If in the Action Class I set some values to the form, do I have to add the form back to the request or what do I have to do so the success page will see the modified form??? Is it this scope ??(JSP ---form--- > Action.java form---> JSP ) Please help.
ActionForm
In which scope does the ActionForm lives??? In request or session?? Or what?? If in the Action Class I set some values to the form, do I have to add the form back to the request or what do I have to do so the success page will see the modified form??? Is it this scope ??(JSP ---form--- > Action.java form---> JSP ) Please help.
RE: Using ActionForm in struts2
You could want take a look at struts1-plugin for struts2, if you need more behavior of struts1 in your app. Felipe __Billa__ wrote: > > > Thanks a Lot! > > -Original Message- > From: Dave Newton [mailto:[EMAIL PROTECTED] > Sent: Friday, March 30, 2007 2:36 PM > To: Struts Users Mailing List > Subject: Re: Using ActionForm in struts2 > > --- Syed Ibrahim <[EMAIL PROTECTED]> wrote: >> Instead of writing the getter and setters in Action >> I would prefer then to be written separately as the >> same bean can be used elsewhere in models or >> DAO transfer objects. >> >> How to achieve that in Struts 2 ? > > Write your POJO, expose it in your action per JavaBean > spec, and use it in your form? Pseudo: > > class Action Foo { > private User user; // Plus getter and setter. > } > > > > > > d. > > > > > > > Get your own web address. > Have a HUGE year through Yahoo! Small Business. > http://smallbusiness.yahoo.com/domains/?p=BESTDEAL > > - > 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] > > > -- View this message in context: http://www.nabble.com/Struts-ui-components-inside-%3Ctable%3E-in-a-single-line.-tf3489297.html#a9751361 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Using ActionForm in struts2
Thanks a Lot! -Original Message- From: Dave Newton [mailto:[EMAIL PROTECTED] Sent: Friday, March 30, 2007 2:36 PM To: Struts Users Mailing List Subject: Re: Using ActionForm in struts2 --- Syed Ibrahim <[EMAIL PROTECTED]> wrote: > Instead of writing the getter and setters in Action > I would prefer then to be written separately as the > same bean can be used elsewhere in models or > DAO transfer objects. > > How to achieve that in Struts 2 ? Write your POJO, expose it in your action per JavaBean spec, and use it in your form? Pseudo: class Action Foo { private User user; // Plus getter and setter. } d. Get your own web address. Have a HUGE year through Yahoo! Small Business. http://smallbusiness.yahoo.com/domains/?p=BESTDEAL - 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: Using ActionForm in struts2
--- Syed Ibrahim <[EMAIL PROTECTED]> wrote: > Instead of writing the getter and setters in Action > I would prefer then to be written separately as the > same bean can be used elsewhere in models or > DAO transfer objects. > > How to achieve that in Struts 2 ? Write your POJO, expose it in your action per JavaBean spec, and use it in your form? Pseudo: class Action Foo { private User user; // Plus getter and setter. } d. Get your own web address. Have a HUGE year through Yahoo! Small Business. http://smallbusiness.yahoo.com/domains/?p=BESTDEAL - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Using ActionForm in struts2
Hi, I want to use Simple ActionForms or POJO in Struts 2. Instead of writing the getter and setters in Action I would prefer then to be written separately as the same bean can be used elsewhere in models or DAO transfer objects. How to achieve that in Struts 2 ? Thanks in advance Ibrahim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts Question - multiple instances of an actionForm
--- xyz <[EMAIL PROTECTED]> wrote: > Any hints/ideas on achieving this? Have you considered using indexed properties? d. TV dinner still cooling? Check out "Tonight's Picks" on Yahoo! TV. http://tv.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts Question - multiple instances of an actionForm
Hi all, Is there any standard ways to manage multiple instances of one form with Struts? Say,I have application which is supposed to take theorerically unlimited number of person's descriptions. Every time user clicks "add one more person" he/she gets exactly the same form (with the same validation rules) to fill. He should be able to save individual details and validate it seperately.So lets say there is a 'save' button which will help us save individual details in session and a delete button which will help us delete the saved details from session.At the end user clicks "finish" and all saved data from session along with some common information is to be handled for further processing. Is there any mechanism in Struts supporting multiple instances. Any hints/ideas on achieving this? Thanks -- View this message in context: http://www.nabble.com/Struts-Question---multiple-instances-of-an-actionForm-tf3396668.html#a9456868 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 - session scope ActionForm
Thanks Don, that is exactly what I need. On 3/8/07, Don Brown <[EMAIL PROTECTED]> wrote: If you really want to have a JavaBean serve as a session-scoped ActionForm, use this interceptor: http://struts.apache.org/2.x/docs/scoped-model-driven-interceptor.html It allows you to have a single JavaBean as the Action's model (ActionForm) and will manage storing and retrieving it to/from the session. Don On 3/6/07, Alex Wibowo <[EMAIL PROTECTED]> wrote: > Hi all... > > I am still in the process of learning Struts 2. As I understand it, there is > no way in Struts 2 to do something like session scope ActionForm in Struts > 1. > The only solution I can find is to use "ConversationScopeInterceptor" > written here: > https://issues.apache.org/struts/browse/WW-1514 > > Does this sound right? Or am I missing something in the Struts > documentation? > > > > Thanks a lot! > > > > -- > Best regards, > > > Alex Wibowo > --- > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Best regards, Alex Wibowo ---
Re: Struts 2 - session scope ActionForm
If you really want to have a JavaBean serve as a session-scoped ActionForm, use this interceptor: http://struts.apache.org/2.x/docs/scoped-model-driven-interceptor.html It allows you to have a single JavaBean as the Action's model (ActionForm) and will manage storing and retrieving it to/from the session. Don On 3/6/07, Alex Wibowo <[EMAIL PROTECTED]> wrote: Hi all... I am still in the process of learning Struts 2. As I understand it, there is no way in Struts 2 to do something like session scope ActionForm in Struts 1. The only solution I can find is to use "ConversationScopeInterceptor" written here: https://issues.apache.org/struts/browse/WW-1514 Does this sound right? Or am I missing something in the Struts documentation? Thanks a lot! -- Best regards, Alex Wibowo --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 - session scope ActionForm
Alex Wibowo wrote: Hi all... I am still in the process of learning Struts 2. As I understand it, there is no way in Struts 2 to do something like session scope ActionForm in Struts 1. The only solution I can find is to use "ConversationScopeInterceptor" written here: https://issues.apache.org/struts/browse/WW-1514 Does this sound right? Or am I missing something in the Struts documentation? I think you can get session-scoped action instances if you manage them through Spring, but in any case your action can implement SessionAware and store data to the session without needing any other plugins. Conversation scope solves a different problem than just storing data in the session; is that what you need, or is session access sufficient? L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts 2 - session scope ActionForm
Hi all... I am still in the process of learning Struts 2. As I understand it, there is no way in Struts 2 to do something like session scope ActionForm in Struts 1. The only solution I can find is to use "ConversationScopeInterceptor" written here: https://issues.apache.org/struts/browse/WW-1514 Does this sound right? Or am I missing something in the Struts documentation? Thanks a lot! -- Best regards, Alex Wibowo ---
Re: ActionForm is null
Assuming Struts 1.x, Action Forms are null when the "name" attribute, which specifies the form, is omitted. Forms are optional for actions. Paul Dave Newton wrote: I'm glad you fixed your problem. --- Monkeyden <[EMAIL PROTECTED]> wrote: If I knew exactly what to tell you, I would likely know enough to fix it. Most people seem to find that posting relevent portions of the config file(s) in question and isolated code chunks to be a reasonable place to start. So while that isn't necessarily *exactly* what to tell the list it makes for a pretty good beginning. d. Looking for earth-friendly autos? Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center. http://autos.yahoo.com/green_center/ - 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: ActionForm is null
I'm glad you fixed your problem. --- Monkeyden <[EMAIL PROTECTED]> wrote: > If I knew exactly what to tell you, I would likely > know enough to fix it. Most people seem to find that posting relevent portions of the config file(s) in question and isolated code chunks to be a reasonable place to start. So while that isn't necessarily *exactly* what to tell the list it makes for a pretty good beginning. d. Looking for earth-friendly autos? Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center. http://autos.yahoo.com/green_center/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionForm is null
If I knew exactly what to tell you, I would likely know enough to fix it. Turns out I did. The root cause of the problem, and the solution, had nothing todo with Struts. On 2/25/07, Dave Newton <[EMAIL PROTECTED]> wrote: --- Monkeyden <[EMAIL PROTECTED]> wrote: > Im using Struts 1.2.9 on Tomcat 4.1.31. Somehow, my > form is null within my Action. That's not much to go on. d. Need Mail bonding? Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users. http://answers.yahoo.com/dir/?link=list&sid=396546091 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionForm is null
--- Monkeyden <[EMAIL PROTECTED]> wrote: > Im using Struts 1.2.9 on Tomcat 4.1.31. Somehow, my > form is null within my Action. That's not much to go on. d. Need Mail bonding? Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users. http://answers.yahoo.com/dir/?link=list&sid=396546091 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ActionForm is null
Im using Struts 1.2.9 on Tomcat 4.1.31. Somehow, my form is null within my Action. It's even null at the level FormBeanConfig.formBeanClass() is called. The type, returned by FormBeanConfig.getType(), returns the correct String, but the call to classLoader.loadClass(getType()) fails to load the form bean. Does anyone who worked on that piece know what might be happening? Looks like Joe Germuska was the author of FormBeanConfig.
Re: Action and ActionForm in popup window
Yariel: Your struts config looks good. I can't guess why you'd have different results in a popup vs. a regular page unless you are perhaps using different modules or somehow have the webapp deployed under two contexts with slightly different configurations. Have you done a full clean reinstall, restart app server, etc? I suggest that not because it's likely to actually fix anything, but sometimes going through the complete process helps you methodically make sure your application is in a consistent state. not sure what else to suggest... Joe On 2/8/07, Yariel Ramos Moreno <[EMAIL PROTECTED]> wrote: Thanks for your help Joe, but I allready did everything you said. The action I'm using works perfectly in a normal window... the problem occurs when I use it in the popup window. I'm using struts 1.1. This is the struts-config code snippet: Form: Action: - Original Message - From: Joe Germuska To: Struts Users Mailing List Sent: Thursday, February 08, 2007 11:00 AM Subject: Re: Action and ActionForm in popup window There needs to be an element in your struts-config.xml etc. Whenever you use an tag, Struts must be able to find (in struts-config.xml) the action you specify in the action attribute, and that action must have a "name" attribute which points to an ActionForm configuration. The form tag looks up an ActionForm instance in request or session scope, or creates one if necessary, and uses that bean to "back" the form fields inside which may have values which need to be "filled", as in the case of returning-to-a-form-after-validation-failures. I hope this helps. Joe On 2/8/07, Yariel Ramos Moreno <[EMAIL PROTECTED]> wrote: > > Hi all: > > From a page in my struts application, I need to open a popup window with > some fields to pick up some values. I created an ActionForm with the filed's > properties and an Action asociated to it. The problem is that when I try to > open the popup the following exception is raised: > Cannot retrieve mapping for action /criteriosOferta .. > > In this line: > > > > It is possible to do that? Any idea of how fix it? > > Thanks in advance... > > > -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com "The truth is that we learned from João forever to be out of tune." -- Caetano Veloso -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com "The truth is that we learned from João forever to be out of tune." -- Caetano Veloso
Re: Action and ActionForm in popup window
Thanks for your help Joe, but I allready did everything you said. The action I'm using works perfectly in a normal window... the problem occurs when I use it in the popup window. I'm using struts 1.1. This is the struts-config code snippet: Form: Action: - Original Message - From: Joe Germuska To: Struts Users Mailing List Sent: Thursday, February 08, 2007 11:00 AM Subject: Re: Action and ActionForm in popup window There needs to be an element in your struts-config.xml etc. Whenever you use an tag, Struts must be able to find (in struts-config.xml) the action you specify in the action attribute, and that action must have a "name" attribute which points to an ActionForm configuration. The form tag looks up an ActionForm instance in request or session scope, or creates one if necessary, and uses that bean to "back" the form fields inside which may have values which need to be "filled", as in the case of returning-to-a-form-after-validation-failures. I hope this helps. Joe On 2/8/07, Yariel Ramos Moreno <[EMAIL PROTECTED]> wrote: > > Hi all: > > From a page in my struts application, I need to open a popup window with > some fields to pick up some values. I created an ActionForm with the filed's > properties and an Action asociated to it. The problem is that when I try to > open the popup the following exception is raised: > Cannot retrieve mapping for action /criteriosOferta .. > > In this line: > > > > It is possible to do that? Any idea of how fix it? > > Thanks in advance... > > > -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com "The truth is that we learned from João forever to be out of tune." -- Caetano Veloso
Re: Action and ActionForm in popup window
There needs to be an element in your struts-config.xml etc. Whenever you use an tag, Struts must be able to find (in struts-config.xml) the action you specify in the action attribute, and that action must have a "name" attribute which points to an ActionForm configuration. The form tag looks up an ActionForm instance in request or session scope, or creates one if necessary, and uses that bean to "back" the form fields inside which may have values which need to be "filled", as in the case of returning-to-a-form-after-validation-failures. I hope this helps. Joe On 2/8/07, Yariel Ramos Moreno <[EMAIL PROTECTED]> wrote: Hi all: From a page in my struts application, I need to open a popup window with some fields to pick up some values. I created an ActionForm with the filed's properties and an Action asociated to it. The problem is that when I try to open the popup the following exception is raised: Cannot retrieve mapping for action /criteriosOferta .. In this line: It is possible to do that? Any idea of how fix it? Thanks in advance... -- Joe Germuska [EMAIL PROTECTED] * http://blog.germuska.com "The truth is that we learned from João forever to be out of tune." -- Caetano Veloso
Action and ActionForm in popup window
Hi all: >From a page in my struts application, I need to open a popup window with some >fields to pick up some values. I created an ActionForm with the filed's >properties and an Action asociated to it. The problem is that when I try to >open the popup the following exception is raised: Cannot retrieve mapping for action /criteriosOferta .. In this line: It is possible to do that? Any idea of how fix it? Thanks in advance...
Re: strange behaviour or working as intended with ActionForm and namespaces?
Chris you made my day. We never thought about an option like redirect. Problem resolved and best thanks to you. with kind greetings from germany Dirk Hesse Am 26.01.2007, 20:08 Uhr, schrieb Christopher Schultz <[EMAIL PROTECTED]>: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dirk, Dirk Hesse wrote: On the detailview he is clicking the Cancel button and will be redirected back to the listItemsAction with the listForm. When you press CANCEL, which action receives the request? I would imaging something like SaveDetailAction. When you check for cancel and redirect, are you sure that you are doing a REDIRECT and not a FORWARD? If you do a forward, things might get a bit messy. Both forms are different except in two cases...they have two fields with the same name(employee and title) and these fields are filled from the detailForm even though they was not before. It seems as if the actionForm form is holding each propertyfield as long as i stay on the same request. That's true. If you submit a request parameter like "name" and then process the request using SaveDetailAction (which uses DetailForm), then your DetailForm for the request will have DetailForm.setName() called. If you then forward (/not/ redirect) to ListThingsAction (which uses ListForm), then ListForm.setName() will be called in preparation for handling the form. What you want to do is REDIRECT from SaveDetailAction to ListThingsAction (use ), and then you'll get a fresh request. Don't forget to add any necessary request parameters to get back to the same list view that you were seeing before. I hope that helps, - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFulGm9CaO5/Lv0PARAt8TAJ9+h0t8HVz2/t7JLzrTvDgVFw0RagCZARkA 8dn2HNi7QsUgX4E2ySDIOYI= =pg0N -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Intero Technologies Dirk Hesse Dipl. - Wirtschaftsinformatiker Softwareentwickler Mobil: +49 (0) 163 63 66 087 Email:[EMAIL PROTECTED] Intero Technologies GmbH Gutshaus Klein Kordshagen, Hof 8 D 18442 Lüssow/ Stralsund Tel:+49 (0) 3831 – 44 55 722 Fax: +49 (0) 3831 – 44 55 779 This eMail and its content is dedicated to the intended recipient only. If you have received it in error please contact the sender immediately by fax or return eMail. Please then delete the eMail and any copies of it. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]