Re: html:options / help?
Hi, U can do like this, html:select name=division property=teamRef html:optionsCollection name=division property=allTeams value=teamRef label=teamName/ /html:select Division is a form bean. allTeams is the vector which contains the objects. Vector contains team objects which has teamRef and teamName properties. division form bean also contains a property for teamRef. html:select name=division property=teamRef So when this teamRef is equal to teamRef of one of the team objects in vector it will be selected. Chamal. --- Mallik [EMAIL PROTECTED] wrote: Hi friends this is a modifying details page. i have a select box,that will populate with databases values. i used html:options collection= property= labelProperty=/. till now everything ok. but one of these options should select automatically when the page displayed that value is in formBean. how can i do this help pease ur's Mallik -- View this message in context: http://www.nabble.com/%3Chtml%3Aoptions--%3E-help--tf2667275.html#a7438109 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Sponsored Link Mortgage rates near 39yr lows. $510k for $1,698/mo. Calculate new payment! www.LowerMyBills.com/lre - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options / help?
Hi friend thankyou i got it thankyou very much ur's Mallik chamalsl wrote: Hi, U can do like this, html:select name=division property=teamRef html:optionsCollection name=division property=allTeams value=teamRef label=teamName/ /html:select Division is a form bean. allTeams is the vector which contains the objects. Vector contains team objects which has teamRef and teamName properties. division form bean also contains a property for teamRef. html:select name=division property=teamRef So when this teamRef is equal to teamRef of one of the team objects in vector it will be selected. Chamal. --- Mallik [EMAIL PROTECTED] wrote: Hi friends this is a modifying details page. i have a select box,that will populate with databases values. i used html:options collection= property= labelProperty=/. till now everything ok. but one of these options should select automatically when the page displayed that value is in formBean. how can i do this help pease ur's Mallik -- View this message in context: http://www.nabble.com/%3Chtml%3Aoptions--%3E-help--tf2667275.html#a7438109 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Sponsored Link Mortgage rates near 39yr lows. $510k for $1,698/mo. Calculate new payment! www.LowerMyBills.com/lre - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/%3Chtml%3Aoptions--%3E-help--tf2667275.html#a7466026 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
html:options / help?
Hi friends this is a modifying details page. i have a select box,that will populate with databases values. i used html:options collection= property= labelProperty=/. till now everything ok. but one of these options should select automatically when the page displayed that value is in formBean. how can i do this help pease ur's Mallik -- View this message in context: http://www.nabble.com/%3Chtml%3Aoptions--%3E-help--tf2667275.html#a7438109 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
html:options selected
Hi. I am trying to get html:select to work for my purpose. Can anybody help me.. c_stand is a String value from PeopleBean in request.getAttribute(people); cs is a collection containing values in OptionValueBean. If cs contains values test1, test2 and test3 and c_stand contains test2 I want test2 to be selected in the html:select Is that possible? logic:iterate id=element name=people bean:define name=element id=c_stand property=c_stand / html:select property=c_stand html:options collection=cs property=value labelProperty=option/ /html:select /logic:iterate
RE: html:options selected
Yes u can...just set the value of c_stand to value test2 in action class.. where u load this page...then it shud work.. Regards, Mano -Original Message- From: Søren Blidorf [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 15, 2006 4:27 PM To: Struts Users Mailing List Subject: html:options selected Hi. I am trying to get html:select to work for my purpose. Can anybody help me.. c_stand is a String value from PeopleBean in request.getAttribute(people); cs is a collection containing values in OptionValueBean. If cs contains values test1, test2 and test3 and c_stand contains test2 I want test2 to be selected in the html:select Is that possible? logic:iterate id=element name=people bean:define name=element id=c_stand property=c_stand / html:select property=c_stand html:options collection=cs property=value labelProperty=option/ /html:select /logic:iterate - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
SV: html:options selected
Hi Mano. Thanks for your help Could you explain it again. I am not sure I understand... C_stand already has the value of test2, and still it is not selected. -Oprindelig meddelelse- Fra: Mano Chinthaka Dasanayaka [mailto:[EMAIL PROTECTED] Sendt: 15. november 2006 12:18 Til: 'Struts Users Mailing List' Emne: RE: html:options selected Yes u can...just set the value of c_stand to value test2 in action class.. where u load this page...then it shud work.. Regards, Mano -Original Message- From: Søren Blidorf [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 15, 2006 4:27 PM To: Struts Users Mailing List Subject: html:options selected Hi. I am trying to get html:select to work for my purpose. Can anybody help me.. c_stand is a String value from PeopleBean in request.getAttribute(people); cs is a collection containing values in OptionValueBean. If cs contains values test1, test2 and test3 and c_stand contains test2 I want test2 to be selected in the html:select Is that possible? logic:iterate id=element name=people bean:define name=element id=c_stand property=c_stand / html:select property=c_stand html:options collection=cs property=value labelProperty=option/ /html:select /logic:iterate - 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: html:options selected
You can do it like this : html:select name=someForm property=someProperty option value=-1bean:message key=test2//option html:optionsCollection filter=false name=someForm property=cs value=sequenceType label=sequenceType/ /html:select Where cs is your list of values. The above will make the test2 as the first option in the list, which is selected by default. -Original Message- From: Søren Blidorf [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 15, 2006 12:57 PM To: Struts Users Mailing List Subject: html:options selected Hi. I am trying to get html:select to work for my purpose. Can anybody help me.. c_stand is a String value from PeopleBean in request.getAttribute(people); cs is a collection containing values in OptionValueBean. If cs contains values test1, test2 and test3 and c_stand contains test2 I want test2 to be selected in the html:select Is that possible? logic:iterate id=element name=people bean:define name=element id=c_stand property=c_stand / html:select property=c_stand html:options collection=cs property=value labelProperty=option/ /html:select /logic:iterate - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:options selected
Hi Søren, logic:iterate id=element name=people bean:define name=element id=c_stand property=c_stand / html:select property=c_stand value=c_stand html:options collection=cs property=value labelProperty=option/ /html:select /logic:iterate Should work, note the added: value=c_stand in the html:select For additional info, see: http://struts.apache.org/1.x/struts-taglib/tlddoc/html/select.html Or for 2.x: http://struts.apache.org/WW/select.html Regards Thor -Original Message- From: Søren Blidorf [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 15, 2006 12:24 PM To: 'Struts Users Mailing List' Subject: SV: html:options selected Hi Mano. Thanks for your help Could you explain it again. I am not sure I understand... C_stand already has the value of test2, and still it is not selected. -Oprindelig meddelelse- Fra: Mano Chinthaka Dasanayaka [mailto:[EMAIL PROTECTED] Sendt: 15. november 2006 12:18 Til: 'Struts Users Mailing List' Emne: RE: html:options selected Yes u can...just set the value of c_stand to value test2 in action class.. where u load this page...then it shud work.. Regards, Mano -Original Message- From: Søren Blidorf [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 15, 2006 4:27 PM To: Struts Users Mailing List Subject: html:options selected Hi. I am trying to get html:select to work for my purpose. Can anybody help me.. c_stand is a String value from PeopleBean in request.getAttribute(people); cs is a collection containing values in OptionValueBean. If cs contains values test1, test2 and test3 and c_stand contains test2 I want test2 to be selected in the html:select Is that possible? logic:iterate id=element name=people bean:define name=element id=c_stand property=c_stand / html:select property=c_stand html:options collection=cs property=value labelProperty=option/ /html:select /logic:iterate - 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]
Facing Problem using html:select with html:options
Hi All: I have a JSP Form in which one field is a multi-select drop-down box. An array of String is used to represent it I am facing this problem when trying to Edit stuff. The Drop-down initially has many different values selected. If I try to change selections everything is Fine. Irrespective of if I increase the number of selections or decrease them as long as I select at least one. However, if I try to deselect all then the Original Selected Values remain as it is and are passed to the Form. The only Solution - which is a Workaround is that the User selects the dummy Item Choose Hotel Name which has a value of 0. The following is my drop-dwon Code in the JSP Page. html:select name=subregionForm property=holidexCodes multiple=true size=4 html:option value=0 Choose Hotel Name /html:option html:options name=holidexCodeVector / /html:select Is this a known bug in IE. Thanks. Chetan
Re: Facing Problem using html:select with html:options
In HTML, only the selected values get sent to the server, so when no values in the multi-select are selected, nothing gets sent to the server for that property. Make sure your reset() method clears out the values for that property and you should be ok. (*Chris*) On 10/25/06, Chetan Pandey [EMAIL PROTECTED] wrote: Hi All: I have a JSP Form in which one field is a multi-select drop-down box. An array of String is used to represent it I am facing this problem when trying to Edit stuff. The Drop-down initially has many different values selected. If I try to change selections everything is Fine. Irrespective of if I increase the number of selections or decrease them as long as I select at least one. However, if I try to deselect all then the Original Selected Values remain as it is and are passed to the Form. The only Solution - which is a Workaround is that the User selects the dummy Item Choose Hotel Name which has a value of 0. The following is my drop-dwon Code in the JSP Page. html:select name=subregionForm property=holidexCodes multiple=true size=4 html:option value=0 Choose Hotel Name /html:option html:options name=holidexCodeVector / /html:select Is this a known bug in IE. Thanks. Chetan
problem in html:options
Hi, iam using struts with tmocat 5. my struts-cofig.xml is like this one action path=/user type=com.ufnasoft.cms.processaction.ProcessUser name=createFolder scope=request forward name=success path=/users/newuser.jsp/ /action and form bean tag is form-bean name=createFolder type=com.ufnasoft.cms.CreateFolderForm/ Action class is as following: CreateFolderForm folders = (CreateFolderForm) form; File dir = new File(../users); ArrayList dirList=new java.util.ArrayList(); String[] subdir = dir.list(); if (subdir == null) { // Either dir does not exist or is not a directory System.out.println(Either dir does not exist or is not a directory); } else { System.out.println(Gotcha!!); for(int i=0; isubdir.length; i++) { folders.setFolder(subdir); dirList.add(subdir); } } request.setAttribute(dirList, dirList); return mapping.findForward(success); and ActionForm is String folder; String newFolder; /** * @return Returns the newFolder. */ public String getNewFolder() { return newFolder; } /** * @param newFolder The newFolder to set. */ public void setNewFolder(String newFolder) { this.newFolder = newFolder; } /** * @return Returns the folder. */ public String getFolder() { return folder; } /** * @param folder The folder to set. */ public void setFolder(String folder) { this.folder = folder; } from here problem starts, in my jsp file i try to get the values in select tag as html:select property=folder html:options name=dirList/ /html:select but i get the error, as following 2006-10-06 15:42:49 StandardWrapperValve[action]: Servlet.service() for servlet action threw exception javax.servlet.jsp.JspException: No getter method available for property folder for bean under name org.apache.struts.taglib.html.BEAN at org.apache.struts.taglib.html.SelectTag.calculateMatchValues(SelectTag.java:285) at org.apache.struts.taglib.html.SelectTag.doStartTag(SelectTag.java:202) at org.apache.jsp.users.newuser_jsp._jspx_meth_html_select_0(newuser_jsp.java:177) at org.apache.jsp.users.newuser_jsp._jspx_meth_html_form_0(newuser_jsp.java:144) at org.apache.jsp.users.newuser_jsp._jspx_meth_html_html_0(newuser_jsp.java:109) at org.apache.jsp.users.newuser_jsp._jspService(newuser_jsp.java:74) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:704) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:474) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:409) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056) at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:261) at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:388) at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:316) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) plz help me to get out of this -- View this message in context: http://www.nabble.com/problem-in-%3Chtml%3Aoptions%3E-tf2394751.html#a6677038 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: problem in html:options
On 10/6/06, Jay [EMAIL PROTECTED] wrote: Hi, iam using struts with tmocat 5. my struts-cofig.xml is like this one action path=/user type=com.ufnasoft.cms.processaction.ProcessUser name=createFolder scope=request forward name=success path=/users/newuser.jsp/ /action and form bean tag is form-bean name=createFolder type=com.ufnasoft.cms.CreateFolderForm/ Action class is as following: CreateFolderForm folders = (CreateFolderForm) form; File dir = new File(../users); ArrayList dirList=new java.util.ArrayList(); String[] subdir = dir.list(); if (subdir == null) { // Either dir does not exist or is not a directory System.out.println(Either dir does not exist or is not a directory); } else { System.out.println(Gotcha!!); for(int i=0; isubdir.length; i++) { folders.setFolder(subdir); dirList.add(subdir); } } request.setAttribute(dirList, dirList); return mapping.findForward(success); and ActionForm is String folder; String newFolder; /** * @return Returns the newFolder. */ public String getNewFolder() { return newFolder; } /** * @param newFolder The newFolder to set. */ public void setNewFolder(String newFolder) { this.newFolder = newFolder; } /** * @return Returns the folder. */ public String getFolder() { return folder; } /** * @param folder The folder to set. */ public void setFolder(String folder) { this.folder = folder; } from here problem starts, in my jsp file i try to get the values in select tag as html:select property=folder The above line is what is causing the problem. Its not able to find a getter method for this folder property. Check whether you have the proper action in your html:form tag. html:options name=dirList/ /html:select but i get the error, as following 2006-10-06 15:42:49 StandardWrapperValve[action]: Servlet.service() for servlet action threw exception javax.servlet.jsp.JspException: No getter method available for property folder for bean under name org.apache.struts.taglib.html.BEAN at org.apache.struts.taglib.html.SelectTag.calculateMatchValues( SelectTag.java:285) at org.apache.struts.taglib.html.SelectTag.doStartTag(SelectTag.java:202) at org.apache.jsp.users.newuser_jsp._jspx_meth_html_select_0 (newuser_jsp.java:177) at org.apache.jsp.users.newuser_jsp._jspx_meth_html_form_0 (newuser_jsp.java:144) at org.apache.jsp.users.newuser_jsp._jspx_meth_html_html_0 (newuser_jsp.java:109) at org.apache.jsp.users.newuser_jsp._jspService(newuser_jsp.java:74) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java :324) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java :292) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter( ApplicationFilterChain.java:157) at org.apache.catalina.core.ApplicationDispatcher.invoke( ApplicationDispatcher.java:704) at org.apache.catalina.core.ApplicationDispatcher.processRequest( ApplicationDispatcher.java:474) at org.apache.catalina.core.ApplicationDispatcher.doForward( ApplicationDispatcher.java:409) at org.apache.catalina.core.ApplicationDispatcher.forward( ApplicationDispatcher.java:312) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java :1056) at org.apache.struts.tiles.TilesRequestProcessor.doForward( TilesRequestProcessor.java:261) at org.apache.struts.action.RequestProcessor.processForwardConfig( RequestProcessor.java:388) at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig( TilesRequestProcessor.java:316) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java :231) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) plz help me to get out of this -- View this message in context: http://www.nabble.com/problem-in-%3Chtml%3Aoptions%3E-tf2394751.html#a6677038 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Puneet
Re: problem in html:options
Thanks alot, it solved my problem Jay Puneet Lakhina wrote: On 10/6/06, Jay [EMAIL PROTECTED] wrote: Hi, iam using struts with tmocat 5. my struts-cofig.xml is like this one action path=/user type=com.ufnasoft.cms.processaction.ProcessUser name=createFolder scope=request forward name=success path=/users/newuser.jsp/ /action and form bean tag is form-bean name=createFolder type=com.ufnasoft.cms.CreateFolderForm/ Action class is as following: CreateFolderForm folders = (CreateFolderForm) form; File dir = new File(../users); ArrayList dirList=new java.util.ArrayList(); String[] subdir = dir.list(); if (subdir == null) { // Either dir does not exist or is not a directory System.out.println(Either dir does not exist or is not a directory); } else { System.out.println(Gotcha!!); for(int i=0; isubdir.length; i++) { folders.setFolder(subdir); dirList.add(subdir); } } request.setAttribute(dirList, dirList); return mapping.findForward(success); and ActionForm is String folder; String newFolder; /** * @return Returns the newFolder. */ public String getNewFolder() { return newFolder; } /** * @param newFolder The newFolder to set. */ public void setNewFolder(String newFolder) { this.newFolder = newFolder; } /** * @return Returns the folder. */ public String getFolder() { return folder; } /** * @param folder The folder to set. */ public void setFolder(String folder) { this.folder = folder; } from here problem starts, in my jsp file i try to get the values in select tag as html:select property=folder The above line is what is causing the problem. Its not able to find a getter method for this folder property. Check whether you have the proper action in your html:form tag. html:options name=dirList/ /html:select but i get the error, as following 2006-10-06 15:42:49 StandardWrapperValve[action]: Servlet.service() for servlet action threw exception javax.servlet.jsp.JspException: No getter method available for property folder for bean under name org.apache.struts.taglib.html.BEAN at org.apache.struts.taglib.html.SelectTag.calculateMatchValues( SelectTag.java:285) at org.apache.struts.taglib.html.SelectTag.doStartTag(SelectTag.java:202) at org.apache.jsp.users.newuser_jsp._jspx_meth_html_select_0 (newuser_jsp.java:177) at org.apache.jsp.users.newuser_jsp._jspx_meth_html_form_0 (newuser_jsp.java:144) at org.apache.jsp.users.newuser_jsp._jspx_meth_html_html_0 (newuser_jsp.java:109) at org.apache.jsp.users.newuser_jsp._jspService(newuser_jsp.java:74) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java :324) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java :292) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter( ApplicationFilterChain.java:157) at org.apache.catalina.core.ApplicationDispatcher.invoke( ApplicationDispatcher.java:704) at org.apache.catalina.core.ApplicationDispatcher.processRequest( ApplicationDispatcher.java:474) at org.apache.catalina.core.ApplicationDispatcher.doForward( ApplicationDispatcher.java:409) at org.apache.catalina.core.ApplicationDispatcher.forward( ApplicationDispatcher.java:312) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java :1056) at org.apache.struts.tiles.TilesRequestProcessor.doForward( TilesRequestProcessor.java:261) at org.apache.struts.action.RequestProcessor.processForwardConfig( RequestProcessor.java:388) at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig( TilesRequestProcessor.java:316) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java :231) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) plz help me to get out of this -- View this message in context: http://www.nabble.com/problem-in-%3Chtml%3Aoptions%3E-tf2394751.html#a6677038 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Puneet -- View this message in context: http://www.nabble.com/problem-in-%3Chtml%3Aoptions%3E-tf2394751.html#a6679971 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
Re: html:options Hashtable
Hi, I think you can, according to the html:options tag code it is possible, but i havent tried it, give it a try. Thanks, Nuwna On 9/4/06, chamal desilva [EMAIL PROTECTED] wrote: Hi, Can we display the values of a hashtable in a html drop down menu using struts tags. Thanking You, Chamal. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
html:options Hashtable
Hi, Can we display the values of a hashtable in a html drop down menu using struts tags. Thanking You, Chamal. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
re: reŁş html:options collection design question
Hi! That is fine if i want to set bgcolor to ALL text, but i want to set different bgcolor for different choices in drop down menu. Tnx, Stanislav - Original Message Follows - maybe css would be one solution, edit your css class, and use styleClass attribute to ref it options ... ... styleClass=.mycssclass / Stanislav [EMAIL PROTECTED] Đ´ľŔŁş Hi! I want to set background color in drop down menu that is generated with html:options collection. Is there any way to do that? Here is code sample: Tnx, Stanislav - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - ŃĹť˘ĂâˇŃÓĘĎä-3.5GČÝÁżŁŹ20M¸˝źţ ŃĹť˘ÖúĘÖ-ËŃË÷Ą˘ÉąśžĄ˘ˇŔɧČĹ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
re: re: re: html:options collection design question
I am not sure if there's better idea than writing your own JavaScript to do that.. Stanislav [EMAIL PROTECTED] : Hi! That is fine if i want to set bgcolor to ALL text, but i want to set different bgcolor for different choices in drop down menu. Tnx, Stanislav - Original Message Follows - maybe css would be one solution, edit your css class, and use styleClass attribute to ref it Stanislav 写道: Hi! I want to set background color in drop down menu that is generated with html:options collection. Is there any way to do that? Here is code sample: Tnx, Stanislav - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - 雅虎免费邮箱-3.5G容量,20M附件 雅虎助手-搜索、杀毒、防骚扰 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - 抢注雅虎免费邮箱-3.5G容量,20M附件!
html:options collection design question
Hi! I want to set background color in drop down menu that is generated with html:options collection. Is there any way to do that? Here is code sample: html:select property=id styleClass=Podaci html:options collection=hmUserList property=user-1-0 labelProperty=user-2-0/ /html:select Tnx, Stanislav - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
re: html:options collection design question
maybe css would be one solution, edit your css class, and use styleClass attribute to ref it options ... ... styleClass=.mycssclass / Stanislav [EMAIL PROTECTED] 写道: Hi! I want to set background color in drop down menu that is generated with html:options collection. Is there any way to do that? Here is code sample: Tnx, Stanislav - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - 雅虎免费邮箱-3.5G容量,20M附件 雅虎助手-搜索、杀毒、防骚扰
ArrayList html:options
Everyone, I am trying to use the htm-el:options tag to write out the value of a Select box. I am using an ArrayList of Strings that I am trying to iterate over. I want the value and option to be the same on the output. Here is how I am calling my code... Action: request.setAttribute( exportDates, exportDates ); //exportDates = ArrayListString JSP: html-el:select property=exportDate html-el:options collection=${exportDates} / /html-el:select Error: 15:38:53,106 ERROR [action]:253 - Servlet.service() for servlet action threw exception javax.servlet.jsp.JspException: ServletException in '/jsp/templates/tab_content_template.jsp': ServletException in '/jsp/fine_export.jsp': Cannot find bean under name [04/17/2006, 04/16/2006] at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTa g.java:923) at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:462) at org.apache.jsp.jsp.templates.main_005ftemplate_jsp._jspx_meth_tiles_inse rt_1(org.apache.jsp.jsp.templates.main_005ftemplate_jsp:160) at org.apache.jsp.jsp.templates.main_005ftemplate_jsp._jspService(org.apach e.jsp.jsp.templates.main_005ftemplate_jsp:88) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) Any ideas would be greatly appreciated. Thanks. Daniel
Re: ArrayList html:options
On 4/17/06, Kalcevich, Daniel [EMAIL PROTECTED] wrote: request.setAttribute( exportDates, exportDates ); //exportDates = ArrayListString JSP: html-el:select property=exportDate html-el:options collection=${exportDates} / /html-el:select Error: 15:38:53,106 ERROR [action]:253 - Servlet.service() for servlet action threw exception javax.servlet.jsp.JspException: ServletException in '/jsp/templates/tab_content_template.jsp': ServletException in '/jsp/fine_export.jsp': Cannot find bean under name [04/17/2006, 04/16/2006] You don't need the expression in the 'collection' attribute. It wants the _name_ of the bean. You can see from the error message that the String representation of the ArrayList is getting passed into the tag. Try using just: html-el:options collection=exportDates / -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ArrayList html:options
Changing that to: html-el:select property=exportDate html-el:options collection=exportDates / /html-el:select Now produces this error: 15:55:34,494 ERROR [action]:253 - Servlet.service() for servlet action threw exception javax.servlet.jsp.JspException: ServletException in '/jsp/templates/tab_content_template.jsp': ServletException in '/jsp/fine_export.jsp': No name specified at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTa g.java:923) at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:462) at org.apache.jsp.jsp.templates.main_005ftemplate_jsp._jspx_meth_tiles_inse rt_1(org.apache.jsp.jsp.templates.main_005ftemplate_jsp:160) at org.apache.jsp.jsp.templates.main_005ftemplate_jsp._jspService(org.apach e.jsp.jsp.templates.main_005ftemplate_jsp:88) Could it have something to do with not specifying the label or the value as well? Daniel -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Monday, April 17, 2006 1:52 PM To: Struts Users Mailing List Subject: Re: ArrayList html:options On 4/17/06, Kalcevich, Daniel [EMAIL PROTECTED] wrote: request.setAttribute( exportDates, exportDates ); //exportDates = ArrayListString JSP: html-el:select property=exportDate html-el:options collection=${exportDates} / /html-el:select Error: 15:38:53,106 ERROR [action]:253 - Servlet.service() for servlet action threw exception javax.servlet.jsp.JspException: ServletException in '/jsp/templates/tab_content_template.jsp': ServletException in '/jsp/fine_export.jsp': Cannot find bean under name [04/17/2006, 04/16/2006] You don't need the expression in the 'collection' attribute. It wants the _name_ of the bean. You can see from the error message that the String representation of the ArrayList is getting passed into the tag. Try using just: html-el:options collection=exportDates / -- Wendy - 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: ArrayList html:options
On 4/17/06, Kalcevich, Daniel [EMAIL PROTECTED] wrote: Changing that to: html-el:select property=exportDate html-el:options collection=exportDates / /html-el:select Now produces this error: 15:55:34,494 ERROR [action]:253 - Servlet.service() for servlet action threw exception javax.servlet.jsp.JspException: ServletException in '/jsp/templates/tab_content_template.jsp': ServletException in '/jsp/fine_export.jsp': No name specified ... Could it have something to do with not specifying the label or the value as well? Possibly. http://struts.apache.org/struts-el/tagreference-struts-html-el.html#html:options Getting the options tag to do what I want it to has always been a matter of trial and error. I usually use Maps, so none of my examples is relevant. You might want to look at the 'optionsCollection' tag, or even consider doing the iteration yourself with c:forEach and html:option . -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ArrayList html:options
I think maybe using the LabelValueBean is the most realistic option. I have several places where I am using that now anyways. Thanks Wendy. Daniel -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Monday, April 17, 2006 2:32 PM To: Struts Users Mailing List Subject: Re: ArrayList html:options On 4/17/06, Kalcevich, Daniel [EMAIL PROTECTED] wrote: Changing that to: html-el:select property=exportDate html-el:options collection=exportDates / /html-el:select Now produces this error: 15:55:34,494 ERROR [action]:253 - Servlet.service() for servlet action threw exception javax.servlet.jsp.JspException: ServletException in '/jsp/templates/tab_content_template.jsp': ServletException in '/jsp/fine_export.jsp': No name specified ... Could it have something to do with not specifying the label or the value as well? Possibly. http://struts.apache.org/struts-el/tagreference-struts-html-el.html#html :options Getting the options tag to do what I want it to has always been a matter of trial and error. I usually use Maps, so none of my examples is relevant. You might want to look at the 'optionsCollection' tag, or even consider doing the iteration yourself with c:forEach and html:option . -- Wendy - 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]
html:options problem
Hi all I have a problem loading persisted values in html:options tag. I have html:select property=seriale size=1 html:options collection=allSerials property=id labelProperty=pathName/ /html:select where allSerials is a list of Beans with getter and setter methods. I use a dynaAction form but I cannot load properly the value persisted in the db. I typed dynaActionFrom.get(seriale) and it is the proper value but the tag does not load it. Any idea? Regatds - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options problem
I usually use the html:optionsCollection tag: html:optionsCollection property=allSerials value=id label=pathName/ Gary [EMAIL PROTECTED] 2/16/2006 5:33:29 AM Hi all I have a problem loading persisted values in html:options tag. I have html:select property=seriale size=1 html:options collection=allSerials property=id labelProperty=pathName/ /html:select where allSerials is a list of Beans with getter and setter methods. I use a dynaAction form but I cannot load properly the value persisted in the db. I typed dynaActionFrom.get(seriale) and it is the proper value but the tag does not load it. Any idea? Regatds - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Confidentiality Statement: This email/fax, including attachments, may include confidential and/or proprietary information and may be used only by the person or entity to which it is addressed. If the reader of this email/fax is not the intended recipient or his or her agent, the reader is hereby notified that any dissemination, distribution or copying of this email/fax is prohibited. If you have received this email/fax in error, please notify the sender by replying to this message and deleting this email or destroying this facsimile immediately. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options problem
Actually allSerials is a list of MyBean so it says : javax.servlet.jsp.JspException: No getter method for property allSerials of bean org.apache.struts.taglib.html.BEAN ... what should I do? -- Initial Header --- From : Gary Feidt [EMAIL PROTECTED] To : user@struts.apache.org Cc : Date : Thu, 16 Feb 2006 06:03:46 -0600 Subject : Re: html:options problem I usually use the html:optionsCollection tag: html:optionsCollection property=allSerials value=id label=pathName/ Gary [EMAIL PROTECTED] 2/16/2006 5:33:29 AM Hi all I have a problem loading persisted values in html:options tag. I have html:select property=seriale size=1 html:options collection=allSerials property=id labelProperty=pathName/ /html:select where allSerials is a list of Beans with getter and setter methods. I use a dynaAction form but I cannot load properly the value persisted in the db. I typed dynaActionFrom.get(seriale) and it is the proper value but the tag does not load it. Any idea? Regatds - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Confidentiality Statement: This email/fax, including attachments, may include confidential and/or proprietary information and may be used only by the person or entity to which it is addressed. If the reader of this email/fax is not the intended recipient or his or her agent, the reader is hereby notified that any dissemination, distribution or copying of this email/fax is prohibited. If you have received this email/fax in error, please notify the sender by replying to this message and deleting this email or destroying this facsimile immediately. - 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]
html:options problem
Hi all I have a problem loading persisted values in html:optionstag. I have html:select property=seriale size=1 html:options collection=allSerials property=id labelProperty=pathName/ /html:select where allSerials is a list of MySpecialBean with getter and setter methods. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options problem
On 2/16/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi all I have a problem loading persisted values in html:optionstag. I have html:select property=seriale size=1 html:options collection=allSerials property=id labelProperty=pathName/ /html:select where allSerials is a list of MySpecialBean with getter and setter methods. Have you already looked here: http://wiki.apache.org/struts/StrutsWidgets ? Michael. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options whith a HashMap
José María Tristán wrote: I create a bean: public class BeanDatos { private Map codigoM = new HashMap(); public Map getCodigoM(){ return this.codigoM; } public void setCodigoM(Map codigoM){ this.codigoM = codigoM; } } And in my jsp: % BeanDatos hashMapBean = new BeanDatos(); Map mapa = new HashMap(); mapa.put(100,SEDA); mapa.put(101,LIOFI); mapa.put(102,Cogeneracion); hashMapBean.setCodigoM(mapa); pageContext.setAttribute(hashMapBean,hashMapBean); % html:select property=listEdad multiple=true html:options name=hashMapBean property=key labelProperty=value/ /html:select and i received the next message: Well your html:options is pointing to a bean named 'hashMapBean' which is of type BeanDatos. BeanDatos doesn't have getters named getKey() and getValue(). What you probably meant was html:options name=hashMapBean property=codigoM.key labelProperty=codigoM.value/ L. javax.servlet.ServletException: No getter method available for property codigoM for bean under name null org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContext Impl.java:825) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextIm pl.java:758) org.apache.jsp.pages.submit_jsp._jspService(submit_jsp.java:178) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java: 298) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) causa raíz javax.servlet.jsp.JspException: No getter method available for property codigoM for bean under name null org.apache.struts.taglib.html.OptionsTag.getIterator(OptionsTag.java:382) org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:246) org.apache.jsp.pages.submit_jsp._jspx_meth_html_options_0(submit_jsp.java:6 84) org.apache.jsp.pages.submit_jsp._jspx_meth_html_select_2(submit_jsp.java:65 5) org.apache.jsp.pages.submit_jsp._jspx_meth_html_form_0(submit_jsp.java:250) org.apache.jsp.pages.submit_jsp._jspService(submit_jsp.java:168) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java: 298) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) Thank you. -Mensaje original- De: Aidas Semezys [mailto:[EMAIL PROTECTED] Enviado el: jueves, 09 de febrero de 2006 15:05 Para: Struts Users Mailing List Asunto: Re: html:options whith a HashMap Yes it is possible. Suppose you have bean of type java.util.HashMap in your context under name hashMapBean. Then you write: html:select property=listEdad multiple=true html:options name=hashMapBean property=key labelProperty=value/ /html:select That's all for it. On 2/8/06, José María Tristán [EMAIL PROTECTED] wrote: Hi, I have an application whith a html:options whith two ArrayList to see the name(arrayCodigo) and the label (arrayDescripcion) html:select property=listEdad multiple=true html:options name=arrayCodigo labelName=arrayDescripcion / /html:select Is possible do the same whith a HashMap (key-value)?. How i say to html:options that the property name is the key of HashMap and the labelname is the value of HashMap. Thank you very much - 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: html:options whith a HashMap
Yes it is possible. Suppose you have bean of type java.util.HashMap in your context under name hashMapBean. Then you write: html:select property=listEdad multiple=true html:options name=hashMapBean property=key labelProperty=value/ /html:select That's all for it. On 2/8/06, José María Tristán [EMAIL PROTECTED] wrote: Hi, I have an application whith a html:options whith two ArrayList to see the name(arrayCodigo) and the label (arrayDescripcion) html:select property=listEdad multiple=true html:options name=arrayCodigo labelName=arrayDescripcion / /html:select Is possible do the same whith a HashMap (key-value)?. How i say to html:options that the property name is the key of HashMap and the labelname is the value of HashMap. Thank you very much - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:options whith a HashMap
I create a bean: public class BeanDatos { private Map codigoM = new HashMap(); public Map getCodigoM(){ return this.codigoM; } public void setCodigoM(Map codigoM){ this.codigoM = codigoM; } } And in my jsp: % BeanDatos hashMapBean = new BeanDatos(); Map mapa = new HashMap(); mapa.put(100,SEDA); mapa.put(101,LIOFI); mapa.put(102,Cogeneracion); hashMapBean.setCodigoM(mapa); pageContext.setAttribute(hashMapBean,hashMapBean); % html:select property=listEdad multiple=true html:options name=hashMapBean property=key labelProperty=value/ /html:select and i received the next message: javax.servlet.ServletException: No getter method available for property codigoM for bean under name null org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContext Impl.java:825) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextIm pl.java:758) org.apache.jsp.pages.submit_jsp._jspService(submit_jsp.java:178) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java: 298) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) causa raíz javax.servlet.jsp.JspException: No getter method available for property codigoM for bean under name null org.apache.struts.taglib.html.OptionsTag.getIterator(OptionsTag.java:382) org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:246) org.apache.jsp.pages.submit_jsp._jspx_meth_html_options_0(submit_jsp.java:6 84) org.apache.jsp.pages.submit_jsp._jspx_meth_html_select_2(submit_jsp.java:65 5) org.apache.jsp.pages.submit_jsp._jspx_meth_html_form_0(submit_jsp.java:250) org.apache.jsp.pages.submit_jsp._jspService(submit_jsp.java:168) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java: 298) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) Thank you. -Mensaje original- De: Aidas Semezys [mailto:[EMAIL PROTECTED] Enviado el: jueves, 09 de febrero de 2006 15:05 Para: Struts Users Mailing List Asunto: Re: html:options whith a HashMap Yes it is possible. Suppose you have bean of type java.util.HashMap in your context under name hashMapBean. Then you write: html:select property=listEdad multiple=true html:options name=hashMapBean property=key labelProperty=value/ /html:select That's all for it. On 2/8/06, José María Tristán [EMAIL PROTECTED] wrote: Hi, I have an application whith a html:options whith two ArrayList to see the name(arrayCodigo) and the label (arrayDescripcion) html:select property=listEdad multiple=true html:options name=arrayCodigo labelName=arrayDescripcion / /html:select Is possible do the same whith a HashMap (key-value)?. How i say to html:options that the property name is the key of HashMap and the labelname is the value of HashMap. Thank you very much - 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]
html:options whith a HashMap
Hi, I have an application whith a html:options whith two ArrayList to see the name(arrayCodigo) and the label (arrayDescripcion) html:select property=listEdad multiple=true html:options name=arrayCodigo labelName=arrayDescripcion / /html:select Is possible do the same whith a HashMap (key-value)?. How i say to html:options that the property name is the key of HashMap and the labelname is the value of HashMap. Thank you very much - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
how to construct dynamic html:select html:options
my form will construct different number of combo boxes on the screen. for example user will enter 3 and submit the form. then the coming form will show 3 combo boxes. how can i do that with struts. The number of combo boxes is not static so i can not define to action form my combo boxes so can not create setter and getter methods. what is the way for that? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How can I keep multiple selection of html:options when I am back
I don't know if I understand you right, but if you wan't to get the option selected before validation, just save it in some form Attribute of your Struts Form and then use: html:select property=contacts multiple=true value=${myForm.lastSelectedThing} Cheerz Danny Chen Jerry schrieb: Well, I make multiple selection and submit the page, which will be forwarded to if validation is not passed. I want to keep selected the multiple options of select when I am back. What can I do? This is the fragment of source code: html:select property=contacts multiple=true ondblclick=javascript:DelContact(); styleClass=selectBox style=width:100%;height=60px; html:options collection=contactList property=value labelProperty=label/ /html:select Thanks in advance. Jerry - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How can I keep multiple selection of html:options when I am back
Well, I make multiple selection and submit the page, which will be forwarded to if validation is not passed. I want to keep selected the multiple options of select when I am back. What can I do? This is the fragment of source code: html:select property=contacts multiple=true ondblclick=javascript:DelContact(); styleClass=selectBox style=width:100%;height=60px; html:options collection=contactList property=value labelProperty=label/ /html:select Thanks in advance. Jerry - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Question about html:options
Hi all, I've been using Struts for some time now and suddenly faced this issue that i'm not sure it's a bug or a misinterpretation of mine. I have a List in request scope holding HashMaps. Then, i tried to use html:options/ like this: html:options collection=myList property=value labelProperty=label/ My HashMap instances have two entries each one: value = some value and label = value's label. Quite strange that didn't work. After replacing HashMaps to POJOs it worked. Aren't maps supported by html:options/? If not, it's not clear enough in documentation. If they are, could you please point me to a simple sample? Thanks in advance, Daniel Silva. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Question about html:options
We never used any hashmaps in List as the data holders. Always we use the java beans (with getter and setter) in list. Here is the sample code. Get_States is the request attribute name for the list. Code and description are two properties in the beans added to the list. html:options collection=Get_States property=code labelProperty=description/ Bala -Original Message- From: Daniel Henrique Ferreira e Silva [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 02, 2005 5:54 AM To: Struts Users Mailing List Subject: Question about html:options Hi all, I've been using Struts for some time now and suddenly faced this issue that i'm not sure it's a bug or a misinterpretation of mine. I have a List in request scope holding HashMaps. Then, i tried to use html:options/ like this: html:options collection=myList property=value labelProperty=label/ My HashMap instances have two entries each one: value = some value and label = value's label. Quite strange that didn't work. After replacing HashMaps to POJOs it worked. Aren't maps supported by html:options/? If not, it's not clear enough in documentation. If they are, could you please point me to a simple sample? Thanks in advance, Daniel Silva. - 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]
problem with html:select / html:options
Hi I am trying to use the struts taglibs as much as I can and I have the following situation. I have a collection object filled with DTO beans stored in session. The following prints out the list as I would expect: logic:iterate id=row name=results scope=session bean:write name=row property=countryName//br /logic:iterate and if I try this on the same page what I can't figure out is how to make this work: html:select property=cname html:options name=results property=countryName/ /html:select I would like the output to be something to this effect: select name=cname id=cname option value=USAUSA/option option value=FranceFrance/option /select Thanks troy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with html:select / html:options
Troy Bull wrote: and if I try this on the same page what I can't figure out is how to make this work: html:select property=cname html:options name=results property=countryName/ /html:select http://struts.apache.org/userGuide/struts-html.html#options Note the differences between property and labelProperty, and marvel at the power of documentation! ;) Also consider the use of optionsCollection, which is probably stylistically cleaner. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with html:select / html:options
Troy, I think it should work like this html:select property=cname html:options name=results property=countryName labelProperty=countryName/ /html:select Hope it helps Sunil Troy Bull [EMAIL PROTECTED] 10/13/2005 11:33 PM Please respond to Struts Users Mailing List user@struts.apache.org To Struts Users Mailing List user@struts.apache.org cc Subject problem with html:select / html:options Hi I am trying to use the struts taglibs as much as I can and I have the following situation. I have a collection object filled with DTO beans stored in session. The following prints out the list as I would expect: logic:iterate id=row name=results scope=session bean:write name=row property=countryName//br /logic:iterate and if I try this on the same page what I can't figure out is how to make this work: html:select property=cname html:options name=results property=countryName/ /html:select I would like the output to be something to this effect: select name=cname id=cname option value=USAUSA/option option value=FranceFrance/option /select Thanks troy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Re: using el to assign value of collection attribute in html:options
optionsCollection works! Thanks. -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Monday, September 26, 2005 2:35 PM To: Struts Users Mailing List Subject: Re: Re: using el to assign value of collection attribute in html:options clip The collection attribute is interpreted as the name of a JSP bean, in some scope, that itself represents a collection of individual beans, one per option value to be rendered. If you can't get html:options to cooperate, scroll down the page and look at html:optionsCollection. Sometimes it's easier to figure out what to use for each attribute with that one. /clip - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
using el to assign value of collection attribute in html:options
is there a way to use el to assign value of collection attribute in html:options tag?
Re: using el to assign value of collection attribute in html:options
Lim Hock-Chai wrote: is there a way to use el to assign value of collection attribute in html:options tag? Sure, just use html:options collection=${some expression}/. Of course this assumes that you're using a JSTL-capable Servlet container or that you're using the -el version of the HTML taglib. If you're having problems, post details of your configuration, what you've tried and what went wrong. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Re: using el to assign value of collection attribute in html:options
From: Lim Hock-Chai [EMAIL PROTECTED] I get the following error when trying to use el to assign value to collection attribute in struts's html:options: javax.servlet.ServletException: Cannot find bean under name ... However, it work when I do the following: 1) save the attrColorDTOList to a session: session.setAttribute(attrColorDTOList jspHelper.getAttrList().getAttrColorDTOList()) 2) In jsp: html:select property=color html:options collection=attrColorDTOList property=ID labelProperty=shortDesc/ /html:select As you've discovered, the 'collection' attribute is the _name_ of the collection, not the collection itself: http://struts.apache.org/userGuide/struts-html.html#options The collection attribute is interpreted as the name of a JSP bean, in some scope, that itself represents a collection of individual beans, one per option value to be rendered. If you can't get html:options to cooperate, scroll down the page and look at html:optionsCollection. Sometimes it's easier to figure out what to use for each attribute with that one. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Re: using el to assign value of collection attribute in html:options
I'm not at a place that I can try this. Do you mean to get below to work: html:select property=color html:options collection=${jspHelper.attrList.attrColorDTOList} property=ID labelProperty=shortDesc/ /html:select I need to do this? html:select property=color html:optionsCollection name=jspHelper property=attrList.attrColorDTOList label=shortDesc value=ID/ /html:select -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Monday, September 26, 2005 2:35 PM clip If you can't get html:options to cooperate, scroll down the page and look at html:optionsCollection. Sometimes it's easier to figure out what to use for each attribute with that one. /clip - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
html:options tag usage?
Hello everybody, This is a part of my input.jsp file: jsp:useBean id=myUtilBean class=MyUtilBean/ ... class MyUtilBean { private Collection c; public Collection getC() { c = new ArrayList(); c.add(new DataBean(value, name)); c.add(new DataBean(value1, name1)); c.add(new DataBean(value2, name2)); return c; } } . class DataBean { private String name; private String value; // getter and setter methods } How could I write the html:options tag in the input.jsp file so that the jsp file produces select name=... option value=namevalue/option option value=name1value1/option option value=name2value2/option /select Thanks so much. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options tag usage?
Anybody else notice the state.md.us email address? Is this Mark using Struts but to embarassed to admit it? *rotflmao* Thai Dang Vu wrote: class MyUtilBean { private Collection c; public Collection getC() { c = new ArrayList(); c.add(new DataBean(value, name)); c.add(new DataBean(value1, name1)); c.add(new DataBean(value2, name2)); return c; } } . class DataBean { private String name; private String value; // getter and setter methods } How could I write the html:options tag in the input.jsp file so that the jsp file produces select name=... option value=namevalue/option option value=name1value1/option option value=name2value2/option /select http://struts.apache.org/userGuide/struts-html.html#options Basically you'd want to have the 'collection ' attribute refer to the util bean's Collection var, 'labelProperty' would be 'name' since the DataBean stores the label in the 'name' var, and 'property' would be 'value', more or less. Mostly I was just entertained that you and Mark both work in Maryland. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options tag usage?
Try adding the org.apache.strtuts.util.LabelValueBean into your Collection instead of DataBean and use the html:optionsCollection tag to render them. --Notice the name/value pairs switched parameters. class MyUtilBean { private Collection c; public Collection getC() { c = new ArrayList(); c.add(new LabelValueBean (name, value)); c.add(new LabelValueBean (name1, value1)); c.add(new LabelValueBean (name2, value2)); return c; } //setting the value in some scope //request.setAttribute(COLLECTION, getC()); } Then in your jsp: html:select property= html:optionsCollections name=COLLECTION/ /html:select Thai Dang Vu wrote: Hello everybody, This is a part of my input.jsp file: jsp:useBean id=myUtilBean class=MyUtilBean/ ... class MyUtilBean { private Collection c; public Collection getC() { c = new ArrayList(); c.add(new DataBean(value, name)); c.add(new DataBean(value1, name1)); c.add(new DataBean(value2, name2)); return c; } } . class DataBean { private String name; private String value; // getter and setter methods } How could I write the html:options tag in the input.jsp file so that the jsp file produces select name=... option value=namevalue/option option value=name1value1/option option value=name2value2/option /select Thanks so much. - 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: html:options tag usage?
Using Servlet/JSP 2.4/2.0 and JSTL something like this should work: jsp:useBean id=myUtilBean class=MyUtilBean/ html:select property=... c:forEach items=${myUtilBean} var=row html:option value=${row.name}${row.value}/html:option /c:forEach /html:select -Original Message- From: Thai Dang Vu [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 28, 2005 1:08 PM To: user@struts.apache.org Subject: html:options tag usage? Hello everybody, This is a part of my input.jsp file: jsp:useBean id=myUtilBean class=MyUtilBean/ ... class MyUtilBean { private Collection c; public Collection getC() { c = new ArrayList(); c.add(new DataBean(value, name)); c.add(new DataBean(value1, name1)); c.add(new DataBean(value2, name2)); return c; } } . class DataBean { private String name; private String value; // getter and setter methods } How could I write the html:options tag in the input.jsp file so that the jsp file produces select name=... option value=namevalue/option option value=name1value1/option option value=name2value2/option /select Thanks so much. - 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: html:options tag usage?
quick correction: items=${myUtilBean.c} -Original Message- From: Abdullah Jibaly Sent: Tuesday, June 28, 2005 1:25 PM To: Struts Users Mailing List Subject: RE: html:options tag usage? Using Servlet/JSP 2.4/2.0 and JSTL something like this should work: jsp:useBean id=myUtilBean class=MyUtilBean/ html:select property=... c:forEach items=${myUtilBean} var=row html:option value=${row.name}${row.value}/html:option /c:forEach /html:select -Original Message- From: Thai Dang Vu [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 28, 2005 1:08 PM To: user@struts.apache.org Subject: html:options tag usage? Hello everybody, This is a part of my input.jsp file: jsp:useBean id=myUtilBean class=MyUtilBean/ ... class MyUtilBean { private Collection c; public Collection getC() { c = new ArrayList(); c.add(new DataBean(value, name)); c.add(new DataBean(value1, name1)); c.add(new DataBean(value2, name2)); return c; } } . class DataBean { private String name; private String value; // getter and setter methods } How could I write the html:options tag in the input.jsp file so that the jsp file produces select name=... option value=namevalue/option option value=name1value1/option option value=name2value2/option /select Thanks so much. - 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: html:options tag usage?
Abdullah Jibaly wrote: Using Servlet/JSP 2.4/2.0 and JSTL something like this should work: jsp:useBean id=myUtilBean class=MyUtilBean/ html:select property=... c:forEach items=${myUtilBean.c} var=row html:option value=${row.name}${row.value}/html:option /c:forEach /html:select But... he asked about html:options (plural, not html:option.) The whole point is that if you have a Collection, you don't have to do the iteration, the tag will do it for you. Dave and Brad are on the right track. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:options tag usage?
Same result... I'm aware of the options tag but in case the user wants more flexibility they have this option :) After all he didn't ask about LabelValueBean either. -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 28, 2005 1:38 PM To: Struts Users Mailing List Subject: Re: html:options tag usage? Abdullah Jibaly wrote: Using Servlet/JSP 2.4/2.0 and JSTL something like this should work: jsp:useBean id=myUtilBean class=MyUtilBean/ html:select property=... c:forEach items=${myUtilBean.c} var=row html:option value=${row.name}${row.value}/html:option /c:forEach /html:select But... he asked about html:options (plural, not html:option.) The whole point is that if you have a Collection, you don't have to do the iteration, the tag will do it for you. Dave and Brad are on the right track. -- Wendy Smoak - 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 html:options tag with a Map
From: Eric C. Hein [EMAIL PROTECTED] ...it looks like the list is being pulled from the map like I want it to, but instead of the actual list being used as collection to iterate, the tag lib is calling toString() on the list, and looking for a bean under that name. Okay, I gave up and read the documentation ( http://struts.apache.org/userGuide/struts-html.html#options ) which says that 'collection' is the Name of the JSP bean (in some scope) which is itself a Collection of other beans. Instead of having collection evaluate to the actual List, it needs to be the _name_ of the List. I went back and looked at my projects, and sure enough, I have no expressions in the 'collection' attribute. Unfortunately, if your List is inside a Map, it doesn't really have a name. You can use c:set to name it. (And this time, I tested the code. Sorry for the earlier incorrect example!) c:set var=salesList value=${departmentMap.sales} / html-el:select name=userForm property=employee html-el:options collection=salesList property=label labelProperty=value/ /html-el:select Here's the entire example page: http://wiki.wendysmoak.com/cgi-bin/wiki.pl?StrutsOptionsFromMap -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Using html:options tag with a Map
I know I can populate a drop down using a List as follows: html:options collection=sales property=label labelProperty=value/ But to clean things up a bit I'd like to put all my department List(s) in a map. So the collection would be akin to - departmentMap.get(sales), for example. When I try using: html-el:options collection=\${departmentMap[\sales\] property=label labelProperty=value/ The tag lib calls toString() on the collection returned by the \${departmentMap[\sales\] and then looks for a bean under that name. Can anyone explain how I can get to to my lists? - Thanks Eric - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using html:options tag with a Map
From: Eric C. Hein [EMAIL PROTECTED] html-el:options collection=\${departmentMap[\sales\] property=label labelProperty=value/ Was this pasted in? You have a slash in front of the dollar sign, and the ending curly brace seems to be missing in the collection attribute. I've never seen escaped double quotes used in an expression, either. Try just ${departmentMap.sales} for the collection. I'm not sure how smart it is, but if it knows departmentMap is a Map, it will use the correct accessor. Alternately, try ${departmentMap['sales']}. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using html:options tag with a Map
Eric If you absolutely positively need a quote on each side try quot; Viel Gluck, Martin- - Original Message - From: Wendy Smoak [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Saturday, May 28, 2005 8:32 PM Subject: Re: Using html:options tag with a Map From: Eric C. Hein [EMAIL PROTECTED] html-el:options collection=\${departmentMap[\sales\] property=label labelProperty=value/ Was this pasted in? You have a slash in front of the dollar sign, and the ending curly brace seems to be missing in the collection attribute. I've never seen escaped double quotes used in an expression, either. Try just ${departmentMap.sales} for the collection. I'm not sure how smart it is, but if it knows departmentMap is a Map, it will use the correct accessor. Alternately, try ${departmentMap['sales']}. -- Wendy Smoak - 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 html:options tag with a Map
Thanks Wendy. I changed the variable names to make the example easier to understand and must have dropped the closing brace. I learned about escaping special charaters here: http://courses.coreservlets.com/Course-Materials/pdf/struts/Struts-and-JSP2-EL.pdf , but as you have indicated, it's not required in this case. I have tried your suggestions and I get the same result. According to the error message: Cannot find bean under name [LabelValue[Jim Smith, 3]] ...it looks like the list is being pulled from the map like I want it to, but instead of the actual list being used as collection to iterate, the tag lib is calling toString() on the list, and looking for a bean under that name. I have worked around it like this: html-el:select name=userForm property=employee c:forEach var=opt items=${departmentMap['sales']} html-el:option value=${opt.value} c:out value=${opt.label}/ /html-el:option /c:forEach /html-el:select But if its possible to do it in a less verbose manner I'd like to. Thanks Again, Eric - Original Message - From: Wendy Smoak [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Saturday, May 28, 2005 5:32 PM Subject: Re: Using html:options tag with a Map From: Eric C. Hein [EMAIL PROTECTED] html-el:options collection=\${departmentMap[\sales\] property=label labelProperty=value/ Was this pasted in? You have a slash in front of the dollar sign, and the ending curly brace seems to be missing in the collection attribute. I've never seen escaped double quotes used in an expression, either. Try just ${departmentMap.sales} for the collection. I'm not sure how smart it is, but if it knows departmentMap is a Map, it will use the correct accessor. Alternately, try ${departmentMap['sales']}. -- Wendy Smoak - 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]
html:options
Hello there! I've always used the html:options with the collection attribute, so I had a separate bean with the collection. But now I'd like to have that collection on my form bean cuz it'll be stored on the session, and I have a utility filter that always remove my formbeans stored on the session after the end of an usercase. So for this specific case, having the collection inside my form seemed to be the best solution since I don't need to care about that bean later. Ok. But for my surprise struts lacks support for collections insides the formbeans html:select property=documentType html:options property=documentList/ /html:select This prints documenttype as value and property, but I'd like to have a way to say which accessor is my label and which is property. Isn't this possible? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:options
Viniciius, Here is a link to the options user guide secition of the Struts user guide: http://struts.apache.org/userGuide/struts-html.html#options Look at the LabelName and LabelProprety attributes. * Ruben Cepeda [EMAIL PROTECTED] * Original Message Follows From: Vinicius Caldeira Carvalho [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org To: Struts Users Mailing List user@struts.apache.org Subject: html:options Date: Sat, 09 Apr 2005 09:49:15 -0300 Hello there! I've always used the html:options with the collection attribute, so I had a separate bean with the collection. But now I'd like to have that collection on my form bean cuz it'll be stored on the session, and I have a utility filter that always remove my formbeans stored on the session after the end of an usercase. So for this specific case, having the collection inside my form seemed to be the best solution since I don't need to care about that bean later. Ok. But for my surprise struts lacks support for collections insides the formbeans html:select property=documentType html:options property=documentList/ /html:select This prints documenttype as value and property, but I'd like to have a way to say which accessor is my label and which is property. Isn't this possible? - 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]
Relation between validator html:options ?
Hello Guys, I have a normal action class called PrepareFacultyEntryAction which basically retrieves some data from the database, and forwards it to a jsp page. I have a couple of html:options which are filled by an arraylist of label value beans. So far so good. The user selects something, and hits submit. Which will be submitted to another Action class called FacultyEntryAction which has a Validator form (the previous action class also uses the same formclass, but with validate=false, so that it won't validate the first time around) and does some validations (this time, I set validate=true in the action mapping). But, when I submit to this Action class, all I'm seeing is a jumble of javascript written across the browser (and execute is not being called). Surprisingly, if I remove the two html:options tags, then it shows up correctly. The validations work, and the class is submitting properly. But if I put those two html:options tags, everything blows up. I'm completely lost. Please help. TIA, Vamsee. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Relation between validator html:options ?
Do you have onsubmit or other JavaScript attributes set that could interfere with the submit or that require interaction with the combo boxes before submit? You might want to post your (JSP) form code. Erik Vamsee Kanakala wrote: Hello Guys, I have a normal action class called PrepareFacultyEntryAction which basically retrieves some data from the database, and forwards it to a jsp page. I have a couple of html:options which are filled by an arraylist of label value beans. So far so good. The user selects something, and hits submit. Which will be submitted to another Action class called FacultyEntryAction which has a Validator form (the previous action class also uses the same formclass, but with validate=false, so that it won't validate the first time around) and does some validations (this time, I set validate=true in the action mapping). But, when I submit to this Action class, all I'm seeing is a jumble of javascript written across the browser (and execute is not being called). Surprisingly, if I remove the two html:options tags, then it shows up correctly. The validations work, and the class is submitting properly. But if I put those two html:options tags, everything blows up. I'm completely lost. Please help. TIA, Vamsee. - 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: Relation between validator html:options ?
Vamsee Kanakala wrote: I have a normal action class called PrepareFacultyEntryAction which basically retrieves some data from the database, and forwards it [...] Sorry guys, my bad. I should've watched the logs properly. What was happening is that one of the arraylists I'm sending happens to be set to null (silly, but it completely slipped my mind), and beanutils OptionsTag.java was complaining that it's not able to find the bean. All's well now. Thanks, Eric :) Vamsee. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Using html:options with JSTL
Hi, Is there any way to have html:option parse JSTL sql:query results for a dropdown? I have a form containing a drop-down that is populated by a database. My hope is that I could use html:options to walk through it, and if the id matches the value of the Form, pre-select that value. Is this possible? I swear Struts is beating me every step of the way Thanks, - Nic. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options/ Problems with Tomcat 4.1.30 (Linux)[SOLVED]
Hi, i solved that problem. I deployed my files with WinSCP and forgot to copy those JSP´s as textfiles. In Windows, new line is CRLF in Linux it is LF. This little difference makes a lot of damage if taglibs are used... So long - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Regarding HTML:options tag
HI, I have one doubt regarding the use of html:options tag. In the jsp itself I have got a set of values like List questions= SOME VALUE OBTAINED FROM THE DATABASE- ie name value pairs. In the jsp I have a html:options tag. html:options name= %= questions % property=What do I give here labelProperty= What do I give here to obtain the labels / I don't have any entries in the form bean for the collection . Only entry I have in the form bean corresponds to the property name I have given in the select tag. Can anyone help Regards, Krishna MOhan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Regarding HTML:options tag
I guess you should better use the collection attribute instead of name. See http://struts.apache.org/userGuide/struts-html.html#options Pavel On Thu, 17 Feb 2005 14:05:06 +0530, Krishna Mohan Radhakrishnan [EMAIL PROTECTED] wrote: HI, I have one doubt regarding the use of html:options tag. In the jsp itself I have got a set of values like List questions= SOME VALUE OBTAINED FROM THE DATABASE- ie name value pairs. In the jsp I have a html:options tag. html:options name= %= questions % property=What do I give here labelProperty= What do I give here to obtain the labels / I don't have any entries in the form bean for the collection . Only entry I have in the form bean corresponds to the property name I have given in the select tag. Can anyone help Regards, Krishna MOhan - 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]
html:options/ Problems with Tomcat 4.1.30 (Linux)
Hi, Ive developed my Struts application with Tomcat 4.1.30 (Windows). Everything works fine, i tested my stuff withe different browsers, different Eclipseversions etc. There is a fomularBean whitch holds some prefetched data in key-value maps, some as a vector, some as RowSetDynaBeans, some as hashmaps. This data feeds my selects like the following example: html:option name='actionForm' property='whatever' value=''please select ... html:optionsCollection name='fomularBean' property='states'/ /html:option Now, i deployed my app in Tomcat 4.1.30 (Linux) and all my selects are useless ! All values are rendered in the first option like: please select ...GermanyFranceUSAItaly etc. I have absolutely no idea what the problem is. Tomcat seems to hav some problems with those html: tags, but they are installed properly an no exception or problem is logged. Has anybody ever faced this behaviour or has some hints where to continue my search ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options/ Problems with Tomcat 4.1.30 (Linux)
The html:select/ renders an HTML select/ element. The html:option/ renders a single option/ element The html:optionsCollection/ renders several option/ elements. html:option/ should not contain html:optionsCollection/, both should be included inside of an html:select/ tag: html:select html:option.../html:option html:optionsCollection/ /html:select -- Jeff Frank Schaare wrote: html:option name='actionForm' property='whatever' value=''please select ... html:optionsCollection name='fomularBean' property='states'/ /html:option Now, i deployed my app in Tomcat 4.1.30 (Linux) and all my selects are useless ! All values are rendered in the first option like: please select ...GermanyFranceUSAItaly etc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options/ Problems with Tomcat 4.1.30 (Linux)
Sorry, i wrote that example right out of your mind. html:optionsCollection/ is nested inside the html:select that is not my problem. Jeff Beal schrieb: The html:select/ renders an HTML select/ element. The html:option/ renders a single option/ element The html:optionsCollection/ renders several option/ elements. html:option/ should not contain html:optionsCollection/, both should be included inside of an html:select/ tag: html:select html:option.../html:option html:optionsCollection/ /html:select -- Jeff Frank Schaare wrote: html:option name='actionForm' property='whatever' value=''please select ... html:optionsCollection name='fomularBean' property='states'/ /html:option Now, i deployed my app in Tomcat 4.1.30 (Linux) and all my selects are useless ! All values are rendered in the first option like: please select ...GermanyFranceUSAItaly etc. - 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: html:options/ Problems with Tomcat 4.1.30 (Linux)
What does the generated HTML source look like? Frank Schaare wrote: Sorry, i wrote that example right out of your mind. html:optionsCollection/ is nested inside the html:select that is not my problem. Jeff Beal schrieb: The html:select/ renders an HTML select/ element. The html:option/ renders a single option/ element The html:optionsCollection/ renders several option/ elements. html:option/ should not contain html:optionsCollection/, both should be included inside of an html:select/ tag: html:select html:option.../html:option html:optionsCollection/ /html:select -- Jeff Frank Schaare wrote: html:option name='actionForm' property='whatever' value=''please select ... html:optionsCollection name='fomularBean' property='states'/ /html:option Now, i deployed my app in Tomcat 4.1.30 (Linux) and all my selects are useless ! All values are rendered in the first option like: please select ...GermanyFranceUSAItaly etc. - 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]
html:options
Here is what I have in the JSP tag file: jxp:state html:select name=${formName} property=state size=4 multiple=true html:options collection=${state} property=stateCD labelProperty=description / /html:select /jxp:state state is a simple tag that makes a List of State objects available to the page. I tried setting them as a page scope attribute and a request scope attribute. I always get the following message: javax.servlet.jsp.JspException: Cannot find bean under name [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] = Norris Shelton Software Engineer Sun Certified Java 1.1 Programmer Appriss, Inc. ICQ# 26487421 AIM NorrisEShelton YIM norrisshelton __ Do you Yahoo!? Yahoo! Mail - now with 250MB free storage. Learn more. http://info.mail.yahoo.com/mail_250 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options
Seems to me you have the form name incorrect? is 'formName' the name of the form, or is it a String holding the name of the form? I think you'd find it easier to populate your list in an action. Perhaps you meant to put: html:select name=formName property=state size=4 multiple=true If formName (above) is the name of your form, I think this is what you're aiming for. Otherwise, supposing you're using the html-el tags, you're going to wind up with the value of the variable formName (presumably an object) evaluated as a String ... which probably isn't what you're after. HTH, Eddie On Fri, 28 Jan 2005 16:53:16 -0800 (PST), Norris Shelton [EMAIL PROTECTED] wrote: javax.servlet.jsp.JspException: Cannot find bean under name -- Eddie Bush - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options
Seems to me you have the form name incorrect? is 'formName' the name of the form, or is it a String holding the name of the form? I think you'd find it easier to populate your list in an action. Perhaps you meant to put: html:select name=formName property=state size=4 multiple=true If formName (above) is the name of your form, I think this is what you're aiming for. Otherwise, supposing you're using the html-el tags, you're going to wind up with the value of the variable formName (presumably an object) evaluated as a String ... which probably isn't what you're after. HTH On Fri, 28 Jan 2005 16:53:16 -0800 (PST), Norris Shelton [EMAIL PROTECTED] wrote: javax.servlet.jsp.JspException: Cannot find bean under name -- Eddie Bush - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options
Sorry for the double post. G-Mail hiccuped. -- Eddie Bush - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options
On Fri, 28 Jan 2005 16:53:16 -0800 (PST), Norris Shelton [EMAIL PROTECTED] wrote: Here is what I have in the JSP tag file: jxp:state html:select name=${formName} property=state size=4 multiple=true html:options collection=${state} property=stateCD labelProperty=description / collection attribute takes a name which holds the Collection and not the collection itself. Assuming that your list is set under the name state, your collection attribute should be collection=state and not collection=${state} /html:select /jxp:state state is a simple tag that makes a List of State objects available to the page. I tried setting them as a page scope attribute and a request scope attribute. I always get the following message: javax.servlet.jsp.JspException: Cannot find bean under name [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] = Norris Shelton Software Engineer Sun Certified Java 1.1 Programmer Appriss, Inc. ICQ# 26487421 AIM NorrisEShelton YIM norrisshelton __ Do you Yahoo!? Yahoo! Mail - now with 250MB free storage. Learn more. http://info.mail.yahoo.com/mail_250 - 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: html:options
The ${formName} is in fact a variable that holds the name of the form. Kishore Senji's solution was what I needed. --- Eddie Bush [EMAIL PROTECTED] wrote: Seems to me you have the form name incorrect? is 'formName' the name of the form, or is it a String holding the name of the form? I think you'd find it easier to populate your list in an action. Perhaps you meant to put: html:select name=formName property=state size=4 multiple=true If formName (above) is the name of your form, I think this is what you're aiming for. Otherwise, supposing you're using the html-el tags, you're going to wind up with the value of the variable formName (presumably an object) evaluated as a String ... which probably isn't what you're after. HTH On Fri, 28 Jan 2005 16:53:16 -0800 (PST), Norris Shelton [EMAIL PROTECTED] wrote: javax.servlet.jsp.JspException: Cannot find bean under name -- Eddie Bush - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] = Norris Shelton Software Engineer Sun Certified Java 1.1 Programmer Appriss, Inc. ICQ# 26487421 AIM NorrisEShelton YIM norrisshelton __ Do you Yahoo!? Yahoo! Mail - now with 250MB free storage. Learn more. http://info.mail.yahoo.com/mail_250 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options
That was it exactly. Thx. Now I have another question. My box is a multi select. If there is a validation error, only the first option will still be selected. --- Kishore Senji [EMAIL PROTECTED] wrote: On Fri, 28 Jan 2005 16:53:16 -0800 (PST), Norris Shelton [EMAIL PROTECTED] wrote: Here is what I have in the JSP tag file: jxp:state html:select name=${formName} property=state size=4 multiple=true html:options collection=${state} property=stateCD labelProperty=description / collection attribute takes a name which holds the Collection and not the collection itself. Assuming that your list is set under the name state, your collection attribute should be collection=state and not collection=${state} /html:select /jxp:state state is a simple tag that makes a List of State objects available to the page. I tried setting them as a page scope attribute and a request scope attribute. I always get the following message: javax.servlet.jsp.JspException: Cannot find bean under name [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] = Norris Shelton Software Engineer Sun Certified Java 1.1 Programmer Appriss, Inc. ICQ# 26487421 AIM NorrisEShelton YIM norrisshelton __ Do you Yahoo!? Yahoo! Mail - now with 250MB free storage. Learn more. http://info.mail.yahoo.com/mail_250 - 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] = Norris Shelton Software Engineer Sun Certified Java 1.1 Programmer Appriss, Inc. ICQ# 26487421 AIM NorrisEShelton YIM norrisshelton __ Do you Yahoo!? Yahoo! Mail - now with 250MB free storage. Learn more. http://info.mail.yahoo.com/mail_250 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options
Are you getting any interesting debug statements? Looks to me like the form should be properly populated, even if validation failed. What type of field are the values being put into? If you're looking for multiples, I imagine you're putting them into a String array? Please trim unnecessary dialog out of messages when posting a response. On Fri, 28 Jan 2005 17:59:16 -0800 (PST), Norris Shelton [EMAIL PROTECTED] wrote: That was it exactly. Thx. Now I have another question. My box is a multi select. If there is a validation error, only the first option will still be selected. -- Eddie Bush - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options
I am using a LazyValidatorForm as my backing bean. I assumed that it would be able to handle them automatically, but you got me to thinking. I added in the String[] declaration and it works great. form-beans form-bean name=watchForm type=org.apache.struts.validator.LazyValidatorForm !-- default nameMatch to partial -- form-property name=nameMatch type=java.lang.String initial=partial/ !-- allow multi-selects to be stored -- form-property name=state type=java.lang.String[]/ /form-bean /form-beans --- Eddie Bush [EMAIL PROTECTED] wrote: Are you getting any interesting debug statements? Looks to me like the form should be properly populated, even if validation failed. What type of field are the values being put into? If you're looking for multiples, I imagine you're putting them into a String array? = Norris Shelton Software Engineer Sun Certified Java 1.1 Programmer Appriss, Inc. ICQ# 26487421 AIM NorrisEShelton YIM norrisshelton __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
html:options won't get preselected!
Hi, I have a form that my action prepopulates and that works fine. For example: td html:text property=country/ /td Country is FormBean property that is populated from the database by my action. This is all good but I want the user to be able to change the country so I need a dropdown list. Here is what I have: html:select property=country html:options collection=countryList property=countryID labelProperty=countryName/ /html:select CountryList is a bean in request scope. The above gives me a drop down list with all the countries in the database but I need one country to be preselected. I already have the right value in the form which I can get using html:text property=country/ . As far as I understand if the value in the formbean equals the value in the dropdown list this value will be preselected. This does not happen for me. My dropdown list has random order. What am I doing wrong? Thanks for your help. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options won't get preselected!
From: Nadia Kunkov [EMAIL PROTECTED] html:select property=country html:options collection=countryList property=countryID labelProperty=countryName/ /html:select Struts will pre-select the item when the 'country' property of the form matches the countryID of the option. What is the exact value of the 'country' property of the form? I'm betting you've got 'Canada' when you need 'CAN'. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:options won't get preselected!
You are right! It was the key against the name. Thank you so much. Nadia -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Thursday, December 30, 2004 11:20 AM To: Struts Users Mailing List Subject: Re: html:options won't get preselected! From: Nadia Kunkov [EMAIL PROTECTED] html:select property=country html:options collection=countryList property=countryID labelProperty=countryName/ /html:select Struts will pre-select the item when the 'country' property of the form matches the countryID of the option. What is the exact value of the 'country' property of the form? I'm betting you've got 'Canada' when you need 'CAN'. -- Wendy Smoak - 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]
html:options and collections
I want to use a bean to supply options to a select widget. I have a business object, DevicesBO that has a method that returns a Collection. Class Name: DevicesBO Method: Collection getDevices() The collection is a List of CodeDecodeDTO objects. Class Name: CodeDecodeDTO Methods:String getCode() String getDecodeDesc() The value should be retrieved using the getCode() method and the label should be retrieved using getDecodeDesc. I've tried with no success to setup my JSP, below is what I've tried. snippet from my struts-config.xml ... ... form-beans form-bean name=myAppFm type=org.apache.struts.validator.DynaValidatorForm ... ... form-property name=devices type=sample.DeviceBO / /form-bean ... ... snippet from my JSP ... ... html:select name=myAppFm property=dvcTyp html:options collection=devices name=myAppFm property=devices.code labelProperty=devices.decodeDesc / /html:select ... ... What is the correct way to setup the html:options tag? Is there a way to use OSCache tags so I can cache the DevicesBO in my application? Thanks, James - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options and collections
[EMAIL PROTECTED] wrote: I want to use a bean to supply options to a select widget. I have a business object, DevicesBO that has a method that returns a Collection. Class Name: DevicesBO Method: Collection getDevices() The collection is a List of CodeDecodeDTO objects. Class Name: CodeDecodeDTO Methods:String getCode() String getDecodeDesc() The value should be retrieved using the getCode() method and the label should be retrieved using getDecodeDesc. I've tried with no success to setup my JSP, below is what I've tried. snippet from my struts-config.xml ... ... form-beans form-bean name=myAppFm type=org.apache.struts.validator.DynaValidatorForm ... ... form-property name=devices type=sample.DeviceBO / /form-bean ... ... snippet from my JSP ... ... html:select name=myAppFm property=dvcTyp html:options collection=devices name=myAppFm property=devices.code labelProperty=devices.decodeDesc / /html:select ... ... From the documentation for html:options: The *property* attribute is interpreted as the name of a property of the individual beans included in the collection, and is used to retrieve the value that will be returned to the server if this option is selected. Since your methods are getCode and getDecodeDesc, your property names would be code and decodeDesc. So it should be property=code and labelProperty=decodeDesc if I'm not mistaken. What is the correct way to setup the html:options tag? Is there a way to use OSCache tags so I can cache the DevicesBO in my application? I often write a Struts plug-in that sets static collections (such as select box values) as ServletContext attributes in the init method. Erik Thanks, James - 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: html:options and collections
Erik Weber erikweber 'at' mindspring.com writes: I often write a Struts plug-in that sets static collections (such as select box values) as ServletContext attributes in the init method. That becomes more complicated when you handle i18n (e.g. in labelProperty). -- Guillaume Cottenceau - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Help needed on question regarding html:select and html:options...cannot turn off validator
Hi, David, Thanks. I think I know where is the problem after reading your last email again. I will try it later. Tong --- David G. Friedman [EMAIL PROTECTED] wrote: Tong, When you say automatic validation, do you mean client side or server side? What class does your ActionForm extend? What class does your Action extend? What is your action mapping? What path (the part after the http://www.whatever.com) is the action? What are html:form and html:javascript tags from your invoking page? (i.e. the one that submits the page). Regards, David -Original Message- From: t t [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 10, 2004 8:05 PM To: Struts Users Mailing List Subject: RE: Help needed on question regarding html:select and html:options...cannot turn off validator Thanks. David. I am still confused by the automatic validation. I couldn't turn it off. --- David G. Friedman [EMAIL PROTECTED] wrote: Tong, You can change the form's submit action using almost any form field type (except hidden) using the onClick or onChange methods. If you have a submit button button, you can do this: input type=submit name=Save value=save onClick=this.form.action='/save.do';return true; / To save the button name into a hidden parameter such as a hidden field ActionName, you can do this: input type=hidden name=ActionName / input type=submit name=Save value=save onClick=this.form.ActionName.value='save';return true; / input type=submit name=Delete value=delete onClick=this.form.ActionName.value=delete'; / Or even: input type=submit name=Save value=save onClick=this.form.ActionName.value=this.value; / (I might be slightly off on the ActionName.value setting property). If you choose to make the onClick invoke a function (for performing even more steps than that) and the input was a submit button, remember to NOT do a form.submit() within that JS function - it would cause a double submit when invoked from a submit button. If it isn't a submit button but some other type of button, you can probably do a form.submit() if it doesn't do it automatically. As for preventing automatic validation in an Action, Erik was spot on with validate=false as an attribute and value in your action .../ mapping. Just invoke the validate method with the appropriate arguments for the Action class you're extending. And finally, on your topic of making one select change another select, the only way I know (and did this once, long ago) was to set a javascript function to be called by the first one's onClick or onChange method. That function can be passed the this.form object, then get to the second pulldown by name or id, delete every select item, then add each new item. Creative use of the iterate tag plus javascript can do it, or you could find good examples if you google - that's how I learned how to do it. Regards, David -Original Message- From: t t [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 10, 2004 6:41 PM To: Struts Users Mailing List Subject: Re: Help needed on question regarding html:select and html:options...cannot turn off validator How can I turn off validator? THanks. --- t t [EMAIL PROTECTED] wrote: Or I can set a parameter before executing the added action. --- t t [EMAIL PROTECTED] wrote: Hi, Erik, I got an idea. I can insert another action before the actual action be executed. And use javascript change a hidden property before executing the added action, then I can do what i want to do in the added action. What do you think? I will try it later. Thanks for your help! Tong Erik Weber [EMAIL PROTECTED] wrote: JavaScript can change the action URL on the fly. For example: http://www.willmaster.com/possibilities/archives/wmp20030527001.shtml However, I'm not sure how compatible this type of thing will be with the Struts form tag. I've never tried it. I'm surprised others aren't speaking up because the multiple submit problem comes up a lot. If you search the archives for multiple submit buttons you might find other ideas. Erik t t wrote: Hi,Erik, I think that helps. I have another question. Besides the action attribute in html:form, is anywhere else we can specify another action corresponding the submission of javascript? Thanks. Tong Erik Weber wrote: There may be other ways or better ways, but one thing you could do is vary the action URL. You could have the same action class serving slightly different action mappings, some with validation set to true and some with validation set to false. I did what you are trying to do in a non-Struts Servlet app, and there I
Help needed on question regarding html:select and html:options...
Hi, all, I have two html:select as below: --- html:select property=s1 html:options collection=c1 property=value labelProperty=label/ /html:select html:select property=s2 html:options collection=c2 property=value labelProperty=label/ /html:select when user choose item2 from s1, I want to change the collection in s2 from c2 to itemC. How can I do that? Thanks in advance! Tong - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com
Re: Help needed on question regarding html:select and html:options...
I don't know exactly how do it using JavaScript. However, I know there's a way to do it. But, you'd have to have all list data downloaded to the client's browser (could be undesirable depending on list size), so you may want to rethink that approach once you figure out how to do it. Obviously it can be done using ordinary programming on the server side (JavaScript can resubmit the page when the first select's value is changed, and you can change the collection to be displayed in the second select before you resend the HTML). Erik t t wrote: Hi, all, I have two html:select as below: --- html:select property=s1 html:options collection=c1 property=value labelProperty=label/ /html:select html:select property=s2 html:options collection=c2 property=value labelProperty=label/ /html:select when user choose item2 from s1, I want to change the collection in s2 from c2 to itemC. How can I do that? Thanks in advance! Tong - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help needed on question regarding html:select and html:options...
Thank you for the hint. I will try. Erik Weber [EMAIL PROTECTED] wrote:I don't know exactly how do it using JavaScript. However, I know there's a way to do it. But, you'd have to have all list data downloaded to the client's browser (could be undesirable depending on list size), so you may want to rethink that approach once you figure out how to do it. Obviously it can be done using ordinary programming on the server side (JavaScript can resubmit the page when the first select's value is changed, and you can change the collection to be displayed in the second select before you resend the HTML). Erik t t wrote: Hi, all, I have two html:select as below: --- labelProperty=label/ labelProperty=label/ when user choose item2 from s1, I want to change the collection in s2 from c2 to itemC. How can I do that? Thanks in advance! Tong - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com
Re: Help needed on question regarding html:select and html:options... A problem
The problem is, when the form is submitted, it will be validated according to the validator. then error will occur since the user didn't intend to submit and he/she didn't fill other required fields. And in my acion program, I don't know how to tell whether it was submitted by javascript or by the submit button. Any idea about that? Thanks. t t [EMAIL PROTECTED] wrote: Thank you for the hint. I will try. Erik Weber wrote:I don't know exactly how do it using JavaScript. However, I know there's a way to do it. But, you'd have to have all list data downloaded to the client's browser (could be undesirable depending on list size), so you may want to rethink that approach once you figure out how to do it. Obviously it can be done using ordinary programming on the server side (JavaScript can resubmit the page when the first select's value is changed, and you can change the collection to be displayed in the second select before you resend the HTML). Erik t t wrote: Hi, all, I have two html:select as below: --- labelProperty=label/ labelProperty=label/ when user choose item2 from s1, I want to change the collection in s2 from c2 to itemC. How can I do that? Thanks in advance! Tong - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com
Re: Help needed on question regarding html:select and html:options... A problem
There may be other ways or better ways, but one thing you could do is vary the action URL. You could have the same action class serving slightly different action mappings, some with validation set to true and some with validation set to false. I did what you are trying to do in a non-Struts Servlet app, and there I just used a query string parameter to indicate which type of submit was happening (but I didn't have to worry about getting past the validator). Remember that JavaScript can change the value of a field (including a hidden field) before it submits the form. Also, another technique for conditionally using the validator is to turn automatic form validation off, override the validate method in your ActionForm, but there simply invoke the validator manually just as Struts would have done with automatic validation. This gives you a chance to insert a switch before invoking the validator. Probably there are others on the list who know a lot more about this than me and might have a better idea. Hope that helps. Erik t t wrote: The problem is, when the form is submitted, it will be validated according to the validator. then error will occur since the user didn't intend to submit and he/she didn't fill other required fields. And in my acion program, I don't know how to tell whether it was submitted by javascript or by the submit button. Any idea about that? Thanks. t t [EMAIL PROTECTED] wrote: Thank you for the hint. I will try. Erik Weber wrote:I don't know exactly how do it using JavaScript. However, I know there's a way to do it. But, you'd have to have all list data downloaded to the client's browser (could be undesirable depending on list size), so you may want to rethink that approach once you figure out how to do it. Obviously it can be done using ordinary programming on the server side (JavaScript can resubmit the page when the first select's value is changed, and you can change the collection to be displayed in the second select before you resend the HTML). Erik t t wrote: Hi, all, I have two html:select as below: --- labelProperty=label/ labelProperty=label/ when user choose item2 from s1, I want to change the collection in s2 from c2 to itemC. How can I do that? Thanks in advance! Tong - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help needed on question regarding html:select and html:options... A problem
Hi,Erik, I think that helps. I have another question. Besides the action attribute in html:form, is anywhere else we can specify another action corresponding the submission of javascript? Thanks. Tong Erik Weber [EMAIL PROTECTED] wrote: There may be other ways or better ways, but one thing you could do is vary the action URL. You could have the same action class serving slightly different action mappings, some with validation set to true and some with validation set to false. I did what you are trying to do in a non-Struts Servlet app, and there I just used a query string parameter to indicate which type of submit was happening (but I didn't have to worry about getting past the validator). Remember that JavaScript can change the value of a field (including a hidden field) before it submits the form. Also, another technique for conditionally using the validator is to turn automatic form validation off, override the validate method in your ActionForm, but there simply invoke the validator manually just as Struts would have done with automatic validation. This gives you a chance to insert a switch before invoking the validator. Probably there are others on the list who know a lot more about this than me and might have a better idea. Hope that helps. Erik t t wrote: The problem is, when the form is submitted, it will be validated according to the validator. then error will occur since the user didn't intend to submit and he/she didn't fill other required fields. And in my acion program, I don't know how to tell whether it was submitted by javascript or by the submit button. Any idea about that? Thanks. t t wrote: Thank you for the hint. I will try. Erik Weber wrote:I don't know exactly how do it using JavaScript. However, I know there's a way to do it. But, you'd have to have all list data downloaded to the client's browser (could be undesirable depending on list size), so you may want to rethink that approach once you figure out how to do it. Obviously it can be done using ordinary programming on the server side (JavaScript can resubmit the page when the first select's value is changed, and you can change the collection to be displayed in the second select before you resend the HTML). Erik t t wrote: Hi, all, I have two html:select as below: --- labelProperty=label/ labelProperty=label/ when user choose item2 from s1, I want to change the collection in s2 from c2 to itemC. How can I do that? Thanks in advance! Tong - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: Help needed on question regarding html:select and html:options... A problem
JavaScript can change the action URL on the fly. For example: http://www.willmaster.com/possibilities/archives/wmp20030527001.shtml However, I'm not sure how compatible this type of thing will be with the Struts form tag. I've never tried it. I'm surprised others aren't speaking up because the multiple submit problem comes up a lot. If you search the archives for multiple submit buttons you might find other ideas. Erik t t wrote: Hi,Erik, I think that helps. I have another question. Besides the action attribute in html:form, is anywhere else we can specify another action corresponding the submission of javascript? Thanks. Tong Erik Weber [EMAIL PROTECTED] wrote: There may be other ways or better ways, but one thing you could do is vary the action URL. You could have the same action class serving slightly different action mappings, some with validation set to true and some with validation set to false. I did what you are trying to do in a non-Struts Servlet app, and there I just used a query string parameter to indicate which type of submit was happening (but I didn't have to worry about getting past the validator). Remember that JavaScript can change the value of a field (including a hidden field) before it submits the form. Also, another technique for conditionally using the validator is to turn automatic form validation off, override the validate method in your ActionForm, but there simply invoke the validator manually just as Struts would have done with automatic validation. This gives you a chance to insert a switch before invoking the validator. Probably there are others on the list who know a lot more about this than me and might have a better idea. Hope that helps. Erik t t wrote: The problem is, when the form is submitted, it will be validated according to the validator. then error will occur since the user didn't intend to submit and he/she didn't fill other required fields. And in my acion program, I don't know how to tell whether it was submitted by javascript or by the submit button. Any idea about that? Thanks. t t wrote: Thank you for the hint. I will try. Erik Weber wrote:I don't know exactly how do it using JavaScript. However, I know there's a way to do it. But, you'd have to have all list data downloaded to the client's browser (could be undesirable depending on list size), so you may want to rethink that approach once you figure out how to do it. Obviously it can be done using ordinary programming on the server side (JavaScript can resubmit the page when the first select's value is changed, and you can change the collection to be displayed in the second select before you resend the HTML). Erik t t wrote: Hi, all, I have two html:select as below: --- labelProperty=label/ labelProperty=label/ when user choose item2 from s1, I want to change the collection in s2 from c2 to itemC. How can I do that? Thanks in advance! Tong - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help needed on question regarding html:select and html:options... I got an idea.
Hi, Erik, I got an idea. I can insert another action before the actual action be executed. And use javascript change a hidden property before executing the added action, then I can do what i want to do in the added action. What do you think? I will try it later. Thanks for your help! Tong Erik Weber [EMAIL PROTECTED] wrote: JavaScript can change the action URL on the fly. For example: http://www.willmaster.com/possibilities/archives/wmp20030527001.shtml However, I'm not sure how compatible this type of thing will be with the Struts form tag. I've never tried it. I'm surprised others aren't speaking up because the multiple submit problem comes up a lot. If you search the archives for multiple submit buttons you might find other ideas. Erik t t wrote: Hi,Erik, I think that helps. I have another question. Besides the action attribute in html:form, is anywhere else we can specify another action corresponding the submission of javascript? Thanks. Tong Erik Weber wrote: There may be other ways or better ways, but one thing you could do is vary the action URL. You could have the same action class serving slightly different action mappings, some with validation set to true and some with validation set to false. I did what you are trying to do in a non-Struts Servlet app, and there I just used a query string parameter to indicate which type of submit was happening (but I didn't have to worry about getting past the validator). Remember that JavaScript can change the value of a field (including a hidden field) before it submits the form. Also, another technique for conditionally using the validator is to turn automatic form validation off, override the validate method in your ActionForm, but there simply invoke the validator manually just as Struts would have done with automatic validation. This gives you a chance to insert a switch before invoking the validator. Probably there are others on the list who know a lot more about this than me and might have a better idea. Hope that helps. Erik t t wrote: The problem is, when the form is submitted, it will be validated according to the validator. then error will occur since the user didn't intend to submit and he/she didn't fill other required fields. And in my acion program, I don't know how to tell whether it was submitted by javascript or by the submit button. Any idea about that? Thanks. t t wrote: Thank you for the hint. I will try. Erik Weber wrote:I don't know exactly how do it using JavaScript. However, I know there's a way to do it. But, you'd have to have all list data downloaded to the client's browser (could be undesirable depending on list size), so you may want to rethink that approach once you figure out how to do it. Obviously it can be done using ordinary programming on the server side (JavaScript can resubmit the page when the first select's value is changed, and you can change the collection to be displayed in the second select before you resend the HTML). Erik t t wrote: Hi, all, I have two html:select as below: --- labelProperty=label/ labelProperty=label/ when user choose item2 from s1, I want to change the collection in s2 from c2 to itemC. How can I do that? Thanks in advance! Tong - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com
Re: Help needed on question regarding html:select and html:options... I got an idea.
Or I can set a parameter before executing the added action. --- t t [EMAIL PROTECTED] wrote: Hi, Erik, I got an idea. I can insert another action before the actual action be executed. And use javascript change a hidden property before executing the added action, then I can do what i want to do in the added action. What do you think? I will try it later. Thanks for your help! Tong Erik Weber [EMAIL PROTECTED] wrote: JavaScript can change the action URL on the fly. For example: http://www.willmaster.com/possibilities/archives/wmp20030527001.shtml However, I'm not sure how compatible this type of thing will be with the Struts form tag. I've never tried it. I'm surprised others aren't speaking up because the multiple submit problem comes up a lot. If you search the archives for multiple submit buttons you might find other ideas. Erik t t wrote: Hi,Erik, I think that helps. I have another question. Besides the action attribute in html:form, is anywhere else we can specify another action corresponding the submission of javascript? Thanks. Tong Erik Weber wrote: There may be other ways or better ways, but one thing you could do is vary the action URL. You could have the same action class serving slightly different action mappings, some with validation set to true and some with validation set to false. I did what you are trying to do in a non-Struts Servlet app, and there I just used a query string parameter to indicate which type of submit was happening (but I didn't have to worry about getting past the validator). Remember that JavaScript can change the value of a field (including a hidden field) before it submits the form. Also, another technique for conditionally using the validator is to turn automatic form validation off, override the validate method in your ActionForm, but there simply invoke the validator manually just as Struts would have done with automatic validation. This gives you a chance to insert a switch before invoking the validator. Probably there are others on the list who know a lot more about this than me and might have a better idea. Hope that helps. Erik t t wrote: The problem is, when the form is submitted, it will be validated according to the validator. then error will occur since the user didn't intend to submit and he/she didn't fill other required fields. And in my acion program, I don't know how to tell whether it was submitted by javascript or by the submit button. Any idea about that? Thanks. t t wrote: Thank you for the hint. I will try. Erik Weber wrote:I don't know exactly how do it using JavaScript. However, I know there's a way to do it. But, you'd have to have all list data downloaded to the client's browser (could be undesirable depending on list size), so you may want to rethink that approach once you figure out how to do it. Obviously it can be done using ordinary programming on the server side (JavaScript can resubmit the page when the first select's value is changed, and you can change the collection to be displayed in the second select before you resend the HTML). Erik t t wrote: Hi, all, I have two html:select as below: --- labelProperty=label/ labelProperty=label/ when user choose item2 from s1, I want to change the collection in s2 from c2 to itemC. How can I do that? Thanks in advance! Tong - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com === message truncated === __ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help needed on question regarding html:select and html:options...cannot turn off validator
How can I turn off validator? THanks. --- t t [EMAIL PROTECTED] wrote: Or I can set a parameter before executing the added action. --- t t [EMAIL PROTECTED] wrote: Hi, Erik, I got an idea. I can insert another action before the actual action be executed. And use javascript change a hidden property before executing the added action, then I can do what i want to do in the added action. What do you think? I will try it later. Thanks for your help! Tong Erik Weber [EMAIL PROTECTED] wrote: JavaScript can change the action URL on the fly. For example: http://www.willmaster.com/possibilities/archives/wmp20030527001.shtml However, I'm not sure how compatible this type of thing will be with the Struts form tag. I've never tried it. I'm surprised others aren't speaking up because the multiple submit problem comes up a lot. If you search the archives for multiple submit buttons you might find other ideas. Erik t t wrote: Hi,Erik, I think that helps. I have another question. Besides the action attribute in html:form, is anywhere else we can specify another action corresponding the submission of javascript? Thanks. Tong Erik Weber wrote: There may be other ways or better ways, but one thing you could do is vary the action URL. You could have the same action class serving slightly different action mappings, some with validation set to true and some with validation set to false. I did what you are trying to do in a non-Struts Servlet app, and there I just used a query string parameter to indicate which type of submit was happening (but I didn't have to worry about getting past the validator). Remember that JavaScript can change the value of a field (including a hidden field) before it submits the form. Also, another technique for conditionally using the validator is to turn automatic form validation off, override the validate method in your ActionForm, but there simply invoke the validator manually just as Struts would have done with automatic validation. This gives you a chance to insert a switch before invoking the validator. Probably there are others on the list who know a lot more about this than me and might have a better idea. Hope that helps. Erik t t wrote: The problem is, when the form is submitted, it will be validated according to the validator. then error will occur since the user didn't intend to submit and he/she didn't fill other required fields. And in my acion program, I don't know how to tell whether it was submitted by javascript or by the submit button. Any idea about that? Thanks. t t wrote: Thank you for the hint. I will try. Erik Weber wrote:I don't know exactly how do it using JavaScript. However, I know there's a way to do it. But, you'd have to have all list data downloaded to the client's browser (could be undesirable depending on list size), so you may want to rethink that approach once you figure out how to do it. Obviously it can be done using ordinary programming on the server side (JavaScript can resubmit the page when the first select's value is changed, and you can change the collection to be displayed in the second select before you resend the HTML). Erik t t wrote: Hi, all, I have two html:select as below: --- labelProperty=label/ labelProperty=label/ when user choose item2 from s1, I want to change the collection in s2 from c2 to itemC. How can I do that? Thanks in advance! Tong - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com === message truncated === __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help needed on question regarding html:select and html:options...cannot turn off validator
There is a validate attribute to the action element in struts-config.xml. You set it to true or false. http://struts.apache.org/userGuide/dev_validator.html Erik t t wrote: How can I turn off validator? THanks. --- t t [EMAIL PROTECTED] wrote: Or I can set a parameter before executing the added action. --- t t [EMAIL PROTECTED] wrote: Hi, Erik, I got an idea. I can insert another action before the actual action be executed. And use javascript change a hidden property before executing the added action, then I can do what i want to do in the added action. What do you think? I will try it later. Thanks for your help! Tong Erik Weber [EMAIL PROTECTED] wrote: JavaScript can change the action URL on the fly. For example: http://www.willmaster.com/possibilities/archives/wmp20030527001.shtml However, I'm not sure how compatible this type of thing will be with the Struts form tag. I've never tried it. I'm surprised others aren't speaking up because the multiple submit problem comes up a lot. If you search the archives for multiple submit buttons you might find other ideas. Erik t t wrote: Hi,Erik, I think that helps. I have another question. Besides the action attribute in html:form, is anywhere else we can specify another action corresponding the submission of javascript? Thanks. Tong Erik Weber wrote: There may be other ways or better ways, but one thing you could do is vary the action URL. You could have the same action class serving slightly different action mappings, some with validation set to true and some with validation set to false. I did what you are trying to do in a non-Struts Servlet app, and there I just used a query string parameter to indicate which type of submit was happening (but I didn't have to worry about getting past the validator). Remember that JavaScript can change the value of a field (including a hidden field) before it submits the form. Also, another technique for conditionally using the validator is to turn automatic form validation off, override the validate method in your ActionForm, but there simply invoke the validator manually just as Struts would have done with automatic validation. This gives you a chance to insert a switch before invoking the validator. Probably there are others on the list who know a lot more about this than me and might have a better idea. Hope that helps. Erik t t wrote: The problem is, when the form is submitted, it will be validated according to the validator. then error will occur since the user didn't intend to submit and he/she didn't fill other required fields. And in my acion program, I don't know how to tell whether it was submitted by javascript or by the submit button. Any idea about that? Thanks. t t wrote: Thank you for the hint. I will try. Erik Weber wrote:I don't know exactly how do it using JavaScript. However, I know there's a way to do it. But, you'd have to have all list data downloaded to the client's browser (could be undesirable depending on list size), so you may want to rethink that approach once you figure out how to do it. Obviously it can be done using ordinary programming on the server side (JavaScript can resubmit the page when the first select's value is changed, and you can change the collection to be displayed in the second select before you resend the HTML). Erik t t wrote: Hi, all, I have two html:select as below: --- labelProperty=label/ labelProperty=label/ when user choose item2 from s1, I want to change the collection in s2 from c2 to itemC. How can I do that? Thanks in advance! Tong - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com === message truncated === __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: Help needed on question regarding html:select and html:options...but...
Thanks, Erik. I did set it to false. But it's still been validated when submitted. confusing... --- Erik Weber [EMAIL PROTECTED] wrote: There is a validate attribute to the action element in struts-config.xml. You set it to true or false. http://struts.apache.org/userGuide/dev_validator.html Erik t t wrote: How can I turn off validator? THanks. --- t t [EMAIL PROTECTED] wrote: Or I can set a parameter before executing the added action. --- t t [EMAIL PROTECTED] wrote: Hi, Erik, I got an idea. I can insert another action before the actual action be executed. And use javascript change a hidden property before executing the added action, then I can do what i want to do in the added action. What do you think? I will try it later. Thanks for your help! Tong Erik Weber [EMAIL PROTECTED] wrote: JavaScript can change the action URL on the fly. For example: http://www.willmaster.com/possibilities/archives/wmp20030527001.shtml However, I'm not sure how compatible this type of thing will be with the Struts form tag. I've never tried it. I'm surprised others aren't speaking up because the multiple submit problem comes up a lot. If you search the archives for multiple submit buttons you might find other ideas. Erik t t wrote: Hi,Erik, I think that helps. I have another question. Besides the action attribute in html:form, is anywhere else we can specify another action corresponding the submission of javascript? Thanks. Tong Erik Weber wrote: There may be other ways or better ways, but one thing you could do is vary the action URL. You could have the same action class serving slightly different action mappings, some with validation set to true and some with validation set to false. I did what you are trying to do in a non-Struts Servlet app, and there I just used a query string parameter to indicate which type of submit was happening (but I didn't have to worry about getting past the validator). Remember that JavaScript can change the value of a field (including a hidden field) before it submits the form. Also, another technique for conditionally using the validator is to turn automatic form validation off, override the validate method in your ActionForm, but there simply invoke the validator manually just as Struts would have done with automatic validation. This gives you a chance to insert a switch before invoking the validator. Probably there are others on the list who know a lot more about this than me and might have a better idea. Hope that helps. Erik t t wrote: The problem is, when the form is submitted, it === message truncated === __ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Help needed on question regarding html:select and html:options...cannot turn off validator
Thanks. David. I am still confused by the automatic validation. I couldn't turn it off. --- David G. Friedman [EMAIL PROTECTED] wrote: Tong, You can change the form's submit action using almost any form field type (except hidden) using the onClick or onChange methods. If you have a submit button button, you can do this: input type=submit name=Save value=save onClick=this.form.action='/save.do';return true; / To save the button name into a hidden parameter such as a hidden field ActionName, you can do this: input type=hidden name=ActionName / input type=submit name=Save value=save onClick=this.form.ActionName.value='save';return true; / input type=submit name=Delete value=delete onClick=this.form.ActionName.value=delete'; / Or even: input type=submit name=Save value=save onClick=this.form.ActionName.value=this.value; / (I might be slightly off on the ActionName.value setting property). If you choose to make the onClick invoke a function (for performing even more steps than that) and the input was a submit button, remember to NOT do a form.submit() within that JS function - it would cause a double submit when invoked from a submit button. If it isn't a submit button but some other type of button, you can probably do a form.submit() if it doesn't do it automatically. As for preventing automatic validation in an Action, Erik was spot on with validate=false as an attribute and value in your action .../ mapping. Just invoke the validate method with the appropriate arguments for the Action class you're extending. And finally, on your topic of making one select change another select, the only way I know (and did this once, long ago) was to set a javascript function to be called by the first one's onClick or onChange method. That function can be passed the this.form object, then get to the second pulldown by name or id, delete every select item, then add each new item. Creative use of the iterate tag plus javascript can do it, or you could find good examples if you google - that's how I learned how to do it. Regards, David -Original Message- From: t t [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 10, 2004 6:41 PM To: Struts Users Mailing List Subject: Re: Help needed on question regarding html:select and html:options...cannot turn off validator How can I turn off validator? THanks. --- t t [EMAIL PROTECTED] wrote: Or I can set a parameter before executing the added action. --- t t [EMAIL PROTECTED] wrote: Hi, Erik, I got an idea. I can insert another action before the actual action be executed. And use javascript change a hidden property before executing the added action, then I can do what i want to do in the added action. What do you think? I will try it later. Thanks for your help! Tong Erik Weber [EMAIL PROTECTED] wrote: JavaScript can change the action URL on the fly. For example: http://www.willmaster.com/possibilities/archives/wmp20030527001.shtml However, I'm not sure how compatible this type of thing will be with the Struts form tag. I've never tried it. I'm surprised others aren't speaking up because the multiple submit problem comes up a lot. If you search the archives for multiple submit buttons you might find other ideas. Erik t t wrote: Hi,Erik, I think that helps. I have another question. Besides the action attribute in html:form, is anywhere else we can specify another action corresponding the submission of javascript? Thanks. Tong Erik Weber wrote: There may be other ways or better ways, but one thing you could do is vary the action URL. You could have the same action class serving slightly different action mappings, some with validation set to true and some with validation set to false. I did what you are trying to do in a non-Struts Servlet app, and there I just used a query string parameter to indicate which type of submit was happening (but I didn't have to worry about getting past the validator). Remember that JavaScript can change the value of a field (including a hidden field) before it submits the form. Also, another technique for conditionally using the validator is to turn automatic form validation off, override the validate method in your ActionForm, but there simply invoke the validator manually just as Struts would have done with automatic validation. This gives you a chance to insert a switch before invoking the validator. Probably there are others on the list who know a lot more about this than me and might have a better idea. Hope that helps. Erik t t wrote: The problem is, when the form is submitted, it will be validated according to the validator. then error will occur since