|
Hi everybody!
I would like to expose my servlets functions in a
single class for the others whom develop JSP pages can easily use
them. I have a class called URLForAction that returns an
url for any particular business function:
URLForAction.confirmOrder(req)
The method returns the url the html
form will post to confirm the order:
return req.getContextPath() + "/servlet/confirm?entry=ok";
The url always is:
/app/servlet/confirm?entry=ok
The problem is that I cannot use that url to
forward the request from another servlet:
RequestDispatcher requestDispatcher =
req.getRequestDispatcher(URLForAction.confirmOrder(req));
requestDispatcher.forward(req, res); It only works with "/servlet/confirm?entry=ok"
without the /app.
What can I do to provide the same URLForAction
method to be called from a jsp or any servlet?
Thanks in advance.
|
