As far as I know fields that don't have values are not sent by the browser.
Try assigning the hidden field a value, and see if it works.

Regards

Tomer Cna'an

----- Original Message -----
From: "Luca Ventura" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 18, 2002 6:18 PM
Subject: R: Input hidden fields without name


> Hello!
>
> I tried to do it but the getParameterNames() method seems not to detect
the
> hidden input field without a name !!! In fact using the
getParameterNames()
> method I obtain all the parameters except those without a name....this is
> the problem! :-(
>
> Let me know if you have a solution.
>
> Thanks,
>
>             Luca
>
> -----Messaggio originale-----
> Da: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]Per conto di
> RBonazzo
> Inviato: gioved� 18 luglio 2002 17.23
> A: [EMAIL PROTECTED]
> Oggetto: R: Input hidden fields without name
> Priorit�: Alta
>
>
> Hi Luca,
> Why don't you try to create a form with this type of input field, send
> it to a servlet and look the contain of the list of parameters you
> receive in this case.
> Use getParameterNames()
>
> Regards
> Rinaldo
>
>
> -----Messaggio originale-----
> Da: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]] Per conto di Luca
> Ventura
> Inviato: gioved� 18 luglio 2002 16.27
> A: [EMAIL PROTECTED]
> Oggetto: Input hidden fields without name
>
>
> Hello everybody!
>
> Surfing in Internet I have seen that some html forms  use input hidden
> fields without name, like this:
>
> <input type=hidden value="">
>
> It is very strange....what are they useful for??? :-(
>
> Anyway I would like to get in my Java servlets such type of parameters
> but I don't know how to do because the getParameterNames() method of
> HttpServletRequest object needs that the input field has a name to get
> its value!
>
> Then I would ike to simulate an html form and I would like to be able to
> send parameter without name (see above) to another servlet (called
> "ServletB"): how can I do?
>
> To encode the parameters to send and their values I use this Java code:
>
> .
>
> String
> ParamHtml=ParamName1+"="+URLEncoder.encode(ValueParam1)+"&"+ParamName2+U
> RLEn
> coder.encode(ValueParam2)+...;
> HttpURLConnection Con = (HttpURLConnection)url.openConnection();
> Con.setRequestMethod("POST");
> Con.setDoOutput(true);
> Con.setUseCaches(false);
> Con.setRequestProperty("Content-Length",""+ParamHtml.length());
> Con.setRequestProperty("Content-Type","application/x-www-form-urlencoded
> ");
> ByteArrayOutputStream byteStream=new ByteArrayOutputStream(512);
> PrintWriter out=new PrintWriter(byteStream,true); out.print(ParamHtml);
> out.flush(); OutputStream Os=Con.getOutputStream();
> byteStream.writeTo(Os);
>
> .
>
> In this case if ParamName1 is a parameter without name and without value
> (<input type=hidden value="">)ParamNameHtml should have the following
> value:
>
> =&ParamName2+URLEncoder.encode(ValueParam2)+...;
>
> Is it so? I tried to codify it in this way but when ServletB receives
> the parameters it isn't able to read them because the syntax seems to be
> wrong....:-(
>
> Can someone help me?
>
> Thanks in advance!
>
>                            Luca
>
> ________________________________________________________________________
> ___
> 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
>
>
___________________________________________________________________________
> 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
>
>
___________________________________________________________________________
> 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
>

___________________________________________________________________________
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

Reply via email to