Hi,
I want to know the type of input tags in my servlet class, that are defined
in a html page.
Ex. if my html page has 4 input tags:
<input type=text name=first>
<input type=radio>
<input type=hidden>
<input type=checkbox>
Is there a way I can find dynamically the types of this objects in my servlet
code. Any help will be appreciated.
07-28-2002, 11:24 PM
Kent
Re: Java Servlets
Poonam,
There is no built-in way of telling this. It is not normally relevant to
the processing servlet what the input type is for each element. However,
if your input elements are dynamically generated by a servlet then you can
dynamically generate hidden fields describing the input type:
//inside the servlet
if ((boolean.class.equals(field.getClass())) || (Boolean.class.equals(field.getClass())))
{
out.print("<input type=\"checkbox\" name=\"field.getName()\"...");
out.print("<input type=\"hidden\" name=\"field.getName()" + "_type" +
"\" value="checkbox");
} else if ...
Regards,
Kent
"Poonam" <poonam_yadav@adaptec.com> wrote:
>
>Hi,
>I want to know the type of input tags in my servlet class, that are defined
>in a html page.
>Ex. if my html page has 4 input tags:
><input type=text name=first>
><input type=radio>
><input type=hidden>
><input type=checkbox>
>
>Is there a way I can find dynamically the types of this objects in my servlet
>code. Any help will be appreciated.
>
>