Hi there. I have the following JSP page which i am populating it through a JTable kind of class. This is populating the page in a tabelar mode, and can be controlled by the number of line and number of column.
JSP page: <%@ page import="databeans.*"%> <%@ page import="java.sql.Connection"%> <jsp:useBean id="ss_DatePers" class="databeans.Personal" scope="session"/> <%! ModelJTableGeneralizat modelDate=null;%> <% // initializez modelul de date cu pontajul angajatului curent selectat Connection conn=Utilitati.getConexiune(); String filtruDate=" where marca="+ss_DatePers.getMarca()+" and to_char(data,'mm')='"+request.getParameter("luna")+"' order by data"; java.util.ArrayList datePontaj = ObiectPersistent.getObjects(Pontaje.class ,conn,filtruDate); modelDate = new ModelJTableGeneralizat(Pontaje.class,datePontaj,conn); conn.close(); request.getSession().setAttribute("ss_ModelDatePontaje",modelDate); %> <html:form action="/pontajAction" > <TABLE width='180' border='0.2'> <tr> <% for (int k=0;k<modelDate.getColumnCount();k++) {%> <td align="center"> <%=modelDate.getColumnName(k).toUpperCase()%> </td> <%}%> </TR> <% for (int i=0;i<modelDate.getRowCount();i++){%> <TR> <% for (int k=0;k<modelDate.getColumnCount();k++) {%> <td> <INPUT type='text' size='10' name="valoare_<%=i+"_"+k%>" value="<%=modelDate.getValueAt(i,k)%>" <%=(k==0||k==1)?"readonly='true'":" "%> > </td> <%}%> </TR> <%}%> </TABLE> <html:submit property="save" value="Salveaza Modificari"/> </html:form> As you can see i can control every property of the INPUT depending on the number of column. <%=(k==0||k==1)?"readonly='true'":" "%> > This means that for the first and second column, the INPUT are readonly. What i would like to do is to have one column like a combobox, and for that i was thinking to use <html:select> tag. So the code should be like this : .......................................................................................... <% for (int k=0;k<modelDate.getColumnCount();k++) { if (k==5) {%> // column 5 is a select box <td> <html:select property="valoare_<%=i+"_"+k%>"> <% Connection conexiune = Utilitati.getConexiune(); System.out.println("conexiune"+conexiune); java.util.ArrayList listaActivitati= ObiectPersistent.getObjects(Activitati.class,conexiune,null); System.out.println("listaActivitati"+listaActivitati); conexiune.close(); for(int j=0;j<listaActivitati.size();j++) { %> <html:option value="<%=((Activitati)listaActivitati.get(j)).getActivid()%>"> <%=((Activitati)listaActivitati.get(j)).getNumeactiv()%> </html:option> <%}%> <%-- s-a inchis for-ul--%> </html:select> <%} else{%> <td> <INPUT type='text' size='10' name="valoare_<%=i+"_"+k%>" value="<%=modelDate.getValueAt(i,k)%>" <%=(k==0||k==1)?"readonly='true'":" "%> > </td> The problem is that i can't use this because struts is expecting for a getter method for variable defined in property option of <html:select>. I could create another form bean class for this but it's getting very complicated. Does anyone know how can i use the JTable class and <html:selec> in a more easy way ? Thanks and hope that you understood me.