Array of Bean and optionsCollection (up)
Please excuse me but i try again ... (hope will never die) Hi all, i've the following problem using the tag html:optionsCollection, the jsp give the following error: org.apache.jasper.JasperException: No bean specified Let's say this is my code (actionForm, jsp, bean class) public class MyForm extends ActionForm { private myBean[] arrayOfMyBean; public void reset(ActionMapping mapping, HttpServletRequest request){ arrayOfMyBean=someClass.getMyBeanArray(); request.setAttribute(aBean, arrayOfMyBean); super.reset( mapping, request); } public myBean[] getABean(return arrayOfMyBean); // i forgot this on my previous post, not on my code! } __ The jsp: %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % html:xhtml / html:html locale=true body html:form action=/MyAction html:select property=myBeanCode html:optionsCollection property=aBean value=code label=descr/ /html:select /html:form /body /html:html myBean Class: public class myBean implements java.io.Serializable{ private Integer code; private String descr; public Integer getCode(){return code;} public String getDescr(){return descr;} public void setCode(Integer val){ code=val;} public void setDescr(String val){ descr=val;} } _ Could anyone help me? Any help will be greatly appreciated. Thanks in advance Marcello - 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: Array of Bean and optionsCollection (up)
At first sight, u miss the name of the collection in html:optionsCollection property=aBean value=code label=descr/ second u forgot the dot in myBeanCode , it's myBean.code , Struts will do myBean.getCode(). third : your form property aBean is an array u use a select ( which a single property) not clear but i could have understood wrong . Good luck 2007/4/11, Marcello Savino [EMAIL PROTECTED]: Please excuse me but i try again ... (hope will never die) Hi all, i've the following problem using the tag html:optionsCollection, the jsp give the following error: org.apache.jasper.JasperException: No bean specified Let's say this is my code (actionForm, jsp, bean class) public class MyForm extends ActionForm { private myBean[] arrayOfMyBean; public void reset(ActionMapping mapping, HttpServletRequest request){ arrayOfMyBean=someClass.getMyBeanArray(); request.setAttribute(aBean, arrayOfMyBean); super.reset( mapping, request); } public myBean[] getABean(return arrayOfMyBean); // i forgot this on my previous post, not on my code! } __ The jsp: %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % html:xhtml / html:html locale=true body html:form action=/MyAction html:select property=myBeanCode html:optionsCollection property=aBean value=code label=descr/ /html:select /html:form /body /html:html myBean Class: public class myBean implements java.io.Serializable{ private Integer code; private String descr; public Integer getCode(){return code;} public String getDescr(){return descr;} public void setCode(Integer val){ code=val;} public void setDescr(String val){ descr=val;} } _ Could anyone help me? Any help will be greatly appreciated. Thanks in advance Marcello - 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]
R: Array of Bean and optionsCollection (up)
At first sight, u miss the name of the collection in html:optionsCollection property=aBean value=code label=descr/ Do you mean i have to specify the attribute name=aBeaninstead of property=aBean ? second u forgot the dot in myBeanCode , it's myBean.code , Struts will do myBean.getCode(). myBeanCode is only a name for the current bean in the select tag third : your form property aBean is an array u use a select ( which a single property) Do you mean i have to specify the attribute name=aBeaninstead of property=aBean ? Thanks for your attention 2007/4/11, Marcello Savino [EMAIL PROTECTED]: Please excuse me but i try again ... (hope will never die) Hi all, i've the following problem using the tag html:optionsCollection, the jsp give the following error: org.apache.jasper.JasperException: No bean specified Let's say this is my code (actionForm, jsp, bean class) public class MyForm extends ActionForm { private myBean[] arrayOfMyBean; public void reset(ActionMapping mapping, HttpServletRequest request){ arrayOfMyBean=someClass.getMyBeanArray(); request.setAttribute(aBean, arrayOfMyBean); super.reset( mapping, request); } public myBean[] getABean(return arrayOfMyBean); // i forgot this on my previous post, not on my code! } __ The jsp: %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % html:xhtml / html:html locale=true body html:form action=/MyAction html:select property=myBeanCode html:optionsCollection property=aBean value=code label=descr/ /html:select /html:form /body /html:html myBean Class: public class myBean implements java.io.Serializable{ private Integer code; private String descr; public Integer getCode(){return code;} public String getDescr(){return descr;} public void setCode(Integer val){ code=val;} public void setDescr(String val){ descr=val;} } _ Could anyone help me? Any help will be greatly appreciated. Thanks in advance Marcello - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: R: Array of Bean and optionsCollection (up)
Marcello Savino wrote: At first sight, u miss the name of the collection in html:optionsCollection property=aBean value=code label=descr/ Do you mean i have to specify the attribute name=aBeaninstead of property=aBean ? You only need to specify the 'name' attribute if you want to specify a bean other than the form bean. Assuming the data you want to reference is in the form bean, as in your case, you only need to specify the 'property' attribute. second u forgot the dot in myBeanCode , it's myBean.code , Struts will do myBean.getCode(). myBeanCode is only a name for the current bean in the select tag The 'property' attribute on the select tag should name a property in your form bean. That tells Struts where to store/retrieve the associated value (current selection). third : your form property aBean is an array u use a select ( which a single property) Do you mean i have to specify the attribute name=aBeaninstead of property=aBean ? You need *two* properties on your form bean: one to hold the list of options, which you have (the 'aBean' property); and one to hold the value that's actually selected. The html:select tag's 'property' attribute should reference the second one: public class MyForm extends ActionForm { private myBean[] arrayOfMyBean; private String selectedValue; public myBean[] getABean() {return arrayOfMyBean;} public String getSelectedValue() {return selectedValue;} public String setSelectedValue(String val) { selectedValue = val;} } html:select property=selectedValue html:optionsCollection property=aBean value=code label=descr/ /html:select L. Thanks for your attention 2007/4/11, Marcello Savino [EMAIL PROTECTED]: Please excuse me but i try again ... (hope will never die) Hi all, i've the following problem using the tag html:optionsCollection, the jsp give the following error: org.apache.jasper.JasperException: No bean specified Let's say this is my code (actionForm, jsp, bean class) public class MyForm extends ActionForm { private myBean[] arrayOfMyBean; public void reset(ActionMapping mapping, HttpServletRequest request){ arrayOfMyBean=someClass.getMyBeanArray(); request.setAttribute(aBean, arrayOfMyBean); super.reset( mapping, request); } public myBean[] getABean(return arrayOfMyBean); // i forgot this on my previous post, not on my code! } __ The jsp: %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % html:xhtml / html:html locale=true body html:form action=/MyAction html:select property=myBeanCode html:optionsCollection property=aBean value=code label=descr/ /html:select /html:form /body /html:html myBean Class: public class myBean implements java.io.Serializable{ private Integer code; private String descr; public Integer getCode(){return code;} public String getDescr(){return descr;} public void setCode(Integer val){ code=val;} public void setDescr(String val){ descr=val;} } _ Could anyone help me? Any help will be greatly appreciated. Thanks in advance Marcello - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]