Ok, this is a totally newbie question...
What I'm trying to do is totally simple: I wanna load a map with values, and then load a html:options with this map. The problem is I just don't know how to refer to the properties.
Here's what I'm doing... I load my map:
public Map getAtributosColecao(){
Map mapa = new HashMap();
mapa.put("colecao","Cole��o");
mapa.put("descricao","Descri��o");
return mapa;
}
and then I call it from an action, setting it as a request parameter:
public class MontaBuscaColecaoAction extends Action {
public ActionForward execute (
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
ColecaoGerenciador colecaoGer = new ColecaoGerenciador();
Map mapa = colecaoGer.getAtributosColecao();
request.setAttribute("mapaColecao", mapa);
return mapping.findForward("success");
}
and the last thing to do is to put it in the html:select. If it was a bean, I'd do like:
<html:select property="myBean" size="1">
<html:options collection="myBean" property="key" labelProperty="lblProperty"/>
</html:select>
But with a map... my values have no name, how will I refer to them? Must I create a bean? Do they have like native names? What should I do?
Thanks and sorry