Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it
    Registrato dal
    Nov 2009
    Messaggi
    142

    Stampare ArrayList in javascript

    Ciao a tutti!

    mi chiedevo come si potesse stampare un arraylist con javascript...

    per essere più chiari ho una pagina che ottiene (attraverso struts) un arraylist Documenti che a sua volta contiene un arraylist ListaTag.
    Sono riuscito a passare i valori di ogni documento ad una funzione javascript chiamata openWindow che apre un popup e visualizza i dati che gli passo...Sono riuscito a far visualizzare i dati passati come stringhe e ora vorrei fare un ciclo che mi visualizzasse i valori dell arrayList ListaTag (ogni elemento dell aaraylist,chiamato Tag ha due varibili stringa nome e valore)

    per chiarezza ecco il codice della funzione:

    codice:
    function openWindow(nome,tipo,rocchio,example,bayes,data,Taglist) {  
                        alert ('sono nella openWindow');
                         my_window = window.open("success.jsp", "mywindow1", "status=1,width=350,height=150");
                         my_window.document.write('<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>');
                         my_window.document.write('<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>');
                         my_window.document.write('<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>');
                         my_window.document.write('<html> <head>');
                         my_window.document.write('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">');
                         my_window.document.write('<link rel="stylesheet" type="text/css" href="css/style_final.css" />');
                         my_window.document.write('<title>File Download</title>');
                         my_window.document.write('</head>');
                         my_window.document.write('<body style="background: white ">');
                         my_window.document.write('<div>');
                         my_window.document.write('<div style="float: left;">');
                         my_window.document.write('[img]immagini/Doc_logo.png[/img]');
                         my_window.document.write('</div>');
                         my_window.document.write('<div style="float: left;">');
                         my_window.document.write('<h1><bean:message key="label.Document_info" /></h1>
    ');       
                         my_window.document.write('<bean:message key="label.nome_file" /> '+nome+'
    ');
                         my_window.document.write('<bean:message key="label.TipoFileUpload" /> '+tipo+'
    ');
                         my_window.document.write('<bean:message key="label.data_caricamento" />'+data+'
    ');
                         my_window.document.write('<h1><bean:message key="label.Document_Classifier" /> </h1>
    ');
                         my_window.document.write('Rocchio: '+rocchio+'
    ');
                         my_window.document.write('Example: '+example+'
    ');
                         my_window.document.write('Bayes : '+bayes+'
    ');
                         my_window.document.write('<h1><bean:message key="label.Document_meta" /> </h1>
    ');
                         my_window.document.write('</div>');
                         my_window.document.write('</div>');
                         my_window.document.write('</body>');
                         my_window.document.write('</html>');
                        }  
            </script>



    qualcuno sa come posso fare?

    grazie in anticipo!

  2. #2
    Moderatore di Annunci siti web, Offro lavoro/collaborazione, Cerco lavoro L'avatar di cavicchiandrea
    Registrato dal
    Aug 2001
    Messaggi
    26,133
    Ma ArrayList è una array jsp? Se la risposta e si dubito che si possa "stampare" in javascript dovrai procedere lato server
    Cavicchi Andrea
    Problemi con javascript, jquery, ajax clicca qui

  3. #3
    Utente di HTML.it
    Registrato dal
    Nov 2009
    Messaggi
    142
    mmmm no io ho fatto cosi per passarlo...

    codice:
    <bean:define id="list" type="java.util.ArrayList">
         <bean:write name="dataList" property="valori"/>
     </bean:define>
        
       
    	<tr><td> <bean:write name="dataList" property="name"/></td>
                <td> <bean:write name="dataList" property="type"/></td>
                <td> <bean:write name="dataList" property="datacaricamento"/></td>
                <td> <html:link  href=" " onclick="openWindow('${nome}','${tipo}','${Rocchio}','${Example}','${Bayes}','${datacaricamento}','${list}')">View</html:link></td>
                </tr>
    in effetti nn sono sicurissimo

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.