Re: Drop-down-list
Hi Firat, thanx for the response, But in more spesific case, consider I have 2 bussiness object: - Machine contains property: int machineId, String machineName - Location contains property: int locationId, String locationName, Collection machines (instatiated as new ArrayList() contains Machine(s)) I have Collection locations (instantiated as new ArrayList() contains Location(s)) with data from database and save it to the request or session, and has listed successfully at drop down list using code below at jsp page. tr tdbean:message key=addLogBook.location //td td html:select name=logBookForm property=location.locationId html:options collection=locations property=locationId labelProperty=locationName/ /html:select /td /tr How can I make the second drop down list dynamically changes depend on what Item selected at first drop down list? The second drop down list contains Collection machines of Location. Notes: logBookForm I configured as DynaValidatorForm. Thanx for your help guys. -GI. - Original Message - From: Firat TIRYAKI [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, December 01, 2003 5:44 PM Subject: Re: Drop-down-list You can directly do it using javascript, refer to the below URL for a detailed example http://www.jguru.com/faq/view.jsp?EID=923880 F. - Original Message - From: Gede Indrawan [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, December 01, 2003 12:39 PM Subject: Drop-down-list Hi all, In case I have 2 drop-down-lists and the second drop-down-list content changed automatically if we select certain item at the first one, how can I do it in the struts world? Any references to this case? Any code example? I am totally blind to this case.. best regards -GI. - 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: Drop-down-list
You can directly do it using javascript, refer to the below URL for a detailed example http://www.jguru.com/faq/view.jsp?EID=923880 F. - Original Message - From: Gede Indrawan [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, December 01, 2003 12:39 PM Subject: Drop-down-list Hi all, In case I have 2 drop-down-lists and the second drop-down-list content changed automatically if we select certain item at the first one, how can I do it in the struts world? Any references to this case? Any code example? I am totally blind to this case.. best regards -GI. - 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: Drop-Down List - Cannot Retrieve Definition From Form Bean Null
Hi Caroline, The list should not be a session attribute. Instead, you should declare member variables inside your Form bean as follows.. public class EditorForm { String [] options; EditorBean editor; public String [] getOptions() { return options; } public EditorBean getEditor() { return this.editor; } } In your JSP page, html:select property=editor html:options property=options / /html:select Hope this helps you... Ajay My drop-down list got an error message: org.apache.jasper.JasperException: Cannot retrieve definition for form bean null I have tried to display the drop-down list in two ways: First: html:select size=1 property=editor multiple=false html:options collection=editors property=name labelProperty=name/ /html:select Second: bean:define id=editorsList name=editors scope=session / html:select property=editor size=1 multiple=false html:options collection=editorsList labelProperty=name property=value/ /html:select The editors is a Collection of EditorBean passed to the JSP this way: HttpSession session = request.getSession(); session.setAttribute( editors, editors ); and Editor Bean is: public class EditorBean { private String name; public EditorBean() {} public EditorBean( String name ) { this.name = name; } public String getName() { return name; } public void setName( String name ) { this.name = name; } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: drop-down list help
Swaroop, I am trying to implement the way you have mentioned for populating drop downs. I'm getting the following exception: javax.servlet.ServletException: Exception thrown by getter for property countries of bean dropdown Here's the code that I'm using: jsp:useBean id=dropdown scope=application class=com.xxx.DropDownCollections /jsp:useBean bean:define id=countries name=dropdown property=countries toScope=request / Bean Class: package com.xxx; public class DropDownCollections { private ArrayList countries = new ArrayList(); public Collection getCountries() { //ArrayList list = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { ex.printStackTrace(); } return countries; } public void setCountries(Collection options) { // No op, here to satisfy bean-ness. } } Any possible solution? Please inform. Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 6:36 PM To: Struts Users Mailing List Subject: RE: drop-down list help jsp:useBean id=dropdown scope=application class=com.xxx.DropdownCollections /jsp:useBean bean:define id=months name=dropdown property=months toScope=request/ html:select property=month html:options collection=months property=key labelProperty=value/ /html:select Hi this is a part of the page I developed.. (Ofcourse a commercial application..) I have a class called DropDownCollections.java Now in the class I have a method getMonths() which will return me a collection of months.. I am using the months collection to populate the options.. You can actually use an html:select instead of a nested:select The getMonths() returns a set of beans having two attributes key and value.. Key will be the month numbers 1,2,3,4.. While value will be month names Jan, Feb,.. While the dropdown is rendered the month name will be shown.. When the page is submitted the month num(key) will be set to the property 'month' Hope it helps.. Swaroop -Original Message- From: Rick Col [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 6:24 PM To: Struts Users Mailing List Subject: drop-down list help Hi, guys: I am a struts newbie. I have spent sevaral days trying build a struts page with several drop-down lists in vain. I am wondering there are any struts drop down lists examples out there. I appreciate your help. regards, __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: drop-down list help
hi, i guess u r not following the java-bean rules private ArrayList countries = new ArrayList(); public ArrayList getCountries() { // here u can populate the arraylist... as u did earlier return countries; } public void setCountries(ArrayList countries) { this.countries = countries; } this is what the java bean signature should look like -- nagi ---Original Message--- From: Struts Users Mailing List Date: Wednesday, July 23, 2003 12:54:20 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help Swaroop,I am trying to implement the way you have mentioned for populating drop downs.I'm getting the following exception:javax.servlet.ServletException: Exception thrown by getter for property countries of bean dropdownHere's the code that I'm using:jsp:useBean id="dropdown" scope="application" class="com.xxx.DropDownCollections"/jsp:useBeanbean:define id="countries" name="dropdown" property="countries" toScope="request" /Bean Class:package com.xxx;public class DropDownCollections {private ArrayList countries = new ArrayList();public Collection getCountries() {//ArrayList list = new ArrayList();try{countries.add(new LabelValueBean("Australia", "1000"));countries.add(new LabelValueBean("New Zealand", "1001"));countries.add(new LabelValueBean("India", "1003"));} catch (Exception ex) {ex.printStackTrace();}return countries;}public void setCountries(Collection options) {// No op, here to satisfy bean-ness.}}Any possible solution? Please inform.Sriram-Original Message-From: Swaroop George [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 22, 2003 6:36 PMTo: Struts Users Mailing ListSubject: RE: drop-down list helpjsp:useBean id="dropdown" scope="application" class="com.xxx.DropdownCollections"/jsp:useBeanbean:define id="months" name="dropdown" property="months" toScope="request"/html:select property="month html:options collection="months" property="key" labelProperty="value"//html:select Hi this is a part of the page I developed.. (Ofcourse a commercialapplication..) I have a class called DropDownCollections.java Now in the class I have a method getMonths() which will return me a collection of months..I am using the months collection to populate the options..You can actually use an html:select instead of a nested:selectThe getMonths() returns a set of beans having two attributes key and value.. Key will be the month numbers 1,2,3,4.. While value will be month names Jan, Feb,.. While the dropdown is rendered the month name will be shown.. When the page is submitted the month num(key) will be set to the property 'month'Hope it helps..Swaroop-Original Message-From: Rick Col [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 22, 2003 6:24 PMTo: Struts Users Mailing ListSubject: drop-down list helpHi, guys:I am a struts newbie. I have spent sevaral days tryingbuild a struts page with several drop-down lists invain. I am wondering there are any struts drop downlists examples out there. I appreciate your help. regards,__Do you Yahoo!?SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com-To unsubscribe, e-mail: [EMAIL PROTECTED]For additional commands, e-mail: [EMAIL PROTECTED]-To unsubscribe, e-mail: [EMAIL PROTECTED]For additional commands, e-mail: [EMAIL PROTECTED] IncrediMail - Email has finally evolved - Click Here
RE: drop-down list help
I cant figure out whats wrong in ur approach..Seems to be perfectly alright.. However I have never used LabelValueBean.. Are u getting any stack trace display for which u have given } catch (Exception ex) { ex.printStackTrace(); } It is actually calling the getter method.. but something is happening inside the getter method. Why don't u try instantiating the array list in the getter method itself.. Swaroop -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 10:39 AM To: 'Struts Users Mailing List' Subject: RE: drop-down list help Swaroop, I am trying to implement the way you have mentioned for populating drop downs. I'm getting the following exception: javax.servlet.ServletException: Exception thrown by getter for property countries of bean dropdown Here's the code that I'm using: jsp:useBean id=dropdown scope=application class=com.xxx.DropDownCollections /jsp:useBean bean:define id=countries name=dropdown property=countries toScope=request / Bean Class: package com.xxx; public class DropDownCollections { private ArrayList countries = new ArrayList(); public Collection getCountries() { //ArrayList list = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { ex.printStackTrace(); } return countries; } public void setCountries(Collection options) { // No op, here to satisfy bean-ness. } } Any possible solution? Please inform. Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 6:36 PM To: Struts Users Mailing List Subject: RE: drop-down list help jsp:useBean id=dropdown scope=application class=com.xxx.DropdownCollections /jsp:useBean bean:define id=months name=dropdown property=months toScope=request/ html:select property=month html:options collection=months property=key labelProperty=value/ /html:select Hi this is a part of the page I developed.. (Ofcourse a commercial application..) I have a class called DropDownCollections.java Now in the class I have a method getMonths() which will return me a collection of months.. I am using the months collection to populate the options.. You can actually use an html:select instead of a nested:select The getMonths() returns a set of beans having two attributes key and value.. Key will be the month numbers 1,2,3,4.. While value will be month names Jan, Feb,.. While the dropdown is rendered the month name will be shown.. When the page is submitted the month num(key) will be set to the property 'month' Hope it helps.. Swaroop -Original Message- From: Rick Col [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 6:24 PM To: Struts Users Mailing List Subject: drop-down list help Hi, guys: I am a struts newbie. I have spent sevaral days trying build a struts page with several drop-down lists in vain. I am wondering there are any struts drop down lists examples out there. I appreciate your help. regards, __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: drop-down list help
) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619) at java.lang.Thread.run(Thread.java:536) In stack trace, it's showing an error at line 199 of userview_jsp.java. This line has the following code: if (_jspx_th_bean_define_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) Further down the stack trace (not pasted above), it's showing error at line 2073 of the same file and the code in that line is: } catch (Throwable t) { out = _jspx_out; if (out != null out.getBufferSize() != 0) out.clearBuffer(); if (pageContext != null) pageContext.handlePageException(t); -- line 2073 } Can you get any idea about why it's giving that error from the above information? Pl. inform. Sriram -Original Message- From: Nagendra Kumar O V S [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 1:27 PM To: [EMAIL PROTECTED] Subject: RE: drop-down list help hi, i guess u r not following the java-bean rules private ArrayList countries = new ArrayList(); public ArrayList getCountries() { // here u can populate the arraylist... as u did earlier return countries; } public void setCountries(ArrayList countries) { this.countries = countries; } this is what the java bean signature should look like -- nagi ---Original Message--- From: Struts Users Mailing mailto:[EMAIL PROTECTED] List Date: Wednesday, July 23, 2003 12:54:20 PM To: 'Struts Users Mailing mailto:[EMAIL PROTECTED] List' Subject: RE: drop-down list help Swaroop, I am trying to implement the way you have mentioned for populating drop downs. I'm getting the following exception: javax.servlet.ServletException: Exception thrown by getter for property countries of bean dropdown Here's the code that I'm using: jsp:useBean id=dropdown scope=application class=com.xxx.DropDownCollections /jsp:useBean bean:define id=countries name=dropdown property=countries toScope=request / Bean Class: package com.xxx; public class DropDownCollections { private ArrayList countries = new ArrayList(); public Collection getCountries() { //ArrayList list = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { ex.printStackTrace(); } return countries; } public void setCountries(Collection options) { // No op, here to satisfy bean-ness. } } Any possible solution? Please inform. Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Tuesday, July 22, 2003 6:36 PM To: Struts Users Mailing List Subject: RE: drop-down list help jsp:useBean id=dropdown scope=application class=com.xxx.DropdownCollections /jsp:useBean bean:define id=months name=dropdown property=months toScope=request/ html:select property=month html:options collection=months property=key labelProperty=value/ /html:select Hi this is a part of the page I developed.. (Ofcourse a commercial application..) I have a class called DropDownCollections.java Now in the class I have a method getMonths() which will return me a collection of months.. I am using the months collection to populate the options.. You can actually use an html:select instead of a nested:select The getMonths() returns a set of beans having two attributes key and value.. Key will be the month numbers 1,2,3,4.. While value will be month names Jan, Feb,.. While the dropdown is rendered the month name will be shown.. When the page is submitted the month num(key) will be set to the property 'month' Hope it helps.. Swaroop -Original Message- From: Rick Col [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Tuesday, July 22, 2003 6:24 PM To: Struts Users Mailing List Subject: drop-down list help Hi, guys: I am a struts newbie. I have spent sevaral days trying build a struts page with several drop-down lists in vain. I am wondering there are any struts drop down lists examples out there. I appreciate your help. regards, __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] http://www.incredimail.com/redir.asp?ad_id=309lang=9 IncrediMail - Email has finally evolved - http://www.incredimail.com/redir.asp?ad_id=309lang=9 Click
RE: drop-down list help
Swaroop, I tried instantiating the array list in the getter method itself as follows: public ArrayList getCountries() { ArrayList countries = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { ex.printStackTrace(); } return countries; } Still same problem! I guess there could be some problem with bean:define id=countries name=dropdown property=countries toScope=request/ Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 1:22 PM To: Struts Users Mailing List Subject: RE: drop-down list help I cant figure out whats wrong in ur approach..Seems to be perfectly alright.. However I have never used LabelValueBean.. Are u getting any stack trace display for which u have given } catch (Exception ex) { ex.printStackTrace(); } It is actually calling the getter method.. but something is happening inside the getter method. Why don't u try instantiating the array list in the getter method itself.. Swaroop -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 10:39 AM To: 'Struts Users Mailing List' Subject: RE: drop-down list help Swaroop, I am trying to implement the way you have mentioned for populating drop downs. I'm getting the following exception: javax.servlet.ServletException: Exception thrown by getter for property countries of bean dropdown Here's the code that I'm using: jsp:useBean id=dropdown scope=application class=com.xxx.DropDownCollections /jsp:useBean bean:define id=countries name=dropdown property=countries toScope=request / Bean Class: package com.xxx; public class DropDownCollections { private ArrayList countries = new ArrayList(); public Collection getCountries() { //ArrayList list = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { ex.printStackTrace(); } return countries; } public void setCountries(Collection options) { // No op, here to satisfy bean-ness. } } Any possible solution? Please inform. Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 6:36 PM To: Struts Users Mailing List Subject: RE: drop-down list help jsp:useBean id=dropdown scope=application class=com.xxx.DropdownCollections /jsp:useBean bean:define id=months name=dropdown property=months toScope=request/ html:select property=month html:options collection=months property=key labelProperty=value/ /html:select Hi this is a part of the page I developed.. (Ofcourse a commercial application..) I have a class called DropDownCollections.java Now in the class I have a method getMonths() which will return me a collection of months.. I am using the months collection to populate the options.. You can actually use an html:select instead of a nested:select The getMonths() returns a set of beans having two attributes key and value.. Key will be the month numbers 1,2,3,4.. While value will be month names Jan, Feb,.. While the dropdown is rendered the month name will be shown.. When the page is submitted the month num(key) will be set to the property 'month' Hope it helps.. Swaroop -Original Message- From: Rick Col [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 6:24 PM To: Struts Users Mailing List Subject: drop-down list help Hi, guys: I am a struts newbie. I have spent sevaral days trying build a struts page with several drop-down lists in vain. I am wondering there are any struts drop down lists examples out there. I appreciate your help. regards, __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: drop-down list help
Sriram, } catch (Exception ex) { ex.printStackTrace(); } This exception block wont be shown on the JSP page.. but will be shown on ur appserver's output window. Check whether any such exception is being thrown.. Swaroop -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:00 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help Nagendra, I have modified the bean as follows: public class DropDownCollections { private ArrayList countries = new ArrayList(); public ArrayList getCountries() { ArrayList list = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { ex.printStackTrace(); } return countries; } public void setCountries(ArrayList countries) { this.countries = (ArrayList)countries; } } Still I'm getting the same error. The stack trace is given below: javax.servlet.jsp.JspException: Exception thrown by getter for property countries of bean dropdown at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:964) at org.apache.struts.taglib.bean.DefineTag.doEndTag(DefineTag.java:266) at org.apache.jsp.userview_jsp._jspService(userview_jsp.java:199) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja va:210) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatc her.java:684) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDisp atcher.java:432) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispat ! cher.java:356) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.jav a:1069) at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestPr ocessor.java:455) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java: 279) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica tionFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt erChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv e.java:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invok! e(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv e.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.ja va:246) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 80) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:241 5) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java :180) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatc! herValve.java:171) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java :172) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:509 ) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 80) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. java:174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke
RE: drop-down list help
Swaroop, I have given a system.out.println statement in catch block (as follows): public ArrayList getCountries() { ArrayList countries = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { System.out.println(.exception); ex.printStackTrace(); } return countries; } But nothing is printed on app. server console except for the exception that I've mentioned before. Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:13 PM To: Struts Users Mailing List Subject: RE: drop-down list help Sriram, } catch (Exception ex) { ex.printStackTrace(); } This exception block wont be shown on the JSP page.. but will be shown on ur appserver's output window. Check whether any such exception is being thrown.. Swaroop -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:00 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help Nagendra, I have modified the bean as follows: public class DropDownCollections { private ArrayList countries = new ArrayList(); public ArrayList getCountries() { ArrayList list = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { ex.printStackTrace(); } return countries; } public void setCountries(ArrayList countries) { this.countries = (ArrayList)countries; } } Still I'm getting the same error. The stack trace is given below: javax.servlet.jsp.JspException: Exception thrown by getter for property countries of bean dropdown at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:964) at org.apache.struts.taglib.bean.DefineTag.doEndTag(DefineTag.java:266) at org.apache.jsp.userview_jsp._jspService(userview_jsp.java:199) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja va:210) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatc her.java:684) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDisp atcher.java:432) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispat ! cher.java:356) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.jav a:1069) at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestPr ocessor.java:455) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java: 279) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica tionFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt erChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv e.java:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invok! e(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv e.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.ja va:246) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 80) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:241 5) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java :180) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke
RE: drop-down list help
Think I got it.. Change ur method as public Collection getCountries() and try.. Swaroop -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:17 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help Swaroop, I have given a system.out.println statement in catch block (as follows): public ArrayList getCountries() { ArrayList countries = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { System.out.println(.exception); ex.printStackTrace(); } return countries; } But nothing is printed on app. server console except for the exception that I've mentioned before. Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:13 PM To: Struts Users Mailing List Subject: RE: drop-down list help Sriram, } catch (Exception ex) { ex.printStackTrace(); } This exception block wont be shown on the JSP page.. but will be shown on ur appserver's output window. Check whether any such exception is being thrown.. Swaroop -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:00 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help Nagendra, I have modified the bean as follows: public class DropDownCollections { private ArrayList countries = new ArrayList(); public ArrayList getCountries() { ArrayList list = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { ex.printStackTrace(); } return countries; } public void setCountries(ArrayList countries) { this.countries = (ArrayList)countries; } } Still I'm getting the same error. The stack trace is given below: javax.servlet.jsp.JspException: Exception thrown by getter for property countries of bean dropdown at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:964) at org.apache.struts.taglib.bean.DefineTag.doEndTag(DefineTag.java:266) at org.apache.jsp.userview_jsp._jspService(userview_jsp.java:199) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja va:210) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatc her.java:684) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDisp atcher.java:432) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispat ! cher.java:356) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.jav a:1069) at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestPr ocessor.java:455) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java: 279) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica tionFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt erChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv e.java:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invok! e(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv e.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.ja va:246) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 80) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:241 5
RE: drop-down list help
:-( Same error! I modified the function as follows: public Collection getCountries() { ArrayList countries = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { System.out.println(.exception); ex.printStackTrace(); } return countries; } In my jsp page, I have given println statements to trace out where exactly the problem is: % System.out.println(Step 1); % jsp:useBean id=dropdown scope=application class=com.xxx.utils.DropDownCollections/ % System.out.println(Step 2); % bean:define id=countries name=dropdown property=countries toScope=request/ % System.out.println(Step 3); % The output on the console is: 15:02:53,937 INFO [STDOUT] Step 1 15:02:53,957 INFO [STDOUT] Step 2 15:02:54,147 ERROR [Engine] ApplicationDispatcher[/mobilemail_1_0] Servlet.servi ce() for servlet jsp threw exception org.apache.jasper.JasperException: Exception thrown by getter for property count ries of bean dropdown Step 1 and Step2 statements are printed on the console but Step 3 is not printed. So, there's something wrong in bean:define/ Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:49 PM To: Struts Users Mailing List Subject: RE: drop-down list help Think I got it.. Change ur method as public Collection getCountries() and try.. Swaroop -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:17 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help Swaroop, I have given a system.out.println statement in catch block (as follows): public ArrayList getCountries() { ArrayList countries = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { System.out.println(.exception); ex.printStackTrace(); } return countries; } But nothing is printed on app. server console except for the exception that I've mentioned before. Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:13 PM To: Struts Users Mailing List Subject: RE: drop-down list help Sriram, } catch (Exception ex) { ex.printStackTrace(); } This exception block wont be shown on the JSP page.. but will be shown on ur appserver's output window. Check whether any such exception is being thrown.. Swaroop -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:00 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help Nagendra, I have modified the bean as follows: public class DropDownCollections { private ArrayList countries = new ArrayList(); public ArrayList getCountries() { ArrayList list = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { ex.printStackTrace(); } return countries; } public void setCountries(ArrayList countries) { this.countries = (ArrayList)countries; } } Still I'm getting the same error. The stack trace is given below: javax.servlet.jsp.JspException: Exception thrown by getter for property countries of bean dropdown at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:964) at org.apache.struts.taglib.bean.DefineTag.doEndTag(DefineTag.java:266) at org.apache.jsp.userview_jsp._jspService(userview_jsp.java:199) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja va:210) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatc her.java:684) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDisp atcher.java:432
RE: drop-down list help
Yes I know that there is something wrong in bean:define. As the next step remove the try {} catch{} block in the getCountries method. Let it show up where exactly its failing.. -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 3:00 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help :-( Same error! I modified the function as follows: public Collection getCountries() { ArrayList countries = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { System.out.println(.exception); ex.printStackTrace(); } return countries; } In my jsp page, I have given println statements to trace out where exactly the problem is: % System.out.println(Step 1); % jsp:useBean id=dropdown scope=application class=com.xxx.utils.DropDownCollections/ % System.out.println(Step 2); % bean:define id=countries name=dropdown property=countries toScope=request/ % System.out.println(Step 3); % The output on the console is: 15:02:53,937 INFO [STDOUT] Step 1 15:02:53,957 INFO [STDOUT] Step 2 15:02:54,147 ERROR [Engine] ApplicationDispatcher[/mobilemail_1_0] Servlet.servi ce() for servlet jsp threw exception org.apache.jasper.JasperException: Exception thrown by getter for property count ries of bean dropdown Step 1 and Step2 statements are printed on the console but Step 3 is not printed. So, there's something wrong in bean:define/ Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:49 PM To: Struts Users Mailing List Subject: RE: drop-down list help Think I got it.. Change ur method as public Collection getCountries() and try.. Swaroop -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:17 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help Swaroop, I have given a system.out.println statement in catch block (as follows): public ArrayList getCountries() { ArrayList countries = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { System.out.println(.exception); ex.printStackTrace(); } return countries; } But nothing is printed on app. server console except for the exception that I've mentioned before. Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:13 PM To: Struts Users Mailing List Subject: RE: drop-down list help Sriram, } catch (Exception ex) { ex.printStackTrace(); } This exception block wont be shown on the JSP page.. but will be shown on ur appserver's output window. Check whether any such exception is being thrown.. Swaroop -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:00 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help Nagendra, I have modified the bean as follows: public class DropDownCollections { private ArrayList countries = new ArrayList(); public ArrayList getCountries() { ArrayList list = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { ex.printStackTrace(); } return countries; } public void setCountries(ArrayList countries) { this.countries = (ArrayList)countries; } } Still I'm getting the same error. The stack trace is given below: javax.servlet.jsp.JspException: Exception thrown by getter for property countries of bean dropdown at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:964) at org.apache.struts.taglib.bean.DefineTag.doEndTag(DefineTag.java:266) at org.apache.jsp.userview_jsp._jspService(userview_jsp.java:199) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja va:210) at org.apache.jasper.servlet.JspServlet.serviceJspFile
RE: drop-down list help
Swaroop, I have made a change to bean:define. I removed 'property' -- (If not specified, the bean identified by name is given a new reference identified by id.) Then my println statements are working till Step 3. So, I presume the previous problem is solved. There's some problem now with html:select. Trying to debug that: 15:23:26,419 ERROR [Engine] ApplicationDispatcher[/mobilemail_1_0] Servlet.servi ce() for servlet jsp threw exception org.apache.jasper.JasperException: Cannot create iterator for [EMAIL PROTECTED] Probably I need to use html:optionsCollection instead of html:options Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 3:12 PM To: Struts Users Mailing List Subject: RE: drop-down list help Yes I know that there is something wrong in bean:define. As the next step remove the try {} catch{} block in the getCountries method. Let it show up where exactly its failing.. -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 3:00 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help :-( Same error! I modified the function as follows: public Collection getCountries() { ArrayList countries = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { System.out.println(.exception); ex.printStackTrace(); } return countries; } In my jsp page, I have given println statements to trace out where exactly the problem is: % System.out.println(Step 1); % jsp:useBean id=dropdown scope=application class=com.xxx.utils.DropDownCollections/ % System.out.println(Step 2); % bean:define id=countries name=dropdown property=countries toScope=request/ % System.out.println(Step 3); % The output on the console is: 15:02:53,937 INFO [STDOUT] Step 1 15:02:53,957 INFO [STDOUT] Step 2 15:02:54,147 ERROR [Engine] ApplicationDispatcher[/mobilemail_1_0] Servlet.servi ce() for servlet jsp threw exception org.apache.jasper.JasperException: Exception thrown by getter for property count ries of bean dropdown Step 1 and Step2 statements are printed on the console but Step 3 is not printed. So, there's something wrong in bean:define/ Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:49 PM To: Struts Users Mailing List Subject: RE: drop-down list help Think I got it.. Change ur method as public Collection getCountries() and try.. Swaroop -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:17 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help Swaroop, I have given a system.out.println statement in catch block (as follows): public ArrayList getCountries() { ArrayList countries = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { System.out.println(.exception); ex.printStackTrace(); } return countries; } But nothing is printed on app. server console except for the exception that I've mentioned before. Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:13 PM To: Struts Users Mailing List Subject: RE: drop-down list help Sriram, } catch (Exception ex) { ex.printStackTrace(); } This exception block wont be shown on the JSP page.. but will be shown on ur appserver's output window. Check whether any such exception is being thrown.. Swaroop -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:00 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help Nagendra, I have modified the bean as follows: public class DropDownCollections { private ArrayList countries = new ArrayList(); public ArrayList getCountries() { ArrayList list = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { ex.printStackTrace
RE: drop-down list help
I don't think u r proceeding the right way.. When u removed property what has happened is u have eliminated the getCountries method call.. and thus u r able to see ur 3rd print statement. U need to have the property cauz the collection u need is an attribute of the DropDownCollections class, not the DropDownCollections class itself..(which is why its saying Cannot create iterator for DropDownCollections).. Internally it creates an iterator out of the collection returned which its not able to create cauz there is no collection returned at all.. I doubt ur new LabelValueBean is throwing an error. Please do remove the exception handling from ur class.. -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 3:21 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help Swaroop, I have made a change to bean:define. I removed 'property' -- (If not specified, the bean identified by name is given a new reference identified by id.) Then my println statements are working till Step 3. So, I presume the previous problem is solved. There's some problem now with html:select. Trying to debug that: 15:23:26,419 ERROR [Engine] ApplicationDispatcher[/mobilemail_1_0] Servlet.servi ce() for servlet jsp threw exception org.apache.jasper.JasperException: Cannot create iterator for [EMAIL PROTECTED] Probably I need to use html:optionsCollection instead of html:options Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 3:12 PM To: Struts Users Mailing List Subject: RE: drop-down list help Yes I know that there is something wrong in bean:define. As the next step remove the try {} catch{} block in the getCountries method. Let it show up where exactly its failing.. -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 3:00 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help :-( Same error! I modified the function as follows: public Collection getCountries() { ArrayList countries = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { System.out.println(.exception); ex.printStackTrace(); } return countries; } In my jsp page, I have given println statements to trace out where exactly the problem is: % System.out.println(Step 1); % jsp:useBean id=dropdown scope=application class=com.xxx.utils.DropDownCollections/ % System.out.println(Step 2); % bean:define id=countries name=dropdown property=countries toScope=request/ % System.out.println(Step 3); % The output on the console is: 15:02:53,937 INFO [STDOUT] Step 1 15:02:53,957 INFO [STDOUT] Step 2 15:02:54,147 ERROR [Engine] ApplicationDispatcher[/mobilemail_1_0] Servlet.servi ce() for servlet jsp threw exception org.apache.jasper.JasperException: Exception thrown by getter for property count ries of bean dropdown Step 1 and Step2 statements are printed on the console but Step 3 is not printed. So, there's something wrong in bean:define/ Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:49 PM To: Struts Users Mailing List Subject: RE: drop-down list help Think I got it.. Change ur method as public Collection getCountries() and try.. Swaroop -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:17 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help Swaroop, I have given a system.out.println statement in catch block (as follows): public ArrayList getCountries() { ArrayList countries = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { System.out.println(.exception); ex.printStackTrace(); } return countries; } But nothing is printed on app. server console except for the exception that I've mentioned before. Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:13 PM To: Struts Users Mailing List Subject: RE: drop-down list help Sriram, } catch (Exception ex
RE: drop-down list help
Yes, what you said is correct. I removed the try, catch block from getCountries() method, but still I'm getting the same error. -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 3:34 PM To: Struts Users Mailing List Subject: RE: drop-down list help I don't think u r proceeding the right way.. When u removed property what has happened is u have eliminated the getCountries method call.. and thus u r able to see ur 3rd print statement. U need to have the property cauz the collection u need is an attribute of the DropDownCollections class, not the DropDownCollections class itself..(which is why its saying Cannot create iterator for DropDownCollections).. Internally it creates an iterator out of the collection returned which its not able to create cauz there is no collection returned at all.. I doubt ur new LabelValueBean is throwing an error. Please do remove the exception handling from ur class.. -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 3:21 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help Swaroop, I have made a change to bean:define. I removed 'property' -- (If not specified, the bean identified by name is given a new reference identified by id.) Then my println statements are working till Step 3. So, I presume the previous problem is solved. There's some problem now with html:select. Trying to debug that: 15:23:26,419 ERROR [Engine] ApplicationDispatcher[/mobilemail_1_0] Servlet.servi ce() for servlet jsp threw exception org.apache.jasper.JasperException: Cannot create iterator for [EMAIL PROTECTED] Probably I need to use html:optionsCollection instead of html:options Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 3:12 PM To: Struts Users Mailing List Subject: RE: drop-down list help Yes I know that there is something wrong in bean:define. As the next step remove the try {} catch{} block in the getCountries method. Let it show up where exactly its failing.. -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 3:00 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help :-( Same error! I modified the function as follows: public Collection getCountries() { ArrayList countries = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { System.out.println(.exception); ex.printStackTrace(); } return countries; } In my jsp page, I have given println statements to trace out where exactly the problem is: % System.out.println(Step 1); % jsp:useBean id=dropdown scope=application class=com.xxx.utils.DropDownCollections/ % System.out.println(Step 2); % bean:define id=countries name=dropdown property=countries toScope=request/ % System.out.println(Step 3); % The output on the console is: 15:02:53,937 INFO [STDOUT] Step 1 15:02:53,957 INFO [STDOUT] Step 2 15:02:54,147 ERROR [Engine] ApplicationDispatcher[/mobilemail_1_0] Servlet.servi ce() for servlet jsp threw exception org.apache.jasper.JasperException: Exception thrown by getter for property count ries of bean dropdown Step 1 and Step2 statements are printed on the console but Step 3 is not printed. So, there's something wrong in bean:define/ Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:49 PM To: Struts Users Mailing List Subject: RE: drop-down list help Think I got it.. Change ur method as public Collection getCountries() and try.. Swaroop -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:17 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help Swaroop, I have given a system.out.println statement in catch block (as follows): public ArrayList getCountries() { ArrayList countries = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { System.out.println(.exception); ex.printStackTrace(); } return countries
RE: drop-down list help
Swaroop, You are right. I have commented LabelValueBean statements and I got the displayed with a blank dropdown list. My bean method is now as follows: public Collection getCountries() { ArrayList countries = new ArrayList(); //countries.add(new LabelValueBean(Australia, 1000)); //countries.add(new LabelValueBean(New Zealand, 1001)); //countries.add(new LabelValueBean(India, 1003)); return countries; } How to get data into this if I don't use LabelValueBean. What have you used? Can you post your code for DropDownCollections.java please? Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 3:34 PM To: Struts Users Mailing List Subject: RE: drop-down list help I don't think u r proceeding the right way.. When u removed property what has happened is u have eliminated the getCountries method call.. and thus u r able to see ur 3rd print statement. U need to have the property cauz the collection u need is an attribute of the DropDownCollections class, not the DropDownCollections class itself..(which is why its saying Cannot create iterator for DropDownCollections).. Internally it creates an iterator out of the collection returned which its not able to create cauz there is no collection returned at all.. I doubt ur new LabelValueBean is throwing an error. Please do remove the exception handling from ur class.. -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 3:21 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help Swaroop, I have made a change to bean:define. I removed 'property' -- (If not specified, the bean identified by name is given a new reference identified by id.) Then my println statements are working till Step 3. So, I presume the previous problem is solved. There's some problem now with html:select. Trying to debug that: 15:23:26,419 ERROR [Engine] ApplicationDispatcher[/mobilemail_1_0] Servlet.servi ce() for servlet jsp threw exception org.apache.jasper.JasperException: Cannot create iterator for [EMAIL PROTECTED] Probably I need to use html:optionsCollection instead of html:options Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 3:12 PM To: Struts Users Mailing List Subject: RE: drop-down list help Yes I know that there is something wrong in bean:define. As the next step remove the try {} catch{} block in the getCountries method. Let it show up where exactly its failing.. -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 3:00 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help :-( Same error! I modified the function as follows: public Collection getCountries() { ArrayList countries = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { System.out.println(.exception); ex.printStackTrace(); } return countries; } In my jsp page, I have given println statements to trace out where exactly the problem is: % System.out.println(Step 1); % jsp:useBean id=dropdown scope=application class=com.xxx.utils.DropDownCollections/ % System.out.println(Step 2); % bean:define id=countries name=dropdown property=countries toScope=request/ % System.out.println(Step 3); % The output on the console is: 15:02:53,937 INFO [STDOUT] Step 1 15:02:53,957 INFO [STDOUT] Step 2 15:02:54,147 ERROR [Engine] ApplicationDispatcher[/mobilemail_1_0] Servlet.servi ce() for servlet jsp threw exception org.apache.jasper.JasperException: Exception thrown by getter for property count ries of bean dropdown Step 1 and Step2 statements are printed on the console but Step 3 is not printed. So, there's something wrong in bean:define/ Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:49 PM To: Struts Users Mailing List Subject: RE: drop-down list help Think I got it.. Change ur method as public Collection getCountries() and try.. Swaroop -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 2:17 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help Swaroop, I have given a system.out.println statement in catch block (as follows
RE: drop-down list help
HI, well, if ur using struts1.0, LabelValueBean is no supported.. u can still get that class from the struts1.1 jar and use it... (or) u can create a simple javabean with two variables, with set,get methods and use it it is as easy -- nagi ---Original Message--- From: Struts Users Mailing List Date: Wednesday, July 23, 2003 04:09:00 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help Swaroop,You are right. I have commented LabelValueBean statements and I got the displayed with a blank dropdown list.My bean method is now as follows:public Collection getCountries() {ArrayList countries = new ArrayList();//countries.add(new LabelValueBean("Australia", "1000"));//countries.add(new LabelValueBean("New Zealand", "1001"));//countries.add(new LabelValueBean("India", "1003"));return countries;}How to get data into this if I don't use LabelValueBean. What have you used? Can you post your code for DropDownCollections.java please?Sriram-Original Message-From: Swaroop George [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 23, 2003 3:34 PMTo: Struts Users Mailing ListSubject: RE: drop-down list helpI don't think u r proceeding the right way.. When u removed property what has happened is u have eliminated the getCountries method call.. and thus u r able to see ur 3rd print statement. U need to have the property cauz the collection u need is an attribute of the DropDownCollections class, not the DropDownCollections class itself..(which is why its saying Cannot create iterator for DropDownCollections)..Internally it creates an iterator out of the collection returned which its not able to create cauz there is no collection returned at all.. I doubt ur new LabelValueBean is throwing an error. Please do remove the exception handling from ur class..-Original Message-From: sriram [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 23, 2003 3:21 PMTo: 'Struts Users Mailing List'Subject: RE: drop-down list helpSwaroop,I have made a change to bean:define.I removed 'property' -- (If not specified, the bean identified by name is given a new reference identified by id.)Then my println statements are working till Step 3. So, I presume the previous problem is solved.There's some problem now with html:select.Trying to debug that:15:23:26,419 ERROR [Engine] ApplicationDispatcher[/mobilemail_1_0]Servlet.service() for servlet jsp threw exceptionorg.apache.jasper.JasperException: Cannot create iterator for [EMAIL PROTECTED]Probably I need to use html:optionsCollection instead of html:optionsSriram-Original Message-From: Swaroop George [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 23, 2003 3:12 PMTo: Struts Users Mailing ListSubject: RE: drop-down list helpYes I know that there is something wrong in bean:define. As the next step remove the try {} catch{} block in the getCountries method. Let it show up where exactly its failing..-Original Message-From: sriram [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 23, 2003 3:00 PMTo: 'Struts Users Mailing List'Subject: RE: drop-down list help:-(Same error! I modified the function as follows:public Collection getCountries() {ArrayList countries = new ArrayList();try{countries.add(new LabelValueBean("Australia","1000"));countries.add(new LabelValueBean("New Zealand","1001"));countries.add(new LabelValueBean("India", "1003"));} catch (Exception ex) {System.out.println(".exception");ex.printStackTrace();}return countries;}In my jsp page, I have given println statements to trace out where exactly the problem is:% System.out.println("Step 1"); % jsp:useBean id="dropdown" scope="application" class="com.xxx.utils.DropDownCollections"/% System.out.println("Step 2"); %bean:define id="countries" name="dropdown" property="countries" toScope="request"/ % System.out.println("Step 3"); %The output on the console is:15:02:53,937 INFO [STDOUT] Step 1 15:02:53,957 INFO [STDOUT] Step 2 15:02:54,147 ERROR [Engine] ApplicationDispatcher[/mobilemail_1_0]Servlet.serv
RE: drop-down list help
hi, i'm using struts 1.1 and so i'm trying to use lablevaluebean. u can create a simple javabean with two variables, with set,get methods and use it it is as easy - so in my bean, i should have get and set methods for CountryID and CountryName. And how should I refer them in html:options tag? html:options property=CountryID labelProperty=CountryName/ correct? sriram -Original Message- From: Nagendra Kumar O V S [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 4:22 PM To: [EMAIL PROTECTED] Subject: RE: drop-down list help HI, well, if ur using struts1.0, LabelValueBean is no supported.. u can still get that class from the struts1.1 jar and use it... (or) u can create a simple javabean with two variables, with set,get methods and use it it is as easy -- nagi ---Original Message--- From: Struts Users Mailing mailto:[EMAIL PROTECTED] List Date: Wednesday, July 23, 2003 04:09:00 PM To: 'Struts Users Mailing mailto:[EMAIL PROTECTED] List' Subject: RE: drop-down list help Swaroop, You are right. I have commented LabelValueBean statements and I got the displayed with a blank dropdown list. My bean method is now as follows: public Collection getCountries() { ArrayList countries = new ArrayList(); //countries.add(new LabelValueBean(Australia, 1000)); //countries.add(new LabelValueBean(New Zealand, 1001)); //countries.add(new LabelValueBean(India, 1003)); return countries; } How to get data into this if I don't use LabelValueBean. What have you used? Can you post your code for DropDownCollections.java please? Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Wednesday, July 23, 2003 3:34 PM To: Struts Users Mailing List Subject: RE: drop-down list help I don't think u r proceeding the right way.. When u removed property what has happened is u have eliminated the getCountries method call.. and thus u r able to see ur 3rd print statement. U need to have the property cauz the collection u need is an attribute of the DropDownCollections class, not the DropDownCollections class itself..(which is why its saying Cannot create iterator for DropDownCollections).. Internally it creates an iterator out of the collection returned which its not able to create cauz there is no collection returned at all.. I doubt ur new LabelValueBean is throwing an error. Please do remove the exception handling from ur class.. -Original Message- From: sriram [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Wednesday, July 23, 2003 3:21 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help Swaroop, I have made a change to bean:define. I removed 'property' -- (If not specified, the bean identified by name is given a new reference identified by id.) Then my println statements are working till Step 3. So, I presume the previous problem is solved. There's some problem now with html:select. Trying to debug that: 15:23:26,419 ERROR [Engine] ApplicationDispatcher[/mobilemail_1_0] Servlet.servi ce() for servlet jsp threw exception org.apache.jasper.JasperException: Cannot create iterator for [EMAIL PROTECTED] Probably I need to use html:optionsCollection instead of html:options Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Wednesday, July 23, 2003 3:12 PM To: Struts Users Mailing List Subject: RE: drop-down list help Yes I know that there is something wrong in bean:define. As the next step remove the try {} catch{} block in the getCountries method. Let it show up where exactly its failing.. -Original Message- From: sriram [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Wednesday, July 23, 2003 3:00 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help :-( Same error! I modified the function as follows: public Collection getCountries() { ArrayList countries = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { System.out.println(.exception); ex.printStackTrace(); } return countries; } In my jsp page, I have given println statements to trace out where exactly the problem is: % System.out.println(Step 1); % jsp:useBean id=dropdown scope=application class=com.xxx.utils.DropDownCollections/ % System.out.println(Step 2); % bean:define id=countries name=dropdown property=countries toScope=request/ % System.out.println(Step 3); % The output on the console is: 15:02:53,937 INFO [STDOUT] Step 1 15:02:53,957 INFO [STDOUT] Step 2 15:02:54,147 ERROR [Engine] ApplicationDispatcher[/mobilemail_1_0] Servlet.servi ce() for servlet
RE: drop-down list help
if u r using struts 1.1... LabelValue bean should be available to u... i feel , u got to debug and find that problem rather than using a new javabean trust me , i have used the labelvaluebean many times ... it works very well for me -- nagi ---Original Message--- From: Struts Users Mailing List Date: Wednesday, July 23, 2003 04:25:49 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help hi,i'm using struts 1.1 and so i'm trying to use lablevaluebean.u can create a simple javabean with two variables, with set,get methods and use itit is as easy- so in my bean, i should have get and set methods for CountryID and CountryName.And how should I refer them in html:options tag?html:options property="CountryID" labelProperty="CountryName"/correct?sriram-Original Message-From: Nagendra Kumar O V S [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 23, 2003 4:22 PMTo: [EMAIL PROTECTED]Subject: RE: drop-down list helpHI,well, if ur using struts1.0, LabelValueBean is no supported..u can still get that class from the struts1.1 jar and use it...(or)u can create a simple javabean with two variables, with set,get methods and use itit is as easy-- nagi---Original Message---From: Struts Users Mailing mailto:[EMAIL PROTECTED] ListDate: Wednesday, July 23, 2003 04:09:00 PMTo: 'Struts Users Mailing mailto:[EMAIL PROTECTED] List'Subject: RE: drop-down list helpSwaroop,You are right. I have commented LabelValueBean statements and I got the displayed with a blank dropdown list.My bean method is now as follows:public Collection getCountries() {ArrayList countries = new ArrayList();//countries.add(new LabelValueBean("Australia", "1000"));//countries.add(new LabelValueBean("New Zealand", "1001"));//countries.add(new LabelValueBean("India", "1003"));return countries;}How to get data into this if I don't use LabelValueBean. What have you used? Can you post your code for DropDownCollections.java please?Sriram-Original Message-From: Swaroop George [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Wednesday, July 23, 2003 3:34 PMTo: Struts Users Mailing ListSubject: RE: drop-down list helpI don't think u r proceeding the right way.. When u removed property what has happened is u have eliminated the getCountries method call.. and thus u r able to see ur 3rd print statement. U need to have the property cauz the collection u need is an attribute of the DropDownCollections class, not the DropDownCollections class itself..(which is why its saying Cannot create iterator for DropDownCollections)..Internally it creates an iterator out of the collection returned which its not able to create cauz there is no collection returned at all.. I doubt ur new LabelValueBean is throwing an error. Please do remove the exception handling from ur class..-Original Message-From: sriram [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Wednesday, July 23, 2003 3:21 PMTo: 'Struts Users Mailing List'Subject: RE: drop-down list helpSwaroop,I have made a change to bean:define.I removed 'property' -- (If not specified, the bean identified by name is given a new reference identified by id.)Then my println statements are working till Step 3. So, I presume the previous problem is solved.There's some problem now with html:select.Trying to debug that:15:23:26,419 ERROR [Engine] ApplicationDispatcher[/mobilemail_1_0]Servlet.service() for servlet jsp threw exceptionorg.apache.jasper.JasperException: Cannot create iterator for [EMAIL PROTECTED]Probably I need to use html:optionsCollection instead of html:optionsSriram-Original Message-From: Swaroop George [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Wednesday, July 23, 2003 3:12 PMTo: Struts Users Mailing ListSubject: RE: drop-down list helpYes I know that there is something wrong in bean:define. As the next step remove the try {} catch{} block in the getCountries method. Let it show up where exactly its failing..-Original Message-From: sriram [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Wednesday, July 23, 2003 3:00 PMTo: 'Struts Users Mailing List'Subject: RE: drop-down list help:-(Same error! I modified the function as follows:public Collection getCountries() {ArrayList countries = new ArrayList();try{countries.add(new
RE: drop-down list help
Sriram, Did u remove the try catch block as I said.. If u remove that u will be able to know whether its an error withLabelValueBean or not.. And as you said if you are using another bean what you are doing is correct..It should work. Swaroop -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 4:19 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help hi, i'm using struts 1.1 and so i'm trying to use lablevaluebean. u can create a simple javabean with two variables, with set,get methods and use it it is as easy - so in my bean, i should have get and set methods for CountryID and CountryName. And how should I refer them in html:options tag? html:options property=CountryID labelProperty=CountryName/ correct? sriram -Original Message- From: Nagendra Kumar O V S [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 4:22 PM To: [EMAIL PROTECTED] Subject: RE: drop-down list help HI, well, if ur using struts1.0, LabelValueBean is no supported.. u can still get that class from the struts1.1 jar and use it... (or) u can create a simple javabean with two variables, with set,get methods and use it it is as easy -- nagi ---Original Message--- From: Struts Users Mailing mailto:[EMAIL PROTECTED] List Date: Wednesday, July 23, 2003 04:09:00 PM To: 'Struts Users Mailing mailto:[EMAIL PROTECTED] List' Subject: RE: drop-down list help Swaroop, You are right. I have commented LabelValueBean statements and I got the displayed with a blank dropdown list. My bean method is now as follows: public Collection getCountries() { ArrayList countries = new ArrayList(); //countries.add(new LabelValueBean(Australia, 1000)); //countries.add(new LabelValueBean(New Zealand, 1001)); //countries.add(new LabelValueBean(India, 1003)); return countries; } How to get data into this if I don't use LabelValueBean. What have you used? Can you post your code for DropDownCollections.java please? Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Wednesday, July 23, 2003 3:34 PM To: Struts Users Mailing List Subject: RE: drop-down list help I don't think u r proceeding the right way.. When u removed property what has happened is u have eliminated the getCountries method call.. and thus u r able to see ur 3rd print statement. U need to have the property cauz the collection u need is an attribute of the DropDownCollections class, not the DropDownCollections class itself..(which is why its saying Cannot create iterator for DropDownCollections).. Internally it creates an iterator out of the collection returned which its not able to create cauz there is no collection returned at all.. I doubt ur new LabelValueBean is throwing an error. Please do remove the exception handling from ur class.. -Original Message- From: sriram [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Wednesday, July 23, 2003 3:21 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help Swaroop, I have made a change to bean:define. I removed 'property' -- (If not specified, the bean identified by name is given a new reference identified by id.) Then my println statements are working till Step 3. So, I presume the previous problem is solved. There's some problem now with html:select. Trying to debug that: 15:23:26,419 ERROR [Engine] ApplicationDispatcher[/mobilemail_1_0] Servlet.servi ce() for servlet jsp threw exception org.apache.jasper.JasperException: Cannot create iterator for [EMAIL PROTECTED] Probably I need to use html:optionsCollection instead of html:options Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Wednesday, July 23, 2003 3:12 PM To: Struts Users Mailing List Subject: RE: drop-down list help Yes I know that there is something wrong in bean:define. As the next step remove the try {} catch{} block in the getCountries method. Let it show up where exactly its failing.. -Original Message- From: sriram [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Wednesday, July 23, 2003 3:00 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help :-( Same error! I modified the function as follows: public Collection getCountries() { ArrayList countries = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { System.out.println(.exception); ex.printStackTrace(); } return countries; } In my jsp page, I have given println statements to trace out where exactly the problem is: % System.out.println(Step 1); % jsp:useBean id=dropdown scope=application class=com.xxx.utils.DropDownCollections/ % System.out.println(Step 2); % bean:define
RE: drop-down list help
Oops sorry.. Sriram.. since the problem is with LabelValueBean use the separate bean which u have created html:options property=CountryID labelProperty=CountryName/ -Original Message- From: Swaroop George Sent: Wednesday, July 23, 2003 5:01 PM To: Struts Users Mailing List Subject: RE: drop-down list help Sriram, Did u remove the try catch block as I said.. If u remove that u will be able to know whether its an error withLabelValueBean or not.. And as you said if you are using another bean what you are doing is correct..It should work. Swaroop -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 4:19 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help hi, i'm using struts 1.1 and so i'm trying to use lablevaluebean. u can create a simple javabean with two variables, with set,get methods and use it it is as easy - so in my bean, i should have get and set methods for CountryID and CountryName. And how should I refer them in html:options tag? html:options property=CountryID labelProperty=CountryName/ correct? sriram -Original Message- From: Nagendra Kumar O V S [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 4:22 PM To: [EMAIL PROTECTED] Subject: RE: drop-down list help HI, well, if ur using struts1.0, LabelValueBean is no supported.. u can still get that class from the struts1.1 jar and use it... (or) u can create a simple javabean with two variables, with set,get methods and use it it is as easy -- nagi ---Original Message--- From: Struts Users Mailing mailto:[EMAIL PROTECTED] List Date: Wednesday, July 23, 2003 04:09:00 PM To: 'Struts Users Mailing mailto:[EMAIL PROTECTED] List' Subject: RE: drop-down list help Swaroop, You are right. I have commented LabelValueBean statements and I got the displayed with a blank dropdown list. My bean method is now as follows: public Collection getCountries() { ArrayList countries = new ArrayList(); //countries.add(new LabelValueBean(Australia, 1000)); //countries.add(new LabelValueBean(New Zealand, 1001)); //countries.add(new LabelValueBean(India, 1003)); return countries; } How to get data into this if I don't use LabelValueBean. What have you used? Can you post your code for DropDownCollections.java please? Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Wednesday, July 23, 2003 3:34 PM To: Struts Users Mailing List Subject: RE: drop-down list help I don't think u r proceeding the right way.. When u removed property what has happened is u have eliminated the getCountries method call.. and thus u r able to see ur 3rd print statement. U need to have the property cauz the collection u need is an attribute of the DropDownCollections class, not the DropDownCollections class itself..(which is why its saying Cannot create iterator for DropDownCollections).. Internally it creates an iterator out of the collection returned which its not able to create cauz there is no collection returned at all.. I doubt ur new LabelValueBean is throwing an error. Please do remove the exception handling from ur class.. -Original Message- From: sriram [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Wednesday, July 23, 2003 3:21 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help Swaroop, I have made a change to bean:define. I removed 'property' -- (If not specified, the bean identified by name is given a new reference identified by id.) Then my println statements are working till Step 3. So, I presume the previous problem is solved. There's some problem now with html:select. Trying to debug that: 15:23:26,419 ERROR [Engine] ApplicationDispatcher[/mobilemail_1_0] Servlet.servi ce() for servlet jsp threw exception org.apache.jasper.JasperException: Cannot create iterator for [EMAIL PROTECTED] Probably I need to use html:optionsCollection instead of html:options Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Wednesday, July 23, 2003 3:12 PM To: Struts Users Mailing List Subject: RE: drop-down list help Yes I know that there is something wrong in bean:define. As the next step remove the try {} catch{} block in the getCountries method. Let it show up where exactly its failing.. -Original Message- From: sriram [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Wednesday, July 23, 2003 3:00 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help :-( Same error! I modified the function as follows: public Collection getCountries() { ArrayList countries = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { System.out.println(.exception); ex.printStackTrace(); } return countries
RE: drop-down list help
Swaroop I have removed the try catch block, but I got the same error as before. I'm still trying to debug with LabelValueBean..haven't ventured into using another bean yet. Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 5:01 PM To: Struts Users Mailing List Subject: RE: drop-down list help Sriram, Did u remove the try catch block as I said.. If u remove that u will be able to know whether its an error withLabelValueBean or not.. And as you said if you are using another bean what you are doing is correct..It should work. Swaroop -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 4:19 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help hi, i'm using struts 1.1 and so i'm trying to use lablevaluebean. u can create a simple javabean with two variables, with set,get methods and use it it is as easy - so in my bean, i should have get and set methods for CountryID and CountryName. And how should I refer them in html:options tag? html:options property=CountryID labelProperty=CountryName/ correct? sriram -Original Message- From: Nagendra Kumar O V S [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 4:22 PM To: [EMAIL PROTECTED] Subject: RE: drop-down list help HI, well, if ur using struts1.0, LabelValueBean is no supported.. u can still get that class from the struts1.1 jar and use it... (or) u can create a simple javabean with two variables, with set,get methods and use it it is as easy -- nagi ---Original Message--- From: Struts Users Mailing mailto:[EMAIL PROTECTED] List Date: Wednesday, July 23, 2003 04:09:00 PM To: 'Struts Users Mailing mailto:[EMAIL PROTECTED] List' Subject: RE: drop-down list help Swaroop, You are right. I have commented LabelValueBean statements and I got the displayed with a blank dropdown list. My bean method is now as follows: public Collection getCountries() { ArrayList countries = new ArrayList(); //countries.add(new LabelValueBean(Australia, 1000)); //countries.add(new LabelValueBean(New Zealand, 1001)); //countries.add(new LabelValueBean(India, 1003)); return countries; } How to get data into this if I don't use LabelValueBean. What have you used? Can you post your code for DropDownCollections.java please? Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Wednesday, July 23, 2003 3:34 PM To: Struts Users Mailing List Subject: RE: drop-down list help I don't think u r proceeding the right way.. When u removed property what has happened is u have eliminated the getCountries method call.. and thus u r able to see ur 3rd print statement. U need to have the property cauz the collection u need is an attribute of the DropDownCollections class, not the DropDownCollections class itself..(which is why its saying Cannot create iterator for DropDownCollections).. Internally it creates an iterator out of the collection returned which its not able to create cauz there is no collection returned at all.. I doubt ur new LabelValueBean is throwing an error. Please do remove the exception handling from ur class.. -Original Message- From: sriram [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Wednesday, July 23, 2003 3:21 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help Swaroop, I have made a change to bean:define. I removed 'property' -- (If not specified, the bean identified by name is given a new reference identified by id.) Then my println statements are working till Step 3. So, I presume the previous problem is solved. There's some problem now with html:select. Trying to debug that: 15:23:26,419 ERROR [Engine] ApplicationDispatcher[/mobilemail_1_0] Servlet.servi ce() for servlet jsp threw exception org.apache.jasper.JasperException: Cannot create iterator for [EMAIL PROTECTED] Probably I need to use html:optionsCollection instead of html:options Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Wednesday, July 23, 2003 3:12 PM To: Struts Users Mailing List Subject: RE: drop-down list help Yes I know that there is something wrong in bean:define. As the next step remove the try {} catch{} block in the getCountries method. Let it show up where exactly its failing.. -Original Message- From: sriram [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Wednesday, July 23, 2003 3:00 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help :-( Same error! I modified the function as follows: public Collection getCountries() { ArrayList countries = new ArrayList(); try{ countries.add(new LabelValueBean(Australia, 1000)); countries.add(new LabelValueBean(New Zealand, 1001)); countries.add(new LabelValueBean(India, 1003)); } catch (Exception ex) { System.out.println
RE: drop-down list help
Good afternoon, I have just changed one of my forms to use the DynaValidatorForm and I'm not convinced of the benifits of it! I remove the Form with the getX() and setX() methods and also validate() and reset(), so I have less classes floating about. But now I don't have the reset method which we were using to pre populate some of the jsp form. Building the Form class was not really a problem using the generate getters and setters functionality of Eclipse, which makes me wonder what are the real benifits of DynaValidatorForms? Thanks in advance IV - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: drop-down list help
It's beneficial for simple forms that are initalized to null. For more complex stuff do it the old way. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 8:26 AM To: [EMAIL PROTECTED] Subject: RE: drop-down list help Good afternoon, I have just changed one of my forms to use the DynaValidatorForm and I'm not convinced of the benifits of it! I remove the Form with the getX() and setX() methods and also validate() and reset(), so I have less classes floating about. But now I don't have the reset method which we were using to pre populate some of the jsp form. Building the Form class was not really a problem using the generate getters and setters functionality of Eclipse, which makes me wonder what are the real benifits of DynaValidatorForms? Thanks in advance IV - 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: drop-down list help
The examples are in the struts war: [struts.war]/webapps/struts-exercise-taglib.war. They are also http://jakarta.apache.org/struts/resources/projects.html. Suzette H. Daniel Java Developer/Web dept 770 416.9222 ex: 5041 -Original Message- From: Rick Col [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 8:54 AM To: Struts Users Mailing List Subject: drop-down list help Hi, guys: I am a struts newbie. I have spent sevaral days trying build a struts page with several drop-down lists in vain. I am wondering there are any struts drop down lists examples out there. I appreciate your help. regards, __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: drop-down list help
jsp:useBean id=dropdown scope=application class=com.xxx.DropdownCollections /jsp:useBean bean:define id=months name=dropdown property=months toScope=request/ html:select property=month html:options collection=months property=key labelProperty=value/ /html:select Hi this is a part of the page I developed.. (Ofcourse a commercial application..) I have a class called DropDownCollections.java Now in the class I have a method getMonths() which will return me a collection of months.. I am using the months collection to populate the options.. You can actually use an html:select instead of a nested:select The getMonths() returns a set of beans having two attributes key and value.. Key will be the month numbers 1,2,3,4.. While value will be month names Jan, Feb,.. While the dropdown is rendered the month name will be shown.. When the page is submitted the month num(key) will be set to the property 'month' Hope it helps.. Swaroop -Original Message- From: Rick Col [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 6:24 PM To: Struts Users Mailing List Subject: drop-down list help Hi, guys: I am a struts newbie. I have spent sevaral days trying build a struts page with several drop-down lists in vain. I am wondering there are any struts drop down lists examples out there. I appreciate your help. regards, __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: drop-down list help
Swaroop, Even I am looking for code for drop-down lists. Are you using LabelValueBean in DropDownCollections.java? Is there any alternative to LabelValueBean - I tried using Struts 1.1 but I'm facing lot of problems while deploying. And I am in a hurry to get this task completed. So, I am looking for developing code for drop-downs using struts 1.0 (that means I can't use LabelValueBean). Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 6:36 PM To: Struts Users Mailing List Subject: RE: drop-down list help jsp:useBean id=dropdown scope=application class=com.xxx.DropdownCollections /jsp:useBean bean:define id=months name=dropdown property=months toScope=request/ html:select property=month html:options collection=months property=key labelProperty=value/ /html:select Hi this is a part of the page I developed.. (Ofcourse a commercial application..) I have a class called DropDownCollections.java Now in the class I have a method getMonths() which will return me a collection of months.. I am using the months collection to populate the options.. You can actually use an html:select instead of a nested:select The getMonths() returns a set of beans having two attributes key and value.. Key will be the month numbers 1,2,3,4.. While value will be month names Jan, Feb,.. While the dropdown is rendered the month name will be shown.. When the page is submitted the month num(key) will be set to the property 'month' Hope it helps.. Swaroop -Original Message- From: Rick Col [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 6:24 PM To: Struts Users Mailing List Subject: drop-down list help Hi, guys: I am a struts newbie. I have spent sevaral days trying build a struts page with several drop-down lists in vain. I am wondering there are any struts drop down lists examples out there. I appreciate your help. regards, __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: drop-down list help
Thank you, suzette. I will take a look, and report back to tell you if I make it or not. regards, --- Suzette Daniel [EMAIL PROTECTED] wrote: The examples are in the struts war: [struts.war]/webapps/struts-exercise-taglib.war. They are also http://jakarta.apache.org/struts/resources/projects.html. Suzette H. Daniel Java Developer/Web dept 770 416.9222 ex: 5041 -Original Message- From: Rick Col [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 8:54 AM To: Struts Users Mailing List Subject: drop-down list help Hi, guys: I am a struts newbie. I have spent sevaral days trying build a struts page with several drop-down lists in vain. I am wondering there are any struts drop down lists examples out there. I appreciate your help. regards, __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: drop-down list help
Thanks, Swaroop, for your kind help. regards, --- Swaroop George [EMAIL PROTECTED] wrote: jsp:useBean id=dropdown scope=application class=com.xxx.DropdownCollections /jsp:useBean bean:define id=months name=dropdown property=months toScope=request/ html:select property=month html:options collection=months property=key labelProperty=value/ /html:select Hi this is a part of the page I developed.. (Ofcourse a commercial application..) I have a class called DropDownCollections.java Now in the class I have a method getMonths() which will return me a collection of months.. I am using the months collection to populate the options.. You can actually use an html:select instead of a nested:select The getMonths() returns a set of beans having two attributes key and value.. Key will be the month numbers 1,2,3,4.. While value will be month names Jan, Feb,.. While the dropdown is rendered the month name will be shown.. When the page is submitted the month num(key) will be set to the property 'month' Hope it helps.. Swaroop -Original Message- From: Rick Col [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 6:24 PM To: Struts Users Mailing List Subject: drop-down list help Hi, guys: I am a struts newbie. I have spent sevaral days trying build a struts page with several drop-down lists in vain. I am wondering there are any struts drop down lists examples out there. I appreciate your help. regards, __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: drop-down list help
Hi, Swaroop: I have a question about your implementation, do we still need to implement an actionForm class for the following drop down list? regards, --- Swaroop George [EMAIL PROTECTED] wrote: jsp:useBean id=dropdown scope=application class=com.xxx.DropdownCollections /jsp:useBean bean:define id=months name=dropdown property=months toScope=request/ html:select property=month html:options collection=months property=key labelProperty=value/ /html:select Hi this is a part of the page I developed.. (Ofcourse a commercial application..) I have a class called DropDownCollections.java Now in the class I have a method getMonths() which will return me a collection of months.. I am using the months collection to populate the options.. You can actually use an html:select instead of a nested:select The getMonths() returns a set of beans having two attributes key and value.. Key will be the month numbers 1,2,3,4.. While value will be month names Jan, Feb,.. While the dropdown is rendered the month name will be shown.. When the page is submitted the month num(key) will be set to the property 'month' Hope it helps.. Swaroop -Original Message- From: Rick Col [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 6:24 PM To: Struts Users Mailing List Subject: drop-down list help Hi, guys: I am a struts newbie. I have spent sevaral days trying build a struts page with several drop-down lists in vain. I am wondering there are any struts drop down lists examples out there. I appreciate your help. regards, __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: drop-down list help
Hi, Rick: Take a look at http://www.reumann.net/do/struts/main In Lesson II, you'll find an example of how to use the html:select tag Lesson II-4 Create ActionForm - The UI element for entering a value into the department field will be a drop-down list. Lesson II-6 Create DepartmentBean - This bean will be used to represent options for the drop-down list. Lesson II-8 Create EmployerService - shows how the list of departments is created. Lesson II-9 Create SetUpEmployerAction - this is where the list of options is put into the session context. code: -- Collection departments = service.getDepartments(); HttpSession session = request.getSession(); session.setAttribute( departments, departments ); -- Lesson II-14 Create employeeForm.jsp - shows how the html:select and html:options is used to present a drop-down list of departments. Note the property and labelProperty attributes in the html:options tag: both id and description are properties of the DepartmentBean created in II-6. The collection attribute is the name departments which was used when the list of DepartmentBeans was added to the session context (II-9). --- Rick Col [EMAIL PROTECTED] wrote: Hi, Swaroop: I have a question about your implementation, do we still need to implement an actionForm class for the following drop down list? regards, --- Swaroop George [EMAIL PROTECTED] wrote: jsp:useBean id=dropdown scope=application class=com.xxx.DropdownCollections /jsp:useBean bean:define id=months name=dropdown property=months toScope=request/ html:select property=month html:options collection=months property=key labelProperty=value/ /html:select Hi this is a part of the page I developed.. (Ofcourse a commercial application..) I have a class called DropDownCollections.java Now in the class I have a method getMonths() which will return me a collection of months.. I am using the months collection to populate the options.. You can actually use an html:select instead of a nested:select The getMonths() returns a set of beans having two attributes key and value.. Key will be the month numbers 1,2,3,4.. While value will be month names Jan, Feb,.. While the dropdown is rendered the month name will be shown.. When the page is submitted the month num(key) will be set to the property 'month' Hope it helps.. Swaroop -Original Message- From: Rick Col [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 6:24 PM To: Struts Users Mailing List Subject: drop-down list help Hi, guys: I am a struts newbie. I have spent sevaral days trying build a struts page with several drop-down lists in vain. I am wondering there are any struts drop down lists examples out there. I appreciate your help. regards, __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: drop-down list help
Thanks, Caroline: I just took a look, very good tutorial. regards, rick --- Caroline Jen [EMAIL PROTECTED] wrote: Hi, Rick: Take a look at http://www.reumann.net/do/struts/main In Lesson II, you'll find an example of how to use the html:select tag Lesson II-4 Create ActionForm - The UI element for entering a value into the department field will be a drop-down list. Lesson II-6 Create DepartmentBean - This bean will be used to represent options for the drop-down list. Lesson II-8 Create EmployerService - shows how the list of departments is created. Lesson II-9 Create SetUpEmployerAction - this is where the list of options is put into the session context. code: -- Collection departments = service.getDepartments(); HttpSession session = request.getSession(); session.setAttribute( departments, departments ); -- Lesson II-14 Create employeeForm.jsp - shows how the html:select and html:options is used to present a drop-down list of departments. Note the property and labelProperty attributes in the html:options tag: both id and description are properties of the DepartmentBean created in II-6. The collection attribute is the name departments which was used when the list of DepartmentBeans was added to the session context (II-9). --- Rick Col [EMAIL PROTECTED] wrote: Hi, Swaroop: I have a question about your implementation, do we still need to implement an actionForm class for the following drop down list? regards, --- Swaroop George [EMAIL PROTECTED] wrote: jsp:useBean id=dropdown scope=application class=com.xxx.DropdownCollections /jsp:useBean bean:define id=months name=dropdown property=months toScope=request/ html:select property=month html:options collection=months property=key labelProperty=value/ /html:select Hi this is a part of the page I developed.. (Ofcourse a commercial application..) I have a class called DropDownCollections.java Now in the class I have a method getMonths() which will return me a collection of months.. I am using the months collection to populate the options.. You can actually use an html:select instead of a nested:select The getMonths() returns a set of beans having two attributes key and value.. Key will be the month numbers 1,2,3,4.. While value will be month names Jan, Feb,.. While the dropdown is rendered the month name will be shown.. When the page is submitted the month num(key) will be set to the property 'month' Hope it helps.. Swaroop -Original Message- From: Rick Col [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 6:24 PM To: Struts Users Mailing List Subject: drop-down list help Hi, guys: I am a struts newbie. I have spent sevaral days trying build a struts page with several drop-down lists in vain. I am wondering there are any struts drop down lists examples out there. I appreciate your help. regards, __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: drop-down list help
Actually you don't have to .. if u see I am not using any ActionForm anywhere.. But when u get the value which is selected from the dropdown u need to populate it somewhere right.. Could be either in ActionForm.. or any bean in the request .. Swaroop -Original Message- From: Rick Col [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 7:07 PM To: Struts Users Mailing List Subject: RE: drop-down list help Hi, Swaroop: I have a question about your implementation, do we still need to implement an actionForm class for the following drop down list? regards, --- Swaroop George [EMAIL PROTECTED] wrote: jsp:useBean id=dropdown scope=application class=com.xxx.DropdownCollections /jsp:useBean bean:define id=months name=dropdown property=months toScope=request/ html:select property=month html:options collection=months property=key labelProperty=value/ /html:select Hi this is a part of the page I developed.. (Ofcourse a commercial application..) I have a class called DropDownCollections.java Now in the class I have a method getMonths() which will return me a collection of months.. I am using the months collection to populate the options.. You can actually use an html:select instead of a nested:select The getMonths() returns a set of beans having two attributes key and value.. Key will be the month numbers 1,2,3,4.. While value will be month names Jan, Feb,.. While the dropdown is rendered the month name will be shown.. When the page is submitted the month num(key) will be set to the property 'month' Hope it helps.. Swaroop -Original Message- From: Rick Col [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 6:24 PM To: Struts Users Mailing List Subject: drop-down list help Hi, guys: I am a struts newbie. I have spent sevaral days trying build a struts page with several drop-down lists in vain. I am wondering there are any struts drop down lists examples out there. I appreciate your help. regards, __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: drop-down list help
Im not using LabelValueBean.. It's a simple bean which has a getMonths() method.. which will return a colelction on monthnum and monthname which I am storing in an arraylits.. I have dealt with a lot of dropdowns.. the ones which is populated from database as well.. No where I have used LabelValueBean -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 6:41 PM To: 'Struts Users Mailing List' Subject: RE: drop-down list help Swaroop, Even I am looking for code for drop-down lists. Are you using LabelValueBean in DropDownCollections.java? Is there any alternative to LabelValueBean - I tried using Struts 1.1 but I'm facing lot of problems while deploying. And I am in a hurry to get this task completed. So, I am looking for developing code for drop-downs using struts 1.0 (that means I can't use LabelValueBean). Sriram -Original Message- From: Swaroop George [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 6:36 PM To: Struts Users Mailing List Subject: RE: drop-down list help jsp:useBean id=dropdown scope=application class=com.xxx.DropdownCollections /jsp:useBean bean:define id=months name=dropdown property=months toScope=request/ html:select property=month html:options collection=months property=key labelProperty=value/ /html:select Hi this is a part of the page I developed.. (Ofcourse a commercial application..) I have a class called DropDownCollections.java Now in the class I have a method getMonths() which will return me a collection of months.. I am using the months collection to populate the options.. You can actually use an html:select instead of a nested:select The getMonths() returns a set of beans having two attributes key and value.. Key will be the month numbers 1,2,3,4.. While value will be month names Jan, Feb,.. While the dropdown is rendered the month name will be shown.. When the page is submitted the month num(key) will be set to the property 'month' Hope it helps.. Swaroop -Original Message- From: Rick Col [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 6:24 PM To: Struts Users Mailing List Subject: drop-down list help Hi, guys: I am a struts newbie. I have spent sevaral days trying build a struts page with several drop-down lists in vain. I am wondering there are any struts drop down lists examples out there. I appreciate your help. regards, __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: drop down list
On Saturday, January 19, 2002, at 09:58 AM, Mahesh Agarwal wrote: Hi all In a List box if particular option has to be selected(say the 3rd one in a list of 5). Normally selected word has to be placed inside the relevant option tag option selected . In struts the very first option shows as the selected one on the browser. But if you need to show the 3rd option as slelected in the list how do we do that in struts? thanks a lot in advance Mahesh If you use the struts-html tags, and use a form bean which is setup with the correct defaults, struts does this automagically. So for example, say the drop-down list is a choice between a, b and c, and the property is called 'choice', and you want c to be the default, then you just make sure that the default value of choice in your form bean is c. If you need me to clarify further, email me and I'll send you some code to show what I mean. Yours, Peter -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Drop-down list
This is how we do it...(I think the work simple should be ommitted) Get the content at the top of the JSP page. %pageContext.setAttribute("nameSuffixTypes", getServletContext().getAttribute("nameSuffixTypes"));% Place this where you want the Drop Down List on the JSP page. html:select property="suffix" html:options collection="nameSuffixTypes" property="value" labelProperty="label" //html:select - Original Message - From: Kyle Robinson To: '[EMAIL PROTECTED]' Sent: Thursday, March 01, 2001 8:42 AM Subject: Drop-down list What is the simplest way to dynamically create a drop-down list (select) that pulls values from a database? Is there a specific tag I should use? Iterator? Kyle Robinson Systems Consultant Pangaea Systems Inc. (250) 360-0111
RE: Drop-down list
Does this assume that you have loaded a Collection of LabelValueBeans in the application scope? Do you really need that scriplet at the top of the page? I thought html:options could reference the collection where it is in the servlet context, without copying the reference to the page context. Hal -Original Message- From: Spencer Smith [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 01, 2001 11:39 AM To: [EMAIL PROTECTED] Subject: Re: Drop-down list This is how we do it...(I think the work simple should be ommitted) Get the content at the top of the JSP page. % pageContext.setAttribute("nameSuffixTypes", getServletContext().getAttribute("nameSuffixTypes")); % Place this where you want the Drop Down List on the JSP page. html:select property="suffix" html:options collection="nameSuffixTypes" property="value" labelProperty="label" / /html:select - Original Message - From: Kyle mailto:[EMAIL PROTECTED] Robinson To: '[EMAIL PROTECTED]' mailto:'[EMAIL PROTECTED]' Sent: Thursday, March 01, 2001 8:42 AM Subject: Drop-down list What is the simplest way to dynamically create a drop-down list (select) that pulls values from a database? Is there a specific tag I should use? Iterator? Kyle Robinson Systems Consultant Pangaea Systems Inc. (250) 360-0111
Re: Drop-down list
When adding options to a select that are stored in a database, we have the action class look-up the necessary information, store it in a bean, place the bean in the request / session, and then use a taglib on the page that specifies the source (the bean) and the property (database column) that should be used to populate the select. This gaurentees that the data in the select list is up to date. HTH, Pete "Deadman, Hal" wrote: Does this assume that you have loaded a Collection of LabelValueBeans in the application scope? Do you really need that scriplet at the top of the page? I thought html:options could reference the collection where it is in the servlet context, without copying the reference to the page context. Hal -Original Message- From: Spencer Smith [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 01, 2001 11:39 AM To: [EMAIL PROTECTED] Subject: Re: Drop-down list This is how we do it...(I think the work simple should be ommitted) Get the content at the top of the JSP page. % pageContext.setAttribute("nameSuffixTypes", getServletContext().getAttribute("nameSuffixTypes")); % Place this where you want the Drop Down List on the JSP page. html:select property="suffix" html:options collection="nameSuffixTypes" property="value" labelProperty="label" / /html:select - Original Message - From: Kyle mailto:[EMAIL PROTECTED] Robinson To: '[EMAIL PROTECTED]' mailto:'[EMAIL PROTECTED]' Sent: Thursday, March 01, 2001 8:42 AM Subject: Drop-down list What is the simplest way to dynamically create a drop-down list (select) that pulls values from a database? Is there a specific tag I should use? Iterator? Kyle Robinson Systems Consultant Pangaea Systems Inc. (250) 360-0111 begin:vcard n:; x-mozilla-html:FALSE org:BRIMG SRC="http://www.irista.com/logo/irista.gif"BRBRFONT Color=#80FONT SIZE=2BBringing Vision to Your Supply Chain adr:;; version:2.1 end:vcard
Re: Drop-down list
Do you guys know how to define the Multiple attribute in a select drop down list for Struts? - Original Message - From: "Peter Alfors" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 01, 2001 11:29 AM Subject: Re: Drop-down list When adding options to a select that are stored in a database, we have the action class look-up the necessary information, store it in a bean, place the bean in the request / session, and then use a taglib on the page that specifies the source (the bean) and the property (database column) that should be used to populate the select. This gaurentees that the data in the select list is up to date. HTH, Pete "Deadman, Hal" wrote: Does this assume that you have loaded a Collection of LabelValueBeans in the application scope? Do you really need that scriplet at the top of the page? I thought html:options could reference the collection where it is in the servlet context, without copying the reference to the page context. Hal -Original Message- From: Spencer Smith [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 01, 2001 11:39 AM To: [EMAIL PROTECTED] Subject: Re: Drop-down list This is how we do it...(I think the work simple should be ommitted) Get the content at the top of the JSP page. % pageContext.setAttribute("nameSuffixTypes", getServletContext().getAttribute("nameSuffixTypes")); % Place this where you want the Drop Down List on the JSP page. html:select property="suffix" html:options collection="nameSuffixTypes" property="value" labelProperty="label" / /html:select - Original Message - From: Kyle mailto:[EMAIL PROTECTED] Robinson To: '[EMAIL PROTECTED]' mailto:'[EMAIL PROTECTED]' Sent: Thursday, March 01, 2001 8:42 AM Subject: Drop-down list What is the simplest way to dynamically create a drop-down list (select) that pulls values from a database? Is there a specific tag I should use? Iterator? Kyle Robinson Systems Consultant Pangaea Systems Inc. (250) 360-0111
Re: Drop-down list
Add the attribute to your tag like so: html:select ... multiple="true" ... and make sure the corresponding property in your form bean is an array of values. See the docs for more details: http://jakarta.apache.org/struts/struts-html.html#select Hope this helps. -- Martin Cooper Tumbleweed Communications At 11:44 AM 3/1/01 -0800, Spencer Smith wrote: Do you guys know how to define the Multiple attribute in a select drop down list for Struts? - Original Message - From: "Peter Alfors" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 01, 2001 11:29 AM Subject: Re: Drop-down list When adding options to a select that are stored in a database, we have the action class look-up the necessary information, store it in a bean, place the bean in the request / session, and then use a taglib on the page that specifies the source (the bean) and the property (database column) that should be used to populate the select. This gaurentees that the data in the select list is up to date. HTH, Pete "Deadman, Hal" wrote: Does this assume that you have loaded a Collection of LabelValueBeans in the application scope? Do you really need that scriplet at the top of the page? I thought html:options could reference the collection where it is in the servlet context, without copying the reference to the page context. Hal -Original Message- From: Spencer Smith [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 01, 2001 11:39 AM To: [EMAIL PROTECTED] Subject: Re: Drop-down list This is how we do it...(I think the work simple should be ommitted) Get the content at the top of the JSP page. % pageContext.setAttribute("nameSuffixTypes", getServletContext().getAttribute("nameSuffixTypes")); % Place this where you want the Drop Down List on the JSP page. html:select property="suffix" html:options collection="nameSuffixTypes" property="value" labelProperty="label" / /html:select - Original Message - From: Kyle mailto:[EMAIL PROTECTED] Robinson To: '[EMAIL PROTECTED]' mailto:'[EMAIL PROTECTED]' Sent: Thursday, March 01, 2001 8:42 AM Subject: Drop-down list What is the simplest way to dynamically create a drop-down list (select) that pulls values from a database? Is there a specific tag I should use? Iterator? Kyle Robinson Systems Consultant Pangaea Systems Inc. (250) 360-0111
RE: Drop-down list
Suppose I have the drop down list which I wanted to create from a database and the database is updated less frequently, is there a way in which I can implement somekind of caching mechanism, with which I won't do a database query always, instead I can use the cache to populate the drop down list? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 01, 2001 3:02 PM To: [EMAIL PROTECTED] Subject: Re: Drop-down list Add the attribute to your tag like so: html:select ... multiple="true" ... and make sure the corresponding property in your form bean is an array of values. See the docs for more details: http://jakarta.apache.org/struts/struts-html.html#select Hope this helps. -- Martin Cooper Tumbleweed Communications At 11:44 AM 3/1/01 -0800, Spencer Smith wrote: Do you guys know how to define the Multiple attribute in a select drop down list for Struts? - Original Message - From: "Peter Alfors" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 01, 2001 11:29 AM Subject: Re: Drop-down list When adding options to a select that are stored in a database, we have the action class look-up the necessary information, store it in a bean, place the bean in the request / session, and then use a taglib on the page that specifies the source (the bean) and the property (database column) that should be used to populate the select. This gaurentees that the data in the select list is up to date. HTH, Pete "Deadman, Hal" wrote: Does this assume that you have loaded a Collection of LabelValueBeans in the application scope? Do you really need that scriplet at the top of the page? I thought html:options could reference the collection where it is in the servlet context, without copying the reference to the page context. Hal -Original Message- From: Spencer Smith [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 01, 2001 11:39 AM To: [EMAIL PROTECTED] Subject: Re: Drop-down list This is how we do it...(I think the work simple should be ommitted) Get the content at the top of the JSP page. % pageContext.setAttribute("nameSuffixTypes", getServletContext().getAttribute("nameSuffixTypes")); % Place this where you want the Drop Down List on the JSP page. html:select property="suffix" html:options collection="nameSuffixTypes" property="value" labelProperty="label" / /html:select - Original Message - From: Kyle mailto:[EMAIL PROTECTED] Robinson To: '[EMAIL PROTECTED]' mailto:'[EMAIL PROTECTED]' Sent: Thursday, March 01, 2001 8:42 AM Subject: Drop-down list What is the simplest way to dynamically create a drop-down list (select) that pulls values from a database? Is there a specific tag I should use? Iterator? Kyle Robinson Systems Consultant Pangaea Systems Inc. (250) 360-0111
Re: Drop-down list
If you wanted to use a bean to store the select options, place it in the user's session. Then, check to see if it exists before refreshing it. HTH, Pete "Dorai, Harish (c)" wrote: Suppose I have the drop down list which I wanted to create from a database and the database is updated less frequently, is there a way in which I can implement somekind of caching mechanism, with which I won't do a database query always, instead I can use the cache to populate the drop down list? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 01, 2001 3:02 PM To: [EMAIL PROTECTED] Subject: Re: Drop-down list Add the attribute to your tag like so: html:select ... multiple="true" ... and make sure the corresponding property in your form bean is an array of values. See the docs for more details: http://jakarta.apache.org/struts/struts-html.html#select Hope this helps. -- Martin Cooper Tumbleweed Communications At 11:44 AM 3/1/01 -0800, Spencer Smith wrote: Do you guys know how to define the Multiple attribute in a select drop down list for Struts? - Original Message - From: "Peter Alfors" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 01, 2001 11:29 AM Subject: Re: Drop-down list When adding options to a select that are stored in a database, we have the action class look-up the necessary information, store it in a bean, place the bean in the request / session, and then use a taglib on the page that specifies the source (the bean) and the property (database column) that should be used to populate the select. This gaurentees that the data in the select list is up to date. HTH, Pete "Deadman, Hal" wrote: Does this assume that you have loaded a Collection of LabelValueBeans in the application scope? Do you really need that scriplet at the top of the page? I thought html:options could reference the collection where it is in the servlet context, without copying the reference to the page context. Hal -Original Message- From: Spencer Smith [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 01, 2001 11:39 AM To: [EMAIL PROTECTED] Subject: Re: Drop-down list This is how we do it...(I think the work simple should be ommitted) Get the content at the top of the JSP page. % pageContext.setAttribute("nameSuffixTypes", getServletContext().getAttribute("nameSuffixTypes")); % Place this where you want the Drop Down List on the JSP page. html:select property="suffix" html:options collection="nameSuffixTypes" property="value" labelProperty="label" / /html:select - Original Message - From: Kyle mailto:[EMAIL PROTECTED] Robinson To: '[EMAIL PROTECTED]' mailto:'[EMAIL PROTECTED]' Sent: Thursday, March 01, 2001 8:42 AM Subject: Drop-down list What is the simplest way to dynamically create a drop-down list (select) that pulls values from a database? Is there a specific tag I should use? Iterator? Kyle Robinson Systems Consultant Pangaea Systems Inc. (250) 360-0111 begin:vcard n:; x-mozilla-html:FALSE org:BRIMG SRC="http://www.irista.com/logo/irista.gif"BRBRFONT Color=#80FONT SIZE=2BBringing Vision to Your Supply Chain adr:;; version:2.1 end:vcard
Re: Drop-down list
Trying to use Multiple="true" attribute for html:select Help! O.k. so I declare it like so: protected String[] providerName; Then I get it: public String[] getProviderName() { return (providerName); } Then I set it: public void setProviderName(String providerName[]) { { this.providerName = providerName; } } What am I missing? - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 01, 2001 12:02 PM Subject: Re: Drop-down list Add the attribute to your tag like so: html:select ... multiple="true" ... and make sure the corresponding property in your form bean is an array of values. See the docs for more details: http://jakarta.apache.org/struts/struts-html.html#select Hope this helps. -- Martin Cooper Tumbleweed Communications At 11:44 AM 3/1/01 -0800, Spencer Smith wrote: Do you guys know how to define the Multiple attribute in a select drop down list for Struts? - Original Message - From: "Peter Alfors" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 01, 2001 11:29 AM Subject: Re: Drop-down list When adding options to a select that are stored in a database, we have the action class look-up the necessary information, store it in a bean, place the bean in the request / session, and then use a taglib on the page that specifies the source (the bean) and the property (database column) that should be used to populate the select. This gaurentees that the data in the select list is up to date. HTH, Pete "Deadman, Hal" wrote: Does this assume that you have loaded a Collection of LabelValueBeans in the application scope? Do you really need that scriplet at the top of the page? I thought html:options could reference the collection where it is in the servlet context, without copying the reference to the page context. Hal -Original Message- From: Spencer Smith [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 01, 2001 11:39 AM To: [EMAIL PROTECTED] Subject: Re: Drop-down list This is how we do it...(I think the work simple should be ommitted) Get the content at the top of the JSP page. % pageContext.setAttribute("nameSuffixTypes", getServletContext().getAttribute("nameSuffixTypes")); % Place this where you want the Drop Down List on the JSP page. html:select property="suffix" html:options collection="nameSuffixTypes" property="value" labelProperty="label" / /html:select - Original Message - From: Kyle mailto:[EMAIL PROTECTED] Robinson To: '[EMAIL PROTECTED]' mailto:'[EMAIL PROTECTED]' Sent: Thursday, March 01, 2001 8:42 AM Subject: Drop-down list What is the simplest way to dynamically create a drop-down list (select) that pulls values from a database? Is there a specific tag I should use? Iterator? Kyle Robinson Systems Consultant Pangaea Systems Inc. (250) 360-0111
RE: Drop-down list
I'd remove all the square brackets. If you want to keep them, the parameter type in setProviderName should be String[]. I don't know for sure though. -Original Message- From: Spencer Smith [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 01, 2001 13:02 To: [EMAIL PROTECTED] Subject: Re: Drop-down list Trying to use Multiple="true" attribute for html:select Help! O.k. so I declare it like so: protected String[] providerName; Then I get it: public String[] getProviderName() { return (providerName); } Then I set it: public void setProviderName(String providerName[]) { { this.providerName = providerName; } } What am I missing? - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 01, 2001 12:02 PM Subject: Re: Drop-down list Add the attribute to your tag like so: html:select ... multiple="true" ... and make sure the corresponding property in your form bean is an array of values. See the docs for more details: http://jakarta.apache.org/struts/struts-html.html#select Hope this helps. -- Martin Cooper Tumbleweed Communications At 11:44 AM 3/1/01 -0800, Spencer Smith wrote: Do you guys know how to define the Multiple attribute in a select drop down list for Struts? - Original Message - From: "Peter Alfors" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 01, 2001 11:29 AM Subject: Re: Drop-down list When adding options to a select that are stored in a database, we have the action class look-up the necessary information, store it in a bean, place the bean in the request / session, and then use a taglib on the page that specifies the source (the bean) and the property (database column) that should be used to populate the select. This gaurentees that the data in the select list is up to date. HTH, Pete "Deadman, Hal" wrote: Does this assume that you have loaded a Collection of LabelValueBeans in the application scope? Do you really need that scriplet at the top of the page? I thought html:options could reference the collection where it is in the servlet context, without copying the reference to the page context. Hal -Original Message- From: Spencer Smith [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 01, 2001 11:39 AM To: [EMAIL PROTECTED] Subject: Re: Drop-down list This is how we do it...(I think the work simple should be ommitted) Get the content at the top of the JSP page. % pageContext.setAttribute("nameSuffixTypes", getServletContext().getAttribute("nameSuffixTypes")); % Place this where you want the Drop Down List on the JSP page. html:select property="suffix" html:options collection="nameSuffixTypes" property="value" labelProperty="label" / /html:select - Original Message - From: Kyle mailto:[EMAIL PROTECTED] Robinson To: '[EMAIL PROTECTED]' mailto:'[EMAIL PROTECTED]' Sent: Thursday, March 01, 2001 8:42 AM Subject: Drop-down list What is the simplest way to dynamically create a drop-down list (select) that pulls values from a database? Is there a specific tag I should use? Iterator? Kyle Robinson Systems Consultant Pangaea Systems Inc. (250) 360-0111
Re: Drop-down list
Provide Name(s)nbsp; html:select property="providerName" multiple="true" size="2" html:options collection="cmProviderTypes" property="value" labelProperty="label" / /html:select Like this, correct? - Original Message - From: "Spencer Smith" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 01, 2001 1:02 PM Subject: Re: Drop-down list Trying to use Multiple="true" attribute for html:select Help! O.k. so I declare it like so: protected String[] providerName; Then I get it: public String[] getProviderName() { return (providerName); } Then I set it: public void setProviderName(String providerName[]) { { this.providerName = providerName; } } What am I missing? - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 01, 2001 12:02 PM Subject: Re: Drop-down list Add the attribute to your tag like so: html:select ... multiple="true" ... and make sure the corresponding property in your form bean is an array of values. See the docs for more details: http://jakarta.apache.org/struts/struts-html.html#select Hope this helps. -- Martin Cooper Tumbleweed Communications At 11:44 AM 3/1/01 -0800, Spencer Smith wrote: Do you guys know how to define the Multiple attribute in a select drop down list for Struts? - Original Message - From: "Peter Alfors" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 01, 2001 11:29 AM Subject: Re: Drop-down list When adding options to a select that are stored in a database, we have the action class look-up the necessary information, store it in a bean, place the bean in the request / session, and then use a taglib on the page that specifies the source (the bean) and the property (database column) that should be used to populate the select. This gaurentees that the data in the select list is up to date. HTH, Pete "Deadman, Hal" wrote: Does this assume that you have loaded a Collection of LabelValueBeans in the application scope? Do you really need that scriplet at the top of the page? I thought html:options could reference the collection where it is in the servlet context, without copying the reference to the page context. Hal -Original Message- From: Spencer Smith [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 01, 2001 11:39 AM To: [EMAIL PROTECTED] Subject: Re: Drop-down list This is how we do it...(I think the work simple should be ommitted) Get the content at the top of the JSP page. % pageContext.setAttribute("nameSuffixTypes", getServletContext().getAttribute("nameSuffixTypes")); % Place this where you want the Drop Down List on the JSP page. html:select property="suffix" html:options collection="nameSuffixTypes" property="value" labelProperty="label" / /html:select - Original Message - From: Kyle mailto:[EMAIL PROTECTED] Robinson To: '[EMAIL PROTECTED]' mailto:'[EMAIL PROTECTED]' Sent: Thursday, March 01, 2001 8:42 AM Subject: Drop-down list What is the simplest way to dynamically create a drop-down list (select) that pulls values from a database? Is there a specific tag I should use? Iterator? Kyle Robinson Systems Consultant Pangaea Systems Inc. (250) 360-0111
Re: Drop-down list
Thanks for the help, but it didn't work :( - Original Message - From: "Kyle Robinson" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 01, 2001 1:14 PM Subject: RE: Drop-down list I'd remove all the square brackets. If you want to keep them, the parameter type in setProviderName should be String[]. I don't know for sure though. -Original Message- From: Spencer Smith [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 01, 2001 13:02 To: [EMAIL PROTECTED] Subject: Re: Drop-down list Trying to use Multiple="true" attribute for html:select Help! O.k. so I declare it like so: protected String[] providerName; Then I get it: public String[] getProviderName() { return (providerName); } Then I set it: public void setProviderName(String providerName[]) { { this.providerName = providerName; } } What am I missing? - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 01, 2001 12:02 PM Subject: Re: Drop-down list Add the attribute to your tag like so: html:select ... multiple="true" ... and make sure the corresponding property in your form bean is an array of values. See the docs for more details: http://jakarta.apache.org/struts/struts-html.html#select Hope this helps. -- Martin Cooper Tumbleweed Communications At 11:44 AM 3/1/01 -0800, Spencer Smith wrote: Do you guys know how to define the Multiple attribute in a select drop down list for Struts? - Original Message - From: "Peter Alfors" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 01, 2001 11:29 AM Subject: Re: Drop-down list When adding options to a select that are stored in a database, we have the action class look-up the necessary information, store it in a bean, place the bean in the request / session, and then use a taglib on the page that specifies the source (the bean) and the property (database column) that should be used to populate the select. This gaurentees that the data in the select list is up to date. HTH, Pete "Deadman, Hal" wrote: Does this assume that you have loaded a Collection of LabelValueBeans in the application scope? Do you really need that scriplet at the top of the page? I thought html:options could reference the collection where it is in the servlet context, without copying the reference to the page context. Hal -Original Message- From: Spencer Smith [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 01, 2001 11:39 AM To: [EMAIL PROTECTED] Subject: Re: Drop-down list This is how we do it...(I think the work simple should be ommitted) Get the content at the top of the JSP page. % pageContext.setAttribute("nameSuffixTypes", getServletContext().getAttribute("nameSuffixTypes")); % Place this where you want the Drop Down List on the JSP page. html:select property="suffix" html:options collection="nameSuffixTypes" property="value" labelProperty="label" / /html:select - Original Message - From: Kyle mailto:[EMAIL PROTECTED] Robinson To: '[EMAIL PROTECTED]' mailto:'[EMAIL PROTECTED]' Sent: Thursday, March 01, 2001 8:42 AM Subject: Drop-down list What is the simplest way to dynamically create a drop-down list (select) that pulls values from a database? Is there a specific tag I should use? Iterator? Kyle Robinson Systems Consultant Pangaea Systems Inc. (250) 360-0111
Re: Drop-down list
Spencer Smith wrote: Do you guys know how to define the Multiple attribute in a select drop down list for Struts? select name="propertyname" multiple="true" In XML syntax, attributes always have to have a value. Craig
Re: Drop-down list
"Dorai, Harish (c)" wrote: Suppose I have the drop down list which I wanted to create from a database and the database is updated less frequently, is there a way in which I can implement somekind of caching mechanism, with which I won't do a database query always, instead I can use the cache to populate the drop down list? What I do in my real applications is to load in the options for each combo box at startup time, and store each as servlet context attributes. That way, everyone uses the same copy without having to go to the database every single time. If the values do change occasionally, and you don't want to shut down your app to recognize them, you could even define an Action that reloads them. Craig