aspose file tools*
The moose likes BEA/Weblogic and the fly likes @webServlet is not working in weblogic10.3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "@webServlet is not working in weblogic10.3" Watch "@webServlet is not working in weblogic10.3" New topic
Author

@webServlet is not working in weblogic10.3

suganandan sundaresan
Greenhorn

Joined: Oct 06, 2005
Posts: 6
@webServlet was not supported by servlet application. the page cannot be displayed without web.xml. but it takes init- params in @webServlet.can anybody help me . i'm using weblogic server 10.3
anandraj tadkal
Ranch Hand

Joined: Feb 22, 2011
Posts: 98

Try using @WLServlet annotation, its the annotation used to register Servlets in WebLogic Server.

For ex: The following annotation, placed
at the top of the SimpleServlet source file, eliminates the need for web.xml entries for this servlet:

@WLServlet (
name = "SimpleServlet",
mapping = {"/simple"}
)
public class SimpleServlet extends HttpServlet
{
...
}


Regards,
Anandraj
http://weblogic-wonders.com
Follow us on facebook:
https://www.facebook.com/weblogicwonders
suganandan sundaresan
Greenhorn

Joined: Oct 06, 2005
Posts: 6
Thanks Mr.Anandraj for your kind Reply
but the thing was @WLServlet can't be resolved, what package should i want to import for using this.
i imported import javax.servlet.annotation.*;
but it was not regconized. please help me if you know the solution.
here is my Program

***************************
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.*;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WLServlet(name="HelloAnnotationServlet", mapping={"/simple"})


public class HelloAnnotationServlet extends HttpServlet {

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
resp.setContentType("text/html");
PrintWriter out = resp.getWriter();
out.write("<h2> Welcome to the world of servlet annotation </h2>");
out.write("
");
out.close();
}


}

Thanks & Regards
suganandan
anandraj tadkal
Ranch Hand

Joined: Feb 22, 2011
Posts: 98

Try to import "weblogic.servlet.annotation.WLServlet" class


 
Don't get me started about those stupid light bulbs.
 
subject: @webServlet is not working in weblogic10.3