저는 초보 개발자이며 Java 웹 사이트에서 웹 응용 프로그램을 만들고 있습니다. 사용자가 정보를 입력 한 후 비어있는 내 스트럿 양식에 문제가 있습니다. 나는 그것을 해결하기 위해 여러 방법을 시도했지만 아무 것도 효과가 없었다. 어쩌면 코드 라인이 도움이 될지도 모른다;). 내 JSP 페이지 :Struts 양식이 아직 비어 있습니다.
<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">État : </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ébut :<span style="font-weight: bolder; color: red;"> *</span></td>
<td>
<input type="text" name="dateDebut" size="10" maxlength="10" id="date" value=""
required="required">
</td>
</tr>
<tr>
<td>Date de fin :<span style="font-weight: bolder; color: red;"> *</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é(e)(s)</td>
<td>
<select name="chargeMatricule">
<option value="0" selected></option>
<% for (Utilisateur u : utilisateurs) {%>
<option value="<%=u.getUtilisateurMatricule()%>"><%=u.getUtilisateurNom() + ", " + u.getUtilisateurPrenom()%></option>
<%}%>
</select>
</td>
</tr>
<tr>
<td><font size="3">Activité : </td>
<td>
<select name="activiteNom">
<option value="0" selected></option>
<% for (String s : activites) {%>
<option value="<%=s%>"><%=s%></option>
<%}%>
</select>
</td>
</tr>
<td colspan='5' align="center">
<input type="submit">
</td>
</tr>
</form>
</div>
</td>
이
내 조치 :
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();
희망, 사람이 무엇이 잘못되었는지 볼 수 있습니다. 좋은 하루 되세요 !! 여기 <html:form>
???? JSP에는 Struts 태그가없고 일반 HTML/JSP 만 포함됩니다. 튜토리얼을 따라 해 보셨습니까? – SJuan76
struts 태그를 추가 할 필요가 없습니다. 양식에 다음이 포함되어 있습니다. form action = "statistiques.do". 그리고 나는 struts-config 파일에 선언 된 액션 폼을 사용하고 있습니다 !!! – washint31