DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2

Thread: Java Servlets

Hybrid View

  1. #1
    Poonam Guest

    Java Servlets


    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.



  2. #2
    Kent Guest

    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.
    >
    >



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links