prima di tutto, salve a tutti.
Devo popolare una select usando struts. Le varie options sono contenute dentro un List di oggetti. Questi oggetti hanno due proprietà: id e title. Come posso renderizzare questa lista usando i tag di Struts?
vi posto la pagina jsp che mostra come ho recuperato la lista e la form bean associata alla form costruita con struts:
e la pagina jsp:codice:package it.dpp.cd.forms; import javax.servlet.http.*; import org.apache.struts.action.*; import java.util.List; public class DeleteCDForm extends ActionForm { private String toBeDeleted; private String id; private String title; private List list; public String getToBeDeleted() { return this.toBeDeleted; } public void setToBeDeleted(String toBeDeleted) { this.toBeDeleted = toBeDeleted; } public String getId() { return this.id; } public void setId(String id) { this.id = id; } public String getTitle() { return this.title; } public void setTitle(String title) { this.title = title; } public List getList() { return this.list; } public void setList(List list) { this.list = list; } }
Spero che qualcuno mi possa dare una mano...codice:<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" import="it.dpp.cd.dao.CDDao" import="java.util.*" import="it.dpp.cd.entities.CD"%> <%@ taglib prefix="html" uri="http://struts.apache.org/tags-html" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Cancella CD</title> </head> <body> <h1>Cancella CD</h1><hr> <% List list = CDDao.searchCD(""); %> <html:form action="/delete.do"> Seleziona il CD da cancellare: <html:select property="toBeDeleted"> </html:select><html:submit /> </html:form> annulla </body> </html>

Rispondi quotando