| Author |
can we use annotations instead of web.xml?
|
Punit Jain
Ranch Hand
Joined: Aug 20, 2011
Posts: 902
|
|
i don't know weather it can be done or not,
but is it possible to write servlet without DD, i mean can we use annotations instead of deployment descriptor to write a servlet?
if so, how??
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56157
|
|
|
Only with Servlets 3.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
How does that order filters? With web.xml you can determine the order filters are called in, but I didn't see anything about that in the WebFilter annotation.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Punit Jain
Ranch Hand
Joined: Aug 20, 2011
Posts: 902
|
|
How does that order filters? With web.xml you can determine the order filters are called in, but I didn't see anything about that in the WebFilter annotation.
i also don't know how to do that with annotations, the only thing which i have tried is url-pattern.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56157
|
|
I haven't played around with Servlets 3 any yet -- it's hard enough to get clients to use Tomcat 6, no way are they moving to 7 yet.
But, I think I read somewhere that if stuff like order is important, you need to fall back to using the deployment descriptor for those elements.
|
 |
Punit Jain
Ranch Hand
Joined: Aug 20, 2011
Posts: 902
|
|
Thank you bear bibeault.
so to be short and precise, we can't do all things with annotations, which we can do with deployment descriptor..
also we can't do such things like security concerns (security roles etc), with annotations, i think..
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56157
|
|
|
I believe that to be the case, but the Servlet Spec has the final say.
|
 |
Punit Jain
Ranch Hand
Joined: Aug 20, 2011
Posts: 902
|
|
okay...
thank you...
|
 |
varun Dosapati
Greenhorn
Joined: Nov 18, 2010
Posts: 22
|
|
@Rob: About the @WebFilter I think we can say the container through pro grammatically. else it is up to container to choose.(Any one Please correct me if I am wrong).
@paul: I started reading the servlet 3 spec. I believe the security concerns like(security roles) can be done through programming which I believe is the feature in servlet 3
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
Bear Bibeault wrote:But, I think I read somewhere that if stuff like order is important, you need to fall back to using the deployment descriptor for those elements.
I guess that makes sense. It's like specifying a global interceptor for EJBs. The only way to do that without adding the @Interceptors annotation to each and every EJB is to put it in the deployment descriptor.
|
 |
 |
|
|
subject: can we use annotations instead of web.xml?
|
|
|