Bonjour,
Quand je veux ouvrir une Servlet, le message d'erreur suivant apparaît, pourquoi?
Voici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 HTTP Status 503 - Servlet action is currently unavailable ------------------------------------------------------------------ type : Status report message : Servlet action is currently unavailable description : The requested service (Servlet action is currently unavailable) is not currently available.
Ma page JSP :
Mon struts-config.xml :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42 <%@ taglib uri="/tags/struts-bean" prefix="bean" %> <%@ taglib uri="/tags/struts-html" prefix="html" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html:html> <head> <title>Log On FMM</title> </head> <body width="700"> <u>Formulaire de test avec Validator </u> <p> <logic:messagesPresent> <ul> <html:messages id="error"> <li><bean:write name="error" /></li> </html:messages> </ul> </logic:messagesPresent> <html:form action="/testValidator_submit.do" onsubmit="return validateTestValidatorForm(this);"> <html:text property="name" size="20"> <bean:message key="prompt.test.name"/> </html:text> <br><br> <html:submit property="submit" value="Vérifier" onclick="bCancel=false;"/> <html:reset value="Effacer" /> <html:cancel onclick="bCancel=true;" value="Annuler"/> <!-- Begin Validator Javascript Function--> <html:javascript formName="testValidatorForm" /> <!-- End of Validator Javascript Function--> </html:form> </p> </body> </html:html>
Mon ActionForm :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45 <struts-config> <!-- ========== Data Source Configuration =============================== --> <data-sources /> <!-- ========== Form Bean Definitions ================================== --> <form-beans type="org.apache.struts.action.ActionFormBean"> <form-bean name="testValidatorForm" type="st.ccam.fmm.web.forms.testValidatorForm"> <form-property name="name" type="java.lang.String" /> </form-bean> </form-beans> <!-- ========== Global Exception Definitions ============================== --> <global-exceptions /> <!-- ========== Global Forward Definitions =============================== --> <global-forwards /> <!-- ========== Action Mapping Definitions =============================== --> <action-mappings> <action name="/welcome" path="/index.jsp" /> <action path="/testValidator" forward="/pages/testValidator.jsp" /> <action path="/testValidator_submit" type="st.ccam.fmm.web.actions.testValidatorAction" name="testValidatorForm" scope="session" validate="true" cancellable="true" input="input"> <forward name="success" path="/pages/jsTestValidator.jsp" /> <forward name="input" path="/pages/testValidator.jsp" /> </action> <action path="/jsTestValidator" forward="/pages/jsTestValidator.jsp" /> </action-mappings> <message-resources parameter="ApplicationResources" null="false" /> <plug-in className="org.apache.struts.validator.ValidatorPlugIn" > <set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validator.xml" /> </plug-in> </struts-config>
et mon ActionForm :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54 import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.log4j.Logger; public final class testValidatorAction extends Action { /** LOG4J Logger instance declaration */ final static Logger logger = Logger.getLogger(testValidatorAction.class.getName()); public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException { HttpSession session = request.getSession(true); if (isCancelled(request)) { if (logger.isInfoEnabled()) { logger.info( " " + mapping.getAttribute() + " - Registration transaction was cancelled"); } removeFormBean(mapping, request); return (mapping.findForward("success")); } return mapping.findForward("success"); } protected void removeFormBean( ActionMapping mapping, HttpServletRequest request) { // Remove the obsolete form bean if (mapping.getAttribute() != null) { if ("request".equals(mapping.getScope())) { request.removeAttribute(mapping.getAttribute()); } else { HttpSession session = request.getSession(); session.removeAttribute(mapping.getAttribute()); } } } }
Merci de votre aide.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45 import java.io.Serializable; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionMapping; import org.apache.struts.validator.ValidatorForm; /** * Form bean for the test page. This form has the following field, * with default value in square bracket: * <ul> * <li><b>name</b> - Entered name value * </ul> */ public final class testValidatorForm extends ValidatorForm implements Serializable { /** * */ private static final long serialVersionUID = 1L; // ------------------ Instance Variables /** The name. */ private String name = null; // -------------------- Properties /** Return the name. */ public String getName() { return (this.name); } /** * Set the name. * @param name The new name */ public void setName(String name) { this.name = name; } /** * Reset all properties to their default values. * * @param mapping The mapping used to select this instance * @param request The servlet request we are processing */ public void reset(ActionMapping mapping, HttpServletRequest request) { name = null; } }
Partager