开发者

Mapping a servlet in my JSP

I have Java EE application which has a WAR file and an EJB file. The WAR file contains my jsps/html and my EJB contains my servlets/beans and EJB. I try to call my servlet in one of my jsp pages, but it cant find it. The file im looking for is Authenticate.开发者_如何学运维 Its located in my EJB file so i figure the path for it would be

action="../../EJBShoppingCart-ejb/build/classes/Servlet/Authenticate

I played around with URL, modifying it by taking taking away build or classes and a bunch of other ways.... my servlet has the @WebServlet(name = "Authenticate", urlPatterns = {"/Authenticate"}) annotation.

I know I can transfer all of my files from my EJB file to my WAR file and I think that would solve the problem. But is there a way to map it correctly?


urlPatterns = {"/Authenticate"}

So, it's mapped on an URL pattern of /Authenticate. Assuming that your server runs on localhost:8080 and the webapp context name is myapp and the /WEB-INF/web.xml is conform Servlet 3.0 spec, then you can access it by http://localhost:8080/myapp/Authenticate


I'm only not entirely sure whether an @WebServlet class inside an EJB would ever be located and loaded by the servletcontainer. Servlets usually go in WAR and end up in /WEB-INF/classes. Inside a JAR in /WEB-INF/lib is definitely possible, it has only to contain a Servlet 3.0 compatible /META-INF/web.xml

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜