permaculture playing cards
The moose likes Servlets and the fly likes single controller servlet without struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "single controller servlet without struts" Watch "single controller servlet without struts" New topic

single controller servlet without struts

Stephen Huey
Ranch Hand

Joined: Jul 15, 2003
Posts: 618
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

Joined: May 26, 2003
Posts: 33125

You can have the JSPs pass a parameter (like the struts action concept) which tells the servlet where to pass the request to.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: single controller servlet without struts
It's not a secret anymore!