Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Request-dispatching in a POJO

 
Oliver Rensen
Ranch Hand
Posts: 109
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ranchers,

I have a question about request-dispatching.

Within a servlet we can forward to a JSP-page:
RequestDispatcher disp =
request.getRequestDispatcher("result.jsp");
disp.forward(request, response);

Is it possible to do the same dispatching in a POJO? The servlet calls a POJO and the POJO dispatches to another JSP.

In real-world-projects, what is usually the approach to dispatch to JSPs? Within servlets or within POJOs?

Regards
Oliver
 
Pravin Jain
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you could pass the ServletRequest and ServletResponse objects to the
POJO, then it is alwyas possible for the POJO to forward to the JSP.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In real-world-projects, what is usually the approach to dispatch to JSPs? Within servlets or within POJOs?

Within servlets. With a Front Controller and Commands (also named Action in the Struts world)
There's an article about this in the Journal : http://www.javaranch.com/journal/200603/Journal200603.jsp#a5
[ May 27, 2007: Message edited by: Satou kurinosuke ]
 
Oliver Rensen
Ranch Hand
Posts: 109
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Satou and Pravin, thanks a lot for clarifying my doubts.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!