|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Member
Iscritto dal: Oct 2008
Messaggi: 112
|
J2EE + Struts
Salve a tutti, premetto che sono alle prime armi, comunque, per un'esercitazione nello sviluppo di app web, devo inserire un prodotto nel db, il db è già creato...tutto sembra a posto ma quando inserisco i dati nei campi e schiaccio il bottone di inserimento non mi inserisce nulla, nel pagine jsp ho costruito i vari campi....:
Codice:
<html:form action="/aggiungiProdotto.do"> <table> <tr> <td>Codice :</td> <td><html:text property="codice"/></td> </tr> <tr> <td>Marca : </td> <td><html:text property="marca"/></td> </tr> <tr> <td>Descrizione : </td> <td><html:text property="descrizione"/></td> </tr> <tr> <td>Giacenza : </td> <td><html:text property="giacenza"/></td> </tr> <tr> <td><html:submit value="Inserisci"/></td> </tr> </table> </html:form> Codice:
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { HttpSession session = request.getSession(); FormProdotto formProdotto = (FormProdotto) form; Prodotto prodotto = new Prodotto(); BeanUtils.copyProperties(formProdotto, prodotto); try{ DAOProdotto.doInsert(prodotto); session.setAttribute("prodotto", prodotto); return mapping.findForward("continua"); }catch(DAOException ex){ logger.error("Errore : " + ex.toString()); return mapping.findForward("annulla"); } } Codice:
<action path="/aggiungiProdotto" input="/prodotto.jsp" type="org.tizio.esercitazione.controllo.AzioneInseriementoProdotto" name="formProdotto" scope="request" validate="true" cancellable="true"> <forward name="continua" path="/ok.jsp"/> <forward name="annulla" path= "/schermoErrore.jsp"/> </action> |
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 03:04.