Annotation « Development « JSP-Servlet Q&A

1. How can I get access to the HttpServletRequest object when using Java Web Services

I'm using Java 6, Tomcat 6, and Metro. I use WebService and WebMethod annotations to expose my web service. I would like to obtain information about the request. I tried the ...

2. @WebServlet annotation support in java 1.6.013

I'm stepping into the world of Servlets and 3.0 in particular and I saw certain methods and annotations used in examples and tutorials which talked about this being available when JAVA ...

3. Servlet 3.0 annotations

Is it possible to set welcome-file tag from standard web.xml file by servlet 3.0 annotation ?


4. Would Servlet 3 annotations enable secret backdoor access?

I hope people don't mind me asking a question which is slightly future gazing. Please forgive me if my understanding is incorrect (and please put me right!). Servlet 3 ...

5. @Override for interface methods causes JSP compilation to fail

For some reason, putting @Override on methods overriding interface methods causes JSP compilation to fail in weblogic. Everything is definitely running off of JDK 1.6.0_14, but this Java 5'ism still persists. Oddly, ...

6. Correct syntax for javax.servlet.annotation.ServletSecurity

Has anybody got a code sample for javax.servlet.annotation.ServletSecurity annotation. I have had a look around but all I find are javadoc pages which won´t tell you how javax.servlet.annotation.ServletSecurity and javax.servlet.annotation.HttpMethodConstraint fit together ...

7. Servlet Security Annotation Error

i have coded a login page using programmatic approaches but it does not successful when the code have roles

@WebServlet(name = "LoginController", urlPatterns = {"/LoginController"})
@ServletSecurity(@HttpConstraint(transportGuarantee= ServletSecurity.TransportGuarantee.NONE, rolesAllowed={"User"}))
public class LoginController extends HttpServlet {


8. How is annotations support in jsp implemented in sitebricks?

Here is an example from the SiteBricks user guide:

    @ShowIf(true)     <----- I'm impressed with this line
    <p>${message} from Sitebricks!</p>
I'm ...

9. @WebServlet annotation not recognized; init doesn't run

I'm trying to learn annotations. I currently have a webapp that runs an init() when the app is started in Tomcat. The following code works... web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns=""

10. Servlet 3.0: where is @WebServletContextListener?

I am trying to follow a Servlet 3.0 tutorial which refers to @WebServletContextListener. However, I cannot find such an annotation in my javaee-web-api-6.0.jar dependency (I am using maven). So, where ...

11. @WebServlet annotation and error 404

First of all: I use glassfish 3.1 + elicpse jee indigo. I want to testing cache solutions with javaee so I made a dummy app. I have a big generated database and ...

12. Replace a context-param element with a Servlet 3.0 annotation

Given: a Java EE 5 web app that has a web.xml that has a snippet like

What would I need ...

13. Use cases for @WebInitParam

Since the Servlet 3.0 specification there is the possibility of declaring servlet mapping metadata as annotation on the servlet class:

@WebServlet(name="appInfoServlet", urlPatterns ="/appInfo", initParams = @WebInitParam(name="", value=""))
public class AppInfoServlet extends HttpServlet {

What ...

14. What Is Annotation?

15. annotations loading in VM

16. Annotation inheritence limitations

17. Server independent JNDI name annotation

18. custom annotation

20. secure web service annotation?

21. difference between annotations

22. Difference in specyfying Annotations

24. What are Annotations?

26. why can't we use Annotation for when we Creating a Java Stand-Alone Client

Dependency injection of EJB components in a stand alone client is not possible because there is no container available to do the injection. However, there are application client containers which you can use to run that standalone client as an application client, so that injection becomes possible. You will have to check the documentation of the application server you are using ...

29. package javax.servlet.annotation does not exist

Hello, I am facing the following error while compiling the code: C:\Program Files (x86)\Java\Tomcat7.2\webapps\ROOT\WEB-INF\classes>javac FileUpl package javax.servlet.annotation does not exist import javax.servlet.annotation.WebServlet; ^ cannot find symbol symbol: class WebServlet @WebServlet(name="FileUpload", urlPatterns={"/FileUpload"}) ^ warning: sun.misc.BASE64Encoder is Sun proprietary API and may be removed in a future release String encodedString = new sun.misc.BASE64Encoder().encode(fileConten t); // changes done. ^ Note: ...

30. Documentation for Java EE Annotations

I've been searching and searching for a list of annotations, their syntax, properties, etc. but haven't been able to find anything. Does anyone know where I might find such a thing? For example: @MessageDriven(mappedName = "jms/Queue", activationConfig = { @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge") , @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue") }I'm wonder what the syntax is, what these options ...

33. servlet annotation

37. Comment: Follow up on Servlet 3.0 Security Annotations

Bheem Shukla wrote: > Shing Wai, > > Thanks a lot for looking . > > No error messages seen in log > Snippet of latest log deployment : > ------------------------------------------------------------------------------------------------------------------ > [#|2010-01-19T12:06:26.762-0600|INFO|glassfishv3.0||_ThreadID=11;_ThreadName=Thread-1;|Loading > application servlet3web at /servlet3web|#] > [#|2010-01-19T12:06:26.762-0600|INFO|glassfishv3.0||_ThreadID=11;_ThreadName=FelixStartLevel;|Loading > application servlet3web at /servlet3web|#] > [#|2010-01-19T12:06:26.763-0600|INFO|glassfishv3.0||_ThreadID=11;_ThreadName=Thread-1;|Loading > servlet3web Application done is 11375 ms|#] > > ------------------------------------------------------------------------------------------------------------------ > > Also attaching ...