You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by José María Tristán <jt...@sedasolubles.com> on 2006/02/08 19:18:03 UTC
html:options whith a HashMap
Hi,
I have an application whith a html:options whith two ArrayList to see the
"name"(arrayCodigo) and the "label" (arrayDescripcion)
<html:select property="listEdad" multiple="true">
<html:options name="arrayCodigo" labelName="arrayDescripcion" />
</html:select>
Is possible do the same whith a HashMap (key-value)?. How i say to
html:options that the property name is the key of HashMap and the labelname
is the value of HashMap.
Thank you very much
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Any good struts based forums application ?
Posted by MC Moisei <mc...@comcast.net>.
Hi,
I looking for a well build open source forums application would be java
based - struts based would be plus.
Can you share your experience and view points if you played with such
applications ?
Thanks in advance,
MC
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: html:options whith a HashMap
Posted by Laurie Harper <la...@holoweb.net>.
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:aidas.semezys@gmail.com]
> 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 <jt...@sedasolubles.com> 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: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: html:options whith a HashMap
Posted by José María Tristán <jt...@sedasolubles.com>.
I create a bean:
public class BeanDatos {
private Map codigoM = new HashMap();
public Map getCodigoM(){
return this.codigoM;
}
public void setCodigoM(Map codigoM){
this.codigoM = codigoM;
}
}
And in my jsp:
<%
BeanDatos hashMapBean = new BeanDatos();
Map mapa = new HashMap();
mapa.put("100","SEDA");
mapa.put("101","LIOFI");
mapa.put("102","Cogeneracion");
hashMapBean.setCodigoM(mapa);
pageContext.setAttribute("hashMapBean",hashMapBean);
%>
<html:select property="listEdad" multiple="true">
<html:options name="hashMapBean" property="key" labelProperty="value"/>
</html:select>
and i received the next message:
javax.servlet.ServletException: No getter method available for property
codigoM for bean under name null
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContext
Impl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextIm
pl.java:758)
org.apache.jsp.pages.submit_jsp._jspService(submit_jsp.java:178)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:
298)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
causa raíz
javax.servlet.jsp.JspException: No getter method available for property
codigoM for bean under name null
org.apache.struts.taglib.html.OptionsTag.getIterator(OptionsTag.java:382)
org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:246)
org.apache.jsp.pages.submit_jsp._jspx_meth_html_options_0(submit_jsp.java:6
84)
org.apache.jsp.pages.submit_jsp._jspx_meth_html_select_2(submit_jsp.java:65
5)
org.apache.jsp.pages.submit_jsp._jspx_meth_html_form_0(submit_jsp.java:250)
org.apache.jsp.pages.submit_jsp._jspService(submit_jsp.java:168)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:
298)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
Thank you.
-----Mensaje original-----
De: Aidas Semezys [mailto:aidas.semezys@gmail.com]
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 <jt...@sedasolubles.com> 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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: html:options whith a HashMap
Posted by Aidas Semezys <ai...@gmail.com>.
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 <jt...@sedasolubles.com> 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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>