Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

single controller servlet without struts

 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not using Struts, but I'm looking at changing some code to have a single Controller servlet that all requests go through before being passed off elsewhere (instead of having each of my JSPs post to different servlets that are relevant to them).

I've discovered request.getHeader("referer") that a class can call to find out which page or servlet or whatever sent the request to it (to find out where the request came from), and I'm wondering if I'm not using Struts if it might be good to use this information in my Controller servlet to partially determine where the request should be sent off to next, or if instead it is best to just determine the direction of the request only based on request parameters.

In a nutshell, if you don't have Struts and you want a single servlet for everything to pass through, what's the best way to direct all the requests?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34371
345
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Karelicek,
You can have the JSPs pass a parameter (like the struts action concept) which tells the servlet where to pass the request to.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic