struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adriana G <>
Subject Ajax and struts
Date Mon, 30 Jul 2012 16:16:47 GMT
I need to refresh a select option  using ajax,
i have this function that returns me an string list,
and i need to put in a select option. but it doesn't work with the
<html:select> tag.

I used to fill the select option with a persistent object declared in the
form, but i now i know how to updated taking into account the result o f
the ajax function.

function doAjaxPost(tipo) {
// get the form values
var name = $('#name').val();
type: "POST",
url: "/fethusweb/",
data: "name=" + name +"&enviar="+tipo,

var result = response.substring(1,response.length-3);
var vectorResponse = result.split(",");
var menu= document.getElementsByClassName("menu","david");
for(var i in vectorResponse){
var theOption = new Option;
theOption.text = vectorResponse[i];
theOption.value = 1;

               error: function(e){
                     alert('Error: ' + e);


 <html:select styleClass="select" property="ciudad.idCiudad"

           name="registrarPacienteForm" >

           <logic:iterate id="objeto" name="registrarPacienteForm"


                   <html-el:option value="${objeto.idCiudad}">

                           <c:out value="${objeto.nombre}" />




Adriii :)..

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message