java - how to write first servlet class in Eclipsed -
package com.example; import java.io.ioexception; import javax.servlet.servletexception; import javax.servlet.annotation.webservlet; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; /** * servlet implementation class helloworld */ @webservlet("/helloworld") public class helloworld extends httpservlet { private static final long serialversionuid = 1l; /** * @see httpservlet#httpservlet() */ public helloworld() { super(); // todo auto-generated constructor stub } /** * @see httpservlet#doget(httpservletrequest request, httpservletresponse response) */ protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { // todo auto-generated method stub } /** * @see httpservlet#dopost(httpservletrequest request, httpservletresponse response) */ protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { // todo auto-generated method stub } }
i have created class hello-world , added servelte api getting error @webservlet("/helloworld")
, show error messge [the attribute value undefined annotation type webservlet].
please tell me how fix it?
http://docs.oracle.com/javaee/6/api/javax/servlet/annotation/webservlet.html
try add atrribute value: @webservlet(value="/helloworld")
Comments
Post a Comment