José María Tristán wrote:
I create a bean:
public class BeanDatos {
private Map codigoM = new HashMap();
public Map getCodigoM(){
return this.codigoM;
}
public void setCodigoM(Map codigoM){
this.codigoM = codigoM;
}
}
And in my jsp:
<%
BeanDatos hashMapBean = new BeanDatos();
Map mapa = new HashMap();
mapa.put("100","SEDA");
mapa.put("101","LIOFI");
mapa.put("102","Cogeneracion");
hashMapBean.setCodigoM(mapa);
pageContext.setAttribute("hashMapBean",hashMapBean);
%>
<html:select property="listEdad" multiple="true">
<html:options name="hashMapBean" property="key"
labelProperty="value"/>
</html:select>
and i received the next message:
Well your html:options is pointing to a bean named 'hashMapBean' which
is of type BeanDatos. BeanDatos doesn't have getters named getKey() and
getValue(). What you probably meant was
<html:options name="hashMapBean"
property="codigoM.key"
labelProperty="codigoM.value"/>
L.
javax.servlet.ServletException: No getter method available for property
codigoM for bean under name null
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContext
Impl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextIm
pl.java:758)
org.apache.jsp.pages.submit_jsp._jspService(submit_jsp.java:178)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:
298)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
causa raíz
javax.servlet.jsp.JspException: No getter method available for property
codigoM for bean under name null
org.apache.struts.taglib.html.OptionsTag.getIterator(OptionsTag.java:382)
org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:246)
org.apache.jsp.pages.submit_jsp._jspx_meth_html_options_0(submit_jsp.java:6
84)
org.apache.jsp.pages.submit_jsp._jspx_meth_html_select_2(submit_jsp.java:65
5)
org.apache.jsp.pages.submit_jsp._jspx_meth_html_form_0(submit_jsp.java:250)
org.apache.jsp.pages.submit_jsp._jspService(submit_jsp.java:168)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:
298)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
Thank you.
-----Mensaje original-----
De: Aidas Semezys [mailto:[EMAIL PROTECTED]
Enviado el: jueves, 09 de febrero de 2006 15:05
Para: Struts Users Mailing List
Asunto: Re: html:options whith a HashMap
Yes it is possible. Suppose you have bean of type java.util.HashMap in your
context under name hashMapBean. Then you write:
<html:select property="listEdad" multiple="true">
<html:options name="hashMapBean" property="key" labelProperty="value"/>
</html:select>
That's all for it.
On 2/8/06, José María Tristán <[EMAIL PROTECTED]> wrote:
Hi,
I have an application whith a html:options whith two ArrayList to
see the
"name"(arrayCodigo) and the "label" (arrayDescripcion)
<html:select property="listEdad" multiple="true">
<html:options name="arrayCodigo"
labelName="arrayDescripcion" />
</html:select>
Is possible do the same whith a HashMap (key-value)?. How i say
to
html:options that the property name is the key of HashMap and the
labelname
is the value of HashMap.
Thank you very much
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]