[Résolu] [Java/Jsp] La ressource demandée n'est pas disponible

La ressource demandée n'est pas disponible [Résolu] [Java/Jsp] - Java - Programmation

Marsh Posté le 19-05-2008 à 17:31:48    

Bonjour,
 
Je code un formulaire.  
Voici sa courte description :
 

Code :
  1. <form name='formClient' action="Client/Dispatch1.java" method='POST'>


 
Lorsque je clique donc sur Valider, ça doit faire appel au doGet de ma classe Dispatch1.java.
Ce doGet fait un executeUpdate sur une BD SQL Server et y ajoute donc des données.
 
Or, lorsque je clique actuellement sur Valider, une erreur 404 s'affiche :
 
type Rapport d'état
 
message /SosPt_V0.1/Dispatch1.java
 
description La ressource demandée (/SosPt_V0.1/Dispatch1.java) n'est pas disponible.

 
 
D'où cela vient-il ? J'ai pourtant bien ajouté Dispatch1.java dans le web.xml en tant que Servlet.  
Merci de votre aide.


Message édité par Sbartacus le 20-05-2008 à 15:58:02
Reply

Marsh Posté le 19-05-2008 à 17:31:48   

Reply

Marsh Posté le 20-05-2008 à 14:24:55    

Voici si ça peut aider à identifier le problème, des compléments :
 
Voici donc un screen du répertoire de mon projet ainsi que le message d'erreur :
 
http://www.noelshack.com/uploads/ErreurNetbeans030018.jpg
 
Enfin voici mon fichier Web.xml
 

Code :
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ [...] &#034;&gt;
  3.     <servlet>
  4.         <description>Ajoute des données à la BD</description>
  5.         <servlet-name>DispatchClient</servlet-name>
  6.         <servlet-class>Client.DispatchClient</servlet-class>
  7.     </servlet>
  8.     <servlet-mapping>
  9.  <servlet-name>DispatchClient</servlet-name>
  10.  <url-pattern>/DispatchClient</url-pattern>
  11. </servlet-mapping>
  12.     <session-config>
  13.         <session-timeout>
  14.             30
  15.         </session-timeout>
  16.     </session-config>
  17.     <welcome-file-list>
  18.         <welcome-file>formuClient.jsp</welcome-file>
  19.         <welcome-file>index.jsp</welcome-file>
  20.         </welcome-file-list>
  21.     </web-app>


 
J'avoue que je suis un peu perdu. :-(
Donc pour résumer, formuClient.jsp est la page d'accueil, et contient un formulaire qui, lors de la validation doit dispatcher vers DispatchClient.java.
Merci de votre aide.

Reply

Marsh Posté le 20-05-2008 à 15:57:51    

Code :
  1. <servlet-mapping>
  2.   <servlet-name>DispatchClient</servlet-name>
  3.   <url-pattern>/DispatchClient</url-pattern>
  4. </servlet-mapping>
 

Donc l'action de ton formulaire doit être comme l'url-pattern :

Code :
  1. <form action="/DispatchClient">


Message édité par Bidem le 20-05-2008 à 15:58:06
Reply

Marsh Posté le 20-05-2008 à 15:59:23    

Merci beaucoup pour ta réponse bidem.
J'regrette juste de ne pas avoir posté ce topic plus tôt : j'venais de trouver la réponse 20 minutes avant ton post, après maintes et maintes galères, pensant que ça venait du web.xml. ^^
En tout cas merci. :)

Reply

Marsh Posté le 02-01-2013 à 15:42:55    

si le meme problem en JSF
 
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ [...] .xsd&#034; id="WebApp_ID" version="2.5">
  <display-name>AchatWeb</display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
  </servlet-mapping>
  <context-param>
    <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
  </context-param>
  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>resources.application</param-value>
  </context-param>
  <context-param>
    <param-name>org.richfaces.SKIN</param-name>
    <param-value>DEFAULT</param-value>
  </context-param>
  <context-param>
    <param-name>org.richfaces.CONTROL_SKINNING</param-name>
    <param-value>enable</param-value>
  </context-param>
  <filter>
    <display-name>RichFaces Filter</display-name>
    <filter-name>richfaces</filter-name>
    <filter-class>org.ajax4jsf.Filter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>richfaces</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    <dispatcher>INCLUDE</dispatcher>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
  </filter-mapping>
  <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
  </listener>
  <login-config>
    <auth-method>BASIC</auth-method>
  </login-config>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.faces</url-pattern>
  </servlet-mapping>
  <context-param>
    <description>
 This parameter tells MyFaces if javascript code should be allowed in
 the rendered HTML output.
 If javascript is allowed, command_link anchors will have javascript code
 that submits the corresponding form.
 If javascript is not allowed, the state saving info and nested parameters
 will be added as url parameters.
 Default is 'true'</description>
    <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
    <param-value>true</param-value>
  </context-param>
  <context-param>
    <description>
 If true, rendered HTML code will be formatted, so that it is 'human-readable'
 i.e. additional line separators and whitespace will be written, that do not
 influence the HTML code.
 Default is 'true'</description>
    <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
    <param-value>true</param-value>
  </context-param>
  <context-param>
    <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
    <param-value>false</param-value>
  </context-param>
  <context-param>
    <description>
 If true, a javascript function will be rendered that is able to restore the
 former vertical scroll on every request. Convenient feature if you have pages
 with long lists and you do not want the browser page to always jump to the top
 if you trigger a link or button action that stays on the same page.
 Default is 'false'
</description>
    <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
    <param-value>true</param-value>
  </context-param>
  <listener>
    <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
  </listener>
</web-app>
 
 
 
racin : webcontnent/web/index.jsp
          webcontnent/web-inf/web.xml

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed