Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

@webServlet is not working in weblogic10.3

 
suganandan sundaresan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@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
Posts: 98
Oracle Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
{
...
}
 
suganandan sundaresan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 98
Oracle Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to import "weblogic.servlet.annotation.WLServlet" class


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic