Tuesday, 15 May 2012

java - Struts forms still empty -



java - Struts forms still empty -

i beginner developer , i'm working on web application in java whith struts. have problem struts form remain empty after user enters informations. i've tried many way resolve nil worked. maybe code lines help help me ;). jsp page :

<tr> <td colspan="5"> <div class="content" align="center"> <form action="statistiques.do" method="post"> <input type="hidden" name="operation" value="module1"> <tr> <td><font size="3">&eacute;tat&nbsp;:&nbsp;</td> <td> <select name="choixetat"> <option value='1' selected>tous</option> <option value='2' >actif</option> <option value='3' >inactif</option> </select> </td> </tr> <tr> <td>date de d&eacute;but&nbsp;:<span style="font-weight: bolder; color: red;">&nbsp;&#42;</span></td> <td> <input type="text" name="datedebut" size="10" maxlength="10" id="date" value="" required="required"> </td> </tr> <tr> <td>date de fin&nbsp;:<span style="font-weight: bolder; color: red;">&nbsp;&#42;</span></td> <td> <input type="text" name="datefin" size="10" maxlength="10" id="date2" value="" required="required"> </td> </tr> <tr> <td><font size="3">charg&eacute;(e)(s)</td> <td> <select name="chargematricule"> <option value="0" selected></option> <% (utilisateur u : utilisateurs) {%> <option value="<%=u.getutilisateurmatricule()%>"><%=u.getutilisateurnom() + ", " + u.getutilisateurprenom()%></option> <%}%> </select> </td> </tr> <tr> <td><font size="3">activit&eacute;&nbsp;:&nbsp;</td> <td> <select name="activitenom"> <option value="0" selected></option> <% (string s : activites) {%> <option value="<%=s%>"><%=s%></option> <%}%> </select> </td> </tr> <td colspan='5' align="center"> <input type="submit"> </td> </tr> </form> </div> </td>

and action :

public class actionstatistiques extends dispatchaction { public actionforward module1(actionmapping mapping, actionform form, httpservletrequest request, httpservletresponse response) throws exception { formstatmod1 forms = (formstatmod1) form; servicestatistiques service = new servicestatistiques(); string dd = forms.getdatedebut(); string datedebut = dd.substring(6, 10) + '-' + dd.substring(3, 5) + '-' + dd.substring(0, 2); string df = forms.getdatefin(); string datefin = df.substring(6, 10) + '-' + df.substring(3, 5) + '-' + df.substring(0, 2); collection[] collections = service.module1(forms.getchoixetat(), datedebut, datefin); collection<flux> listef = collections[1]; string activitenom = forms.getactivitenom(); string chargematricule = forms.getchargematricule();

hope, see what's wrong. have nice day!!

use <html:form>

here illustration - http://struts.apache.org/release/1.3.x/faqs/actionform.html

java jsp struts

No comments:

Post a Comment