struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kgnytia <forum-struts-...@opensymphony.com>
Subject problem with Struts + drw
Date Wed, 07 Jun 2006 10:44:28 GMT
hello,
ive got a problem with my struts application.
ive got 2 selects in my jsp page. one shows "localidades" and the other "municipios". you
first select 1 "localidad" and then the 2nd select shows the "municipios" of the "localidad"
selected. (a "localidad" has got MANY "municipios", a "municipio" is in a "localidad")

This is the code:

<script type='text/javascript' src='/pcmtmp/dwr/interface/ListaLocalidad.js'></script>
<script type='text/javascript' src='/pcmtmp/dwr/engine.js'></script>
<script type='text/javascript' src='/pcmtmp/dwr/util.js'></script>

function cambiaLocalidad() { 
DWRUtil.removeAllOptions("localidades");
ListaLocalidad.getListaLocalidadByIdMunicipio($("municipios").value, onCambiaLocalidad);
 }

function onCambiaLocalidad(data) {
DWRUtil.addOptions("localidades", data);
}

<html:select styleId="municipios" name="notificacionBean" property="idMunicipio" onchange="javascript:cambiaLocalidad()">
<html:optionsCollection style="max-width: 10px;width: 10px" name="notificacionList" property="listaMunicipio"
value="id" label="nombre"  />
</html:select> 

<html:select styleId="localidades" name="notificacionBean" property="idLocalidad" >
<html:optionsCollection style="max-width: 10px;width: 10px" name="notificacionList" property="listaLocalidad"
value="id" label="nombre"  />
</html:select> 

[b]DWR.XML[/b]

<dwr>
  <allow>
  <convert converter="bean" match="es.di.domain.Localidad"/>
<create creator="session" javascript="ListaLocalidad" class="es.di.persistence.sqlmapdao.ListaLocalidadSqlMapDao">
</create>
  </allow>
</dwr>

[b]LISTALOCALIDADSQLMAPDAO[/b] 
public class ListaLocalidadSqlMapDao extends BaseSqlMapDao
implements IListaLocalidadDao {
public List getListaLocalidadByIdMunicipio(Integer idMunicipio) throws Exception{
...}
}


This code only shows a javascript alert with the text: "es.di.persistence.sqlmapdao.ListaLocalidadSqlMapDao"
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=33630&messageID=65328#65328


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


Mime
View raw message