On Mon, 15 Mar 1999, Formanek Gary L wrote:
> Hi,
>
> I was always under the impression you could use something such as
> req.getParameter("name") to get the parameter values off the URL such as
> http://127.0.0.1/servlet/projects?name=joe. What I have found is that it is
> null. Can't you do this with a post from a web page? It works just fine for
> the form values on a web page. I know I can use parseQueryString(), but this
> seems messy and I was hoping I could use the first one.
>
> Thanks,
>
> Gary
Hi Gary,
This behaviour is not common to all servlet-engines (or browsers).
Perhaps you don't get the wanted results because query-string parameters
should be sent via "GET" method, not through "POST" wich is used as default
for ... posting HTML forms.
A form's "ACTION=" string with an "?" in it might be confusing for both
browsers and servlet engines.
You may try (without warranties, results depend on browser or servlet engine
used, worst case when you combine large form data with MSIE)
to send all FORM's parameters using GET:
<FORM ACTION="/servlet/projects?name=joe" METHOD=GET>
.... other fields
</FORM>
The *safest* way is to use hidden fields:
--------------------------------
<FORM ACTION="/servlet/projects">
<INPUT TYPE=HIDDEN NAME=name VALUE=joe>
... other fields
</FORM>
----------------------------------
Bye,
Cezar Totth
[EMAIL PROTECTED]
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html