vendredi 20 décembre 2019

How can I use Java variable in HTML tag in JSP?

I'm trying the following code in my .jsp file:

<select>
    <%DBHandler db= new DBHandler();%>
    <%db.init();%>
    <%String[] res= db.getExpertise();%>
    <% for(int i=0;i< res.length;i++){ %>

        <option value="<%=res[i]%>"><%=res[i]%></option>
    <%}%>
</select>

But I don't know how to assign value in tag with a variable in java code.




Aucun commentaire:

Enregistrer un commentaire