Hi,
I have following code .....
-----filter----------
package com.sams.learnweblogic7.servlets;
public class DemonstrateFilters implements Filter {
private FilterConfig filterConfig;
public DemonstrateFilters() {
log("DemonstrateFilters constructer invoked ...");
}
public void init(FilterConfig filterConfig)throws ServletException {
this.filterConfig = filterConfig;
}
public void destroy() {
this.filterConfig = null;
}
public void doFilter(ServletRequest req, ServletResponse res, FilterChain fc)
throws java.io.IOException, javax.servlet.ServletException {
log("The doFilter method has been invoked.");
fc.doFilter(req,res);
}
public FilterConfig getFilterConfig() {
return filterConfig;
}
public void setFilterConfig(FilterConfig cfg) {
filterConfig = cfg;
}
public void log(
String s) {
System.out.println("[loginFilter]: " + s);
}
}
----------servlet----------------
package com.sams.learnweblogic7.servlets;
public class BookShoppingServlet extends HttpServlet{
public void init(ServletConfig sc)throws ServletException{
super.init(sc);
}
public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException{
PrintWriter out = res.getWriter();
String name = req.getParameter("name");
System.out.println("hello");
}
}
--------web.xml------------
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<description>
JSP 2.0 Examples.
</description>
<display-name>JSP 2.0 Examples</display-name>
<filter>
<filter-name>DemonstrateFilters</filter-name>
<filter-class>com.sams.learnweblogic7.servlets.DemonstrateFilters</filter-class>
</filter>
<filter-mapping>
<filter-name>DemonstrateFilters</filter-name>
<url-pattern>/BookShoppingServlet</url-pattern>
</filter-mapping>
<
servlet>
<servlet-name>BookShoppingServlet</servlet-name>
<servlet-classes>com.sams.learningweblogic7.servlets.BookShoppingServlet</servlet-classes>
</servlet>
</web-app>
---------------------------------------------------------------
i am using the following url :
http://localhost:8080/filters/BookShoppingServlet to call the servlet, but getting the following error : The requested resource (Servlet BookShoppingServlet is not available) is not available.
Any help will be appreciated.
thnx.