Servlet 3.0 Support

This topic contains 3 replies, has 2 voices, and was last updated by Profile photo of support-swapna support-swapna 4 years ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #317723
    Profile photo of Frank Lawlor
    Frank Lawlor
    Participant

    The Ad for ME9 makes a point of Servlet 3.0 support, but I cannot figure out how to enable this.

    There is no option on the Web App wizard (I did specify EE 6.0) for servlet 3.

    When I try to type @Servlet in a class it does not resolve. The build path does not show the servlet 3 annotations jar.

    I see no way to add servlet 3 capabilities to the project.
    There is no educational material on this.

    So how do I say I want Servlet 3.0 support?

    — Frank

    #317727
    Profile photo of Frank Lawlor
    Frank Lawlor
    Participant

    I figured out part of my own problem.
    The proper annotation is @WebServlet

    I would still like to understand what enables Servlet 3.0 (is it EE 6.0 selection?).

    #317728
    Profile photo of Frank Lawlor
    Frank Lawlor
    Participant

    I finally got a simple example to work.
    Here is what I learned.

    Since ME9 says it supports servlet 3, I expected the MyEclipse Tomcat server (v6) to work, but it doesn’t seem to.
    I installed tomcat 7, which worked.

    The are a lot of posts on the web about servlet 3, but I guess they don’t match what actually got shipped.
    It would be nice to at least have a reference to documetation of what actually works in the ME9 support.

    I had to inherit from HttpServlet (some posts say this was no longer necessary).
    The @GET, @PUT etc. annotations don’t seem to work, although they are defined.

    This worked:

    @WebServlet(urlPatterns={"/MyApp"})
    public class MyServlet extends HttpServlet {
        @Override
        public void doGet(HttpServletRequest req, HttpServletResponse res) 
                throws IOException, ServletException {
            PrintWriter out = res.getWriter();
            out.write("<h2>Hello GET</h2>");
            out.close();
            
        }
    }
    #317762
    Profile photo of support-swapna
    support-swapna
    Moderator

    flawlor,

    Glad that you got it working. I have escalated your concerns about documentation to the team.
    Sorry for the inconvenience caused.

Viewing 4 posts - 1 through 4 (of 4 total)

The forum ‘Web Development (HTML, CSS, etc.)’ is closed to new topics and replies.