-
1. Re: How to manage all the requests?
peterj Apr 2, 2012 9:42 AM (in response to fpalma)One thing you could do is have your servlet package all of the data into one or more javabeans which you then pass to a JSP, which uses the Expression Language and JSTL to access the data in the javabean(s) and builds the page to display. Search the web for "mvc jstl tutorial", you should get a few hits. Here are some (they are fairly basic, but they should give you an idea):
http://www.jansipke.nl/model-view-controller-mvc-with-jsp-and-jstl/
http://www.raistudies.com/c-jstl/cout-example-to-print-value-of-attribute-any-scope/
If you need more examples, let me know.
-
2. Re: How to manage all the requests?
fpalma Apr 3, 2012 12:37 PM (in response to peterj)Thanks for the answer!! Now I know how to manage the requests.
But I have a little detail. When I make a reference to one jsp file inside a servlet, I have to write the full path, by example: getRequestDispatcher("/WEB-INF/views/result.jsp"). Is there any way of make a "logical reference" to the jsp file? Or the best is to add the path manually? for example:
static String prefix = "/WEB-INF/views/";
static String sufix = ".jsp";
getRequestDispatcher( prefix + "result" + sufix)
The goal is to write only: getRequestDispatcher("result")
Thanks a lot,
Fran