Hi there.. I have a problem with getting parameters in a servlet -
specifically the order in which my parameters are submitted. My html code is
as follows (abbreviated):
<FORM NAME="user_profile" ACTION="../servlet/MyServlet3" METHOD=GET
TARGET="_self">
<INPUT TYPE="hidden" NAME="fact_name" VALUE="user_profile">
<SELECT NAME="country"><OPTION VALUE="uk"> UK etc.,</SELECT>
<INPUT TYPE="radio" NAME="hiv_status" VALUE="HIV positive"> HIV positive<BR>
etc.,
<SELECT NAME="age"><OPTION VALUE="under 18"> under 18 etc.,</SELECT>
<INPUT TYPE="radio" NAME="sex" VALUE="female"> female<BR>
<INPUT TYPE="submit" VALUE="submit"></FORM>
and my servlet code needs the HIDDEN field (fact_name) to be retrieved
first:
Enumeration enum = req.getParameterNames();
String name = null;
String value = null;
while (enum.hasMoreElements())
{
//gets each parameter one at a time
name = (String) enum.nextElement();
value = req.getParameter(name);
out.println(name + value + "\n");
<snip>
try{
//use first parameter to name the fact
if("fact_name".equals(name)){//i.e. the parameter is the name of the fact
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
<snip>
this code above relies on the hidden field in my html code being the 1st
parameter retrieved...
but I'm actually getting the parameters in this order (when I print them out
after the value = req.getParameter(name); (see above):
1.hiv_status
2.country
3.age
4.sex
5.fact_name
Does anyone know how to control the order in which parameters are submitted,
or any other help as to what I'm not doing?? Many thanks! D Lampon
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
___________________________________________________________________________
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