Shapira, Yoav wrote:
Hi,Good point -- here's the scenario:
If it were a universal bad idea, it probably wouldn't be available as an
options ;) Although that may just be wishful thinking on my part.
It's not always a bad idea. As usual, if you share your design and give
some more concrete details, we may be able to help more.
My initial design was to have servlets perform all processing of user input, and each servlet redirects to a JSP to display the HTML to the user. Unfortunately, I've found that sendRedirect() is not sufficient, since complex objects cannot easily be sent to the JSP as HTTP parameters. Thus, I've decided to use getRequestDispatcher(some.jsp).forward() instead of sendRedirect(), since I can refer back to a complex object set in the servlet from the "receiving" JSP.
The only problem is that sometimes a servlet needs to forward to another servlet, for instance LoginServlet needs to forward to MainServlet. Most of the time, the user is already logged in and so does not need to use LoginServlet at all, but the first time they enter the application they will need to confront LoginServlet before confronting MainServlet. So LoginServlet will need to forward to MainServlet, yada yada.
I have no experience with struts, but everyone keeps talking about it. It seems worth learning, but I thought I'd try to write one complete basic webapp using only JSP + servlets first before going on to learn any frameworks, just for the sake of learning and so that I'd appreciate a proper framework more when someday I do use one.If you're getting into a lot of request dispatchers, perhaps you should investigate a framework like struts.
Thanks,
Erik
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
