servlets do support passing extra path information. you can use the
HttpServletRequest.getPathInfo() method to get extra path information.
You may want to check out Jason Hunter's book, Java Servlet Programming
from O'Reilly.
David Crooke wrote:
>
> Jason Goemaat wrote:
> >
> > I've never seen the directory syntax before for passing parameters... How
> > does it work? In your example below, does the parameter I="want",
> > to="get", and off=""?
>
> No, believe it or not, passing a subdirectory path to a CGI (where the
> path extends beyond the CGI name) is some kind of standard, certainly
> supported by Apache and several other servers, though rarely used in
> anger. I am not aware that servlets actively support that kind of
> mechanism, so the getRequestURI you suggest below would probably be the
> only way of doing it (assuming JServ doesn't choke on the URI).
>
> >
> > Is there a spec for this functionality somewhere? I'm thinking it may be
> > for just a certain web server, as I haven't heard of anything in HTML to
> > allow form input to be posted like that. If all your're wanting is to pass
> > different hard-coded parameters to the servlet depending on which page or
> > form it was called from, use hidden form controls:
> > <FORM METHOD=GET ACTION=/servlets/HelloWorld>
> > <INPUT TYPE=HIDDEN NAME="I" VALUE="want">
> > </FORM>
>
> This will generate a "normal" URLencoded querystring, c.f.
>
> <A HREF="/servlets/HelloWorld?I=want">click here</A>
>
> which is different to what the original poster was trying to do, though
> I would argue yours is the *right* way to do it :-)
>
> >
> > To get the path you can use HttpServletRequest.getRequestURI(), then take a
> > look at it yourself, maybe using a StringTokenizer to separate out the
> > elements.
>
> To the original poster - quiz the user carefully to find out why they
> (think that they) need to use the subdirectory-style URI's and you will
> probably find out that they don't. Then tell them to use querystrings
> (i.e. METHOD=GET) or POST-ed data and parse it with the normal servlet
> API's like any other sane person ;-)
>
> Enjoy
> Dave
>
> --
> David Crooke, Austin TX, USA. +1 (512) 656 6102
> "Open source software - with no walls and fences, who needs Windows
> and Gates?"
>
> --
> --------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> READ THE FAQ!!!! <http://java.apache.org/faq/>
> Archives and Other: <http://java.apache.org/main/mail.html/>
> Problems?: [EMAIL PROTECTED]
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
READ THE FAQ!!!! <http://java.apache.org/faq/>
Archives and Other: <http://java.apache.org/main/mail.html/>
Problems?: [EMAIL PROTECTED]