struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lowe <mark.l...@talk21.com>
Subject Re: multiple parameter and map
Date Mon, 26 May 2003 22:41:38 GMT

You need to get the map to an available context

//in your scriplet or action servlet

Map map = new HashMap();
map.put("nombre", ((prueba)muestraProfesores).getNombre());        
map.put("apellido1",((prueba)muestraProfesores).getApellido1());        
map.put("apellido2",((prueba)muestraProfesores).getApellido2());

request.setAttribute("myMap",map); // or better in pageContext

//jsp

<logic:iterate id="foo" name="map" scope="request">
<html:link name="foo" .... play with the attributes an you'll work it 
out

Cheers mark




On Tuesday, May 27, 2003, at 00:06 Europe/Rome, ruben wrote:

> Hi everybody!
>
>   I want to pass to an action from the view 3 parameter, I read on the
> documentation that I have to put in a map, and then with a link and
> paramName, send to the action.
> I do this but in the action I get always null instead the parameter
> That is what I do ..
>
> <logic:iterate  id="muestraProfesores" name="profesoresList">
> <table width="600px" border="0" height="30">
>     <tr bgcolor="#90ddf0" bordercolor="#0001FF">
>       <td height="25" width="120px"><font color="#525D76"><bean:write
> name="muestraProfesores" property="nombre"/>
>        </font></td>
>       <td height="25" width="120px"><font color="#525D76"><bean:write
> name="muestraProfesores" property="apellido1"/> </font>
> </td>
>  	<td height="25" width="120px"><font color="#525D76"><bean:write
> name="muestraProfesores" property="apellido2"/> </font>
> </td>
>       <td height="25" width="120px"><font color="#525D76">
>
>       <% Map map = new HashMap();
>         map.put("nombre", ((prueba)muestraProfesores).getNombre());
>         
> map.put("apellido1",((prueba)muestraProfesores).getApellido1());
>         
> map.put("apellido2",((prueba)muestraProfesores).getApellido2());
>        %>
>
>        <html:link  action="/vistaProfesores.do?method=edicion"
> paramName="map"  target="princAdmin"> Edicion de profesor
> </html:link></font></td>
>       <td height="25" width="120px"><font color="#525D76"> <html:link
> action="/vistaProfesores.do?method=borra"  paramName="map"
> target="princAdmin"> Borra este profesor </html:link></font></td>
>     </tr>
>   </table>
> </logic:iterate>
>
> in the action I retrieve the values with ...
>
>    (String)request.getParameter("nombre");
>    (String)request.getParameter("apellido1");
>    (String)request.getParameter("apellido2");
>
> What am I doing wrong?
>
> PD: is there another possibility rather than use a map  to pass 
> multiple
> request parameter? (and not using JSTL).
>
> Thanks a lot!!!
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message