JSP input name

Posted on 2005-05-11
Last Modified: 2008-02-26

I am new to JSP and I am trying to understand this piece of code.

<form name="firstform" action="default"><input name="one"
     type="hidden" value=""> <input name="two" type="hidden"

What are the two input names exactly?

I understand the form name but what do the input names do?
Question by:corduroy9
    LVL 29

    Expert Comment

    they are the names of the parameters that the form submits to the the action "default"

    if the form were a "GET" you would see this in the url: <blah>/default?one=&two=

    as they have no values
    LVL 29

    Accepted Solution

    Here's a slightly better example:

    <form name="firstform" action="default.jsp" method="GET">
    <input name="one"   type="hidden" value="valueOne">
    <input name="two" type="hidden"   value="valueTwo">

    you would see this in the url: <blah>/default.jsp?one=valueOne&two=valueTwo

    In default.jsp, you could then recover these values with this code
    String paramOne = request.getParameter("one") ; //now equals "valueOne"
    String paramTwo = request.getParameter("two") ; //now equals "valueTwo"
    LVL 2

    Expert Comment

    <input name="one" > means name of hidden type u are using
    it can be useful when u are recovering this value
    String One = request.getParameter("one") ;
    it will give u the value of type hidden in above case it is null value
    if it is something like this
    <input name="one"   type="hidden" value="cord">
    String One = request.getParameter("one") ;

    then One  would be "cord"
    LVL 29

    Expert Comment

    cheers :-)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Suggested Solutions

    Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
    In the modern office, employees tend to move around the workplace a lot more freely. Conferences, collaborative groups, flexible seating and working from home require a new level of mobility. Technology has not only changed the behavior and the expe…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now