Re: How to repopulate Form which has html elements with samename
Let me rephrase my question. I have a table which looks like this.. example table width=300 border=0 cellspacing=1 cellpadding=1 tr thName/th thSex/th /tr tr tdhtml:text property=name //td tdhtml:select property=sex html:option value=nbsp;/html:option html:option value=M Male/html:option html:option value=F Female/html:option /html:select /td /tr tr tdhtml:text property=name //td tdhtml:select property=sex html:option value=nbsp;/html:option html:option value=nbsp;/html:option html:option value=M Male/html:option html:option value=F Female/html:option /html:select /td /tr /table So when I add data like Sashi Male Sushma FEMALE now I submit the form, and say there are some validation errors how can I build the table with the above values retrieving from the Form Bean .My form bean has the following methods public String[] getName(){ return name; } public void setName(String[] newName){ name = newName; } public String[] getSex(){ return sex; } public void setSex(String[] newSex){ sex = newSex; } The values are getting stored in the array, but to get them back and build my table is what is not clear to me.. logic:iterate may do the job but how to use it?? Hope I am clear now [EMAIL PROTECTED] 06/05/03 11:15AM doesn't the form do this automatically? if validation fails, i think the standard behavior is to return the user to the page just as they left it -- preferably with the appropriate error messagei know there are multiple ways to do the validation (and i'm not using the best way), but one way is to have a method like the one below in you form bean. If any of the following conditions are met, the user is returned to the page with the form populated. Hope this helps. -nathan public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if (this.isBlankString(oldpassword)) { errors.add(oldpassword,new ActionError(error.required.oldpassword)); } if (this.isBlankString(newpassword1)) { errors.add(newpassword1, new ActionError(error.required.newpassword1)); } if (this.isBlankString(newpassword2)) { errors.add(newpassword2, new ActionError(error.required.newpassword2)); } // Test to see if the new passwords are the same. if (!newpassword1.equals(newpassword2)) { errors.add(newpassword1, new ActionError(error.passwordmatch)); } return errors; } On Thursday, June 5, 2003, at 09:59 AM, Sashi Ravipati wrote: Hi I am a newbie to struts... I have a dynamic table which has a html:text and a html:select . The user cliks on a add button and enter values in each row of the table and submits the form. How can I repopulate the valuse if validation fails. Can some body give a working exapmle of the Action Form that is required for this kind of requirement. I found this in Ted Husted site but had no clue as what he is trying to do, What is RESULT etc --- --- TABLEhtml:form action=/item/StoreCategory logic:iterate name=RESULT property=iterator id=row TR THname/TH THcategory/TH /TR TR TDbean:write name=row property=name//TD TD%-- REMEMBER TO SPECIFY THE ITERATE ID AS THE NAME --% html:select name=row property=category html:option value=ARTArt/html:option html:option value=AUTAutomotive/html:option %-- ... --% /html:select %-- REMEMBER TO SPECIFY THE ITERATE ID AS THE NAME --% html:hidden name=row property=key/ /TD /TR /logic:iterate TR TD colspan=2 align=right html:submit/ /TD /TR /html:form /TABLE --- - = Nathan Pitts Programmer Analyst Texas Animal Health Commission = - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to repopulate Form which has html elements with samename
Let me rephrase my question. I have a table which looks like this.. example table width=300 border=0 cellspacing=1 cellpadding=1 tr thName/th thSex/th /tr tr tdhtml:text property=name //td tdhtml:select property=sex html:option value=nbsp;/html:option html:option value=M Male/html:option html:option value=F Female/html:option /html:select /td /tr tr tdhtml:text property=name //td tdhtml:select property=sex html:option value=nbsp;/html:option html:option value=nbsp;/html:option html:option value=M Male/html:option html:option value=F Female/html:option /html:select /td /tr /table So when I add data like Sashi Male Sushma FEMALE now I submit the form, and say there are some validation errors how can I build the table with the above values retrieving from the Form Bean .My form bean has the following methods public String[] getName(){ return name; } public void setName(String[] newName){ name = newName; } public String[] getSex(){ return sex; } public void setSex(String[] newSex){ sex = newSex; } The values are getting stored in the array, but to get them back and build my table is what is not clear to me.. logic:iterate may do the job but how to use it?? Hope I am clear now [EMAIL PROTECTED] 06/05/03 11:30AM Sounds like you might be missing input=theform.jsp in your action where theform.jsp is the name of your JSP you want to have come back with the errors. Also, have html:errors/ in the JSP to report the errors (just as important (more) than repopulating). If this doesn't help find a better (for you) online struts tutorial. What you are trying to do is a freebie in struts (if everything is setup right). -Original Message- From: Sashi Ravipati [mailto:[EMAIL PROTECTED] Sent: Thursday, June 05, 2003 10:59 AM To: [EMAIL PROTECTED] Subject: How to repopulate Form which has html elements with same name Hi I am a newbie to struts... I have a dynamic table which has a html:text and a html:select . The user cliks on a add button and enter values in each row of the table and submits the form. How can I repopulate the valuse if validation fails. Can some body give a working exapmle of the Action Form that is required for this kind of requirement. I found this in Ted Husted site but had no clue as what he is trying to do, What is RESULT etc --- TABLEhtml:form action=/item/StoreCategory logic:iterate name=RESULT property=iterator id=row TR THname/TH THcategory/TH /TR TR TDbean:write name=row property=name//TD TD%-- REMEMBER TO SPECIFY THE ITERATE ID AS THE NAME --% html:select name=row property=category html:option value=ARTArt/html:option html:option value=AUTAutomotive/html:option %-- ... --% /html:select %-- REMEMBER TO SPECIFY THE ITERATE ID AS THE NAME --% html:hidden name=row property=key/ /TD /TR /logic:iterate TR TD colspan=2 align=right html:submit/ /TD /TR /html:form /TABLE - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to repopulate Form which has html elements with samename
Repopulating Fields. I keep hearing that this is a freebie in struts but i have note seen it work on my app yet. i just stuff what i want to repopulate with in the session (for now). It would be nice if someone could post what setup write IS. so we can check if we have something set up WRONG. After all, WSAD 5 came with struts preloaded so how can it be setup wrong? Sashi Ravipati [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Let me rephrase my question. I have a table which looks like this.. example table width=300 border=0 cellspacing=1 cellpadding=1 tr thName/th thSex/th /tr tr tdhtml:text property=name //td tdhtml:select property=sex html:option value=nbsp;/html:option html:option value=M Male/html:option html:option value=F Female/html:option /html:select /td /tr tr tdhtml:text property=name //td tdhtml:select property=sex html:option value=nbsp;/html:option html:option value=nbsp;/html:option html:option value=M Male/html:option html:option value=F Female/html:option /html:select /td /tr /table So when I add data like Sashi Male Sushma FEMALE now I submit the form, and say there are some validation errors how can I build the table with the above values retrieving from the Form Bean .My form bean has the following methods public String[] getName(){ return name; } public void setName(String[] newName){ name = newName; } public String[] getSex(){ return sex; } public void setSex(String[] newSex){ sex = newSex; } The values are getting stored in the array, but to get them back and build my table is what is not clear to me.. logic:iterate may do the job but how to use it?? Hope I am clear now [EMAIL PROTECTED] 06/05/03 11:30AM Sounds like you might be missing input=theform.jsp in your action where theform.jsp is the name of your JSP you want to have come back with the errors. Also, have html:errors/ in the JSP to report the errors (just as important (more) than repopulating). If this doesn't help find a better (for you) online struts tutorial. What you are trying to do is a freebie in struts (if everything is setup right). -Original Message- From: Sashi Ravipati [mailto:[EMAIL PROTECTED] Sent: Thursday, June 05, 2003 10:59 AM To: [EMAIL PROTECTED] Subject: How to repopulate Form which has html elements with same name Hi I am a newbie to struts... I have a dynamic table which has a html:text and a html:select . The user cliks on a add button and enter values in each row of the table and submits the form. How can I repopulate the valuse if validation fails. Can some body give a working exapmle of the Action Form that is required for this kind of requirement. I found this in Ted Husted site but had no clue as what he is trying to do, What is RESULT etc -- -- --- TABLEhtml:form action=/item/StoreCategory logic:iterate name=RESULT property=iterator id=row TR THname/TH THcategory/TH /TR TR TDbean:write name=row property=name//TD TD%-- REMEMBER TO SPECIFY THE ITERATE ID AS THE NAME --% html:select name=row property=category html:option value=ARTArt/html:option html:option value=AUTAutomotive/html:option %-- ... --% /html:select %-- REMEMBER TO SPECIFY THE ITERATE ID AS THE NAME --% html:hidden name=row property=key/ /TD /TR /logic:iterate TR TD colspan=2 align=right html:submit/ /TD /TR /html:form /TABLE -- -- - - 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 repopulate Form which has html elements with samename
Repopulation IS a freebie. The examples that come with struts are right (generally). The first thing to do is understand every tag in the examples' struts-config.xml. Easier said than done, but maybe this will help: http://www.mail-archive.com/[EMAIL PROTECTED]/msg01060.html In any case, you do not need to 'rebuild' a form, simply forward back to the .jsp page where the error happened. If the 'input' parameter of the action is set, this should happen automatically if validation is on. -Kevin --- sjones [EMAIL PROTECTED] wrote: Repopulating Fields. I keep hearing that this is a freebie in struts but i have note seen it work on my app yet. i just stuff what i want to repopulate with in the session (for now). It would be nice if someone could post what setup write IS. so we can check if we have something set up WRONG. After all, WSAD 5 came with struts preloaded so how can it be setup wrong? Sashi Ravipati [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Let me rephrase my question. I have a table which looks like this.. example table width=300 border=0 cellspacing=1 cellpadding=1 tr thName/th thSex/th /tr tr tdhtml:text property=name //td tdhtml:select property=sex html:option value=nbsp;/html:option html:option value=M Male/html:option html:option value=F Female/html:option /html:select /td /tr tr tdhtml:text property=name //td tdhtml:select property=sex html:option value=nbsp;/html:option html:option value=nbsp;/html:option html:option value=M Male/html:option html:option value=F Female/html:option /html:select /td /tr /table So when I add data like Sashi Male Sushma FEMALE now I submit the form, and say there are some validation errors how can I build the table with the above values retrieving from the Form Bean .My form bean has the following methods public String[] getName(){ return name; } public void setName(String[] newName){ name = newName; } public String[] getSex(){ return sex; } public void setSex(String[] newSex){ sex = newSex; } The values are getting stored in the array, but to get them back and build my table is what is not clear to me.. logic:iterate may do the job but how to use it?? Hope I am clear now [EMAIL PROTECTED] 06/05/03 11:30AM Sounds like you might be missing input=theform.jsp in your action where theform.jsp is the name of your JSP you want to have come back with the errors. Also, have html:errors/ in the JSP to report the errors (just as important (more) than repopulating). If this doesn't help find a better (for you) online struts tutorial. What you are trying to do is a freebie in struts (if everything is setup right). -Original Message- From: Sashi Ravipati [mailto:[EMAIL PROTECTED] Sent: Thursday, June 05, 2003 10:59 AM To: [EMAIL PROTECTED] Subject: How to repopulate Form which has html elements with same name Hi I am a newbie to struts... I have a dynamic table which has a html:text and a html:select . The user cliks on a add button and enter values in each row of the table and submits the form. How can I repopulate the valuse if validation fails. Can some body give a working exapmle of the Action Form that is required for this kind of requirement. I found this in Ted Husted site but had no clue as what he is trying to do, What is RESULT etc -- -- --- TABLEhtml:form action=/item/StoreCategory logic:iterate name=RESULT property=iterator id=row TR THname/TH THcategory/TH /TR TR TDbean:write name=row property=name//TD TD%-- REMEMBER TO SPECIFY THE ITERATE ID AS THE NAME --% html:select name=row property=category html:option value=ARTArt/html:option html:option value=AUTAutomotive/html:option %-- ... --% /html:select %-- REMEMBER TO SPECIFY THE ITERATE ID AS THE NAME --% html:hidden name=row property=key/ /TD /TR /logic:iterate TR TD colspan=2 align=right html:submit/ /TD /TR /html:form /TABLE -- -- - - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to repopulate Form which has html elements with samename
The 5 things I can think a newbie would do so validation doesn't work: 1. no tld for struts html at the top of the JSP or not using html:text 2. no input=thejsp in the action mapping 3. validation isn't implemented right (or set to false or something) 4. Incorrect form bean type (especially if using struts validator) or no bean 5. Likes to annoy others just for fun I can't think of any other pitfalls. -Original Message- From: Kevin Robair [mailto:[EMAIL PROTECTED] Sent: Thursday, June 05, 2003 5:06 PM To: Struts Users Mailing List Subject: Re: How to repopulate Form which has html elements with samename Repopulation IS a freebie. The examples that come with struts are right (generally). The first thing to do is understand every tag in the examples' struts-config.xml. Easier said than done, but maybe this will help: http://www.mail-archive.com/[EMAIL PROTECTED]/msg01060.html In any case, you do not need to 'rebuild' a form, simply forward back to the .jsp page where the error happened. If the 'input' parameter of the action is set, this should happen automatically if validation is on. -Kevin --- sjones [EMAIL PROTECTED] wrote: Repopulating Fields. I keep hearing that this is a freebie in struts but i have note seen it work on my app yet. i just stuff what i want to repopulate with in the session (for now). It would be nice if someone could post what setup write IS. so we can check if we have something set up WRONG. After all, WSAD 5 came with struts preloaded so how can it be setup wrong? Sashi Ravipati [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Let me rephrase my question. I have a table which looks like this.. example table width=300 border=0 cellspacing=1 cellpadding=1 tr thName/th thSex/th /tr tr tdhtml:text property=name //td tdhtml:select property=sex html:option value=nbsp;/html:option html:option value=M Male/html:option html:option value=F Female/html:option /html:select /td /tr tr tdhtml:text property=name //td tdhtml:select property=sex html:option value=nbsp;/html:option html:option value=nbsp;/html:option html:option value=M Male/html:option html:option value=F Female/html:option /html:select /td /tr /table So when I add data like Sashi Male Sushma FEMALE now I submit the form, and say there are some validation errors how can I build the table with the above values retrieving from the Form Bean .My form bean has the following methods public String[] getName(){ return name; } public void setName(String[] newName){ name = newName; } public String[] getSex(){ return sex; } public void setSex(String[] newSex){ sex = newSex; } The values are getting stored in the array, but to get them back and build my table is what is not clear to me.. logic:iterate may do the job but how to use it?? Hope I am clear now [EMAIL PROTECTED] 06/05/03 11:30AM Sounds like you might be missing input=theform.jsp in your action where theform.jsp is the name of your JSP you want to have come back with the errors. Also, have html:errors/ in the JSP to report the errors (just as important (more) than repopulating). If this doesn't help find a better (for you) online struts tutorial. What you are trying to do is a freebie in struts (if everything is setup right). -Original Message- From: Sashi Ravipati [mailto:[EMAIL PROTECTED] Sent: Thursday, June 05, 2003 10:59 AM To: [EMAIL PROTECTED] Subject: How to repopulate Form which has html elements with same name Hi I am a newbie to struts... I have a dynamic table which has a html:text and a html:select . The user cliks on a add button and enter values in each row of the table and submits the form. How can I repopulate the valuse if validation fails. Can some body give a working exapmle of the Action Form that is required for this kind of requirement. I found this in Ted Husted site but had no clue as what he is trying to do, What is RESULT etc -- -- --- TABLEhtml:form action=/item/StoreCategory logic:iterate name=RESULT property=iterator id=row TR THname/TH THcategory/TH /TR TR TDbean:write name=row property=name//TD TD%-- REMEMBER TO SPECIFY THE ITERATE ID AS THE NAME --% html:select name=row property=category html:option value=ARTArt/html:option html:option value=AUTAutomotive/html:option %-- ... --% /html:select %-- REMEMBER TO SPECIFY THE ITERATE ID AS THE NAME --% html:hidden name=row property=key/ /TD /TR /logic:iterate TR TD colspan=2 align=right html:submit/ /TD /TR /html:form /TABLE
RE: How to repopulate Form which has html elements with samename
I have one more: Validation errors kept returning me to a blank page. Turns out, in my struts-config (borrowed from a Struts book, so I deserved it!) I had, way down at the bottom: controller !-- The input parameter on action elements is the name of a local or global forward rather than a subapp-relative path -- set-property property=inputForward value=true / /controller but my input tag was input=/errorpage.jsp Had to look through the struts examples until I found one that used inputForward names instead of paths. Then I saw my problem. -Kevin --- Bailey, Shane C. [EMAIL PROTECTED] wrote: The 5 things I can think a newbie would do so validation doesn't work: 1. no tld for struts html at the top of the JSP or not using html:text 2. no input=thejsp in the action mapping 3. validation isn't implemented right (or set to false or something) 4. Incorrect form bean type (especially if using struts validator) or no bean 5. Likes to annoy others just for fun I can't think of any other pitfalls. -Original Message- From: Kevin Robair [mailto:[EMAIL PROTECTED] Sent: Thursday, June 05, 2003 5:06 PM To: Struts Users Mailing List Subject: Re: How to repopulate Form which has html elements with samename Repopulation IS a freebie. The examples that come with struts are right (generally). The first thing to do is understand every tag in the examples' struts-config.xml. Easier said than done, but maybe this will help: http://www.mail-archive.com/[EMAIL PROTECTED]/msg01060.html In any case, you do not need to 'rebuild' a form, simply forward back to the .jsp page where the error happened. If the 'input' parameter of the action is set, this should happen automatically if validation is on. -Kevin --- sjones [EMAIL PROTECTED] wrote: Repopulating Fields. I keep hearing that this is a freebie in struts but i have note seen it work on my app yet. i just stuff what i want to repopulate with in the session (for now). It would be nice if someone could post what setup write IS. so we can check if we have something set up WRONG. After all, WSAD 5 came with struts preloaded so how can it be setup wrong? Sashi Ravipati [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Let me rephrase my question. I have a table which looks like this.. example table width=300 border=0 cellspacing=1 cellpadding=1 tr thName/th thSex/th /tr tr tdhtml:text property=name //td tdhtml:select property=sex html:option value=nbsp;/html:option html:option value=M Male/html:option html:option value=F Female/html:option /html:select /td /tr tr tdhtml:text property=name //td tdhtml:select property=sex html:option value=nbsp;/html:option html:option value=nbsp;/html:option html:option value=M Male/html:option html:option value=F Female/html:option /html:select /td /tr /table So when I add data like Sashi Male Sushma FEMALE now I submit the form, and say there are some validation errors how can I build the table with the above values retrieving from the Form Bean .My form bean has the following methods public String[] getName(){ return name; } public void setName(String[] newName){ name = newName; } public String[] getSex(){ return sex; } public void setSex(String[] newSex){ sex = newSex; } The values are getting stored in the array, but to get them back and build my table is what is not clear to me.. logic:iterate may do the job but how to use it?? Hope I am clear now [EMAIL PROTECTED] 06/05/03 11:30AM Sounds like you might be missing input=theform.jsp in your action where theform.jsp is the name of your JSP you want to have come back with the errors. Also, have html:errors/ in the JSP to report the errors (just as important (more) than repopulating). If this doesn't help find a better (for you) online struts tutorial. What you are trying to do is a freebie in struts (if everything is setup right). -Original Message- From: Sashi Ravipati [mailto:[EMAIL PROTECTED] Sent: Thursday, June 05, 2003 10:59 AM To: [EMAIL PROTECTED] Subject: How to repopulate Form which has html elements with same name Hi I am a newbie to struts... I have a dynamic table which has a html:text and a html:select . The user cliks on a add button and enter values in each row of the table and submits the form. How can I repopulate the valuse if validation fails. Can some body give a working exapmle of the Action Form that is required for this kind of requirement. I found this in Ted Husted site but had no clue