Bonjour a tous,
debutant en J2EE.
voila, je viens de faire un petit code de servlet qui permet d'envoyer une reponse en me disant que "The JDBC URL has been set as a context attribute".
Apres avoir lance la servlet le browser me repond "The request ressource(/ctx/servlet/SetttingCntx) is not available.

voici mon code complet:
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
import javax.servlet.*;
import java.io.*;
 
public class SetttingCntx extends GenericServlet
{
ServletContext ctx;
public void init (ServletConfig cfig)
{
/*Obtain the ServletContext object */
ctx=cfig.getServletContext();
}
public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException
{
/* set the context attribute*/
ctx.setAttribute("URL","jdbc:odbc:EmployeesDB");
/*obtain the PrintWriter object*/
PrintWriter pw=response.getWriter();
/* Send response to indicate that the URL attribute as been set*/
response.setContentType("text/html");
pw.println("<B>The JDBC URL has been set as a context attribute</B>");
}
}
Ou se trouve le probleme?
J'ai bien fait le deploiement.