This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Hi, Is it possible to get the value in the servlet of a text field in HTML which doesn't have a name. <input type="text" size="30" maxchars="30"> If i give the above in html a textfield is appearing. But if i want to retrieve the value entered using servlet how do i do that??
Thanks, Raghu
Tony Alicea
Desperado
Sheriff
Joined: Jan 30, 2000
Posts: 3219
posted
0
You give the <INPUT> a NAME="..." attribute and value. What's preventing you from doing it that way? Then use request.getParameter(...) to retrieve the String value of the INPUT element. You can try the java.util.Enumeration getParameterNames() of the ServletRequest interface and see what is returned from a no-name INPUT... Probably nothing.
Tony Alicea Senior Java Web Application Developer, SCPJ2, SCWCD
Raghu Kumar
Greenhorn
Joined: Jan 08, 2001
Posts: 9
posted
0
Actually the html file is generated by a xml file using some xsl. so the html is produced in such a way that the attribute NAME is not present. I am not aware of xml. o i can't tell any details about xml. so that's my requirement
Originally posted by Tony Alicea: You give the <INPUT> a NAME="..." attribute and value. What's preventing you from doing it that way? Then use request.getParameter(...) to retrieve the String value of the INPUT element. You can try the [b]java.util.Enumeration getParameterNames() of the ServletRequest interface and see what is returned from a no-name INPUT... Probably nothing. [/B]
Frank Carver
Sheriff
Joined: Jan 07, 1999
Posts: 6913
posted
0
You won't be able to get the value directly, as it stands, but have you considered using sneaky JavaScript. Instead of directly linking to your troublesome file, link to a frameset, with one frame very small (or not visible) but contiaining some JavaScript, and the other frame containing your "nameless" document. In the JavaScript, wait until the other frame is loaded, then go through all the elements in each of its forms and assign a name to any that don't have one. With any luck, after this is done, submitting the troublesome form should also submit the newly named fields. Is this any help?