0

In a page JSP y get by JSTL a var ModelAndView in "${model}

In this page I use JAVASCRIPT to update a DIV with ajax.updater, the code here:


document.getElementById("idFa").value=image.title;
var frm2="${model}";
var dataString = 'mail=acevallo@hotmail.com&idFar=' + image.title + "&frm2=${model.farmers}";
new Ajax.Updater( "pcBody_content2", "tabProductsFruitC2.jsp", { method: "get",parameters:dataString,evalScripts: true });

my problem is, when I update the DIV with the new page tabProductsFruitC2.jsp. In this new page I haven't the var ${model}, so I have that send by parameter this var.

I tried it with var frm2, but it convert my var in string and I can not my modelandview var. How I can send by parameter my model var ${model}.

thanks, guys

1.01pm
  • 841
  • 1
  • 12
  • 23
ACEVALLO
  • 11
  • 3

1 Answers1

1

Finally I found one solution for this problem....

I had that using JSTL into JavaScript, get my data in one array and send by parameter using LOAD of jquery, so:

enter code here
function productsLoad(image){
    var contactTypesList = new Array();
    var tmpArray = new Array();
    var newOption,newOption2;
    var i=1;
    <c:forEach items="${model.farmers2}"  var="contactType">                    
      newOption = '${contactType.farmerId}';
      contactTypesList.push(newOption); 

      if ((newOption==image.title)&&(i==1)){
        <c:forEach  items="${contactType.products}" var="prd">
            newOption2 = '${prd.key}';
            tmpArray.push(newOption2);                                      
        </c:forEach>        
        i=i+1;
      } 
    </c:forEach>

    var dataString = 1;    
    $j("#pcBody_content2").load("jsp2/tabProductsFruitC2.jsp",{ 'choices[]': tmpArray } );
  }

</script>
Darren
  • 68,902
  • 24
  • 138
  • 144
ACEVALLO
  • 11
  • 3