Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9170433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:01:07+00:00 2026-06-17T16:01:07+00:00

I would like to know what is the best way to read a text

  • 0

I would like to know what is the best way to read a text input on a jsp page?
Could anyone tell what is the difference between the two java code separated by VS?

  <input type=text id=myInput value="myInput">
  <%
        String data = request.getParameter("myinput");
   //VS
        request.setAttribute("myInput", data);  

  %>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:01:08+00:00Added an answer on June 17, 2026 at 4:01 pm

    I think you want the difference between a request attribute and parameter.

    A request parameter is always a String (i.e. they are always represented by a String even integers, booleans, floats etc like for eg: “1”, “1.1”, “true”) and in a certain URL like: http://google.com/search?q=question&cat=images q and cat are called parameters or query parameters and their value is question and images respectively. This is an example of GET request.
    POST request parameters would be those which are submitted through an html <form>.

    Now request attributes are objects as opposed to parameters. And their value can only be set by using request.setAttribute("myInput", data); here data can be a String, instance or object of a Person class etc, in short data is an object.

    And one more difference is you don’t have a method request.setParameter("myinput", data); there is no such method, so request parameters are only set when a html <form> is submitted or the URL contains parameters as explained above.

    Now with parameters you can get them as:

    String data = request.getParameter("myinput");`
    

    even if value of "myInput" may be an int or boolean.

    For an attribute you can get them as:

    String data = (String) request.getAttribute("myInput");` // if "myInput" is a String
    Person data = (Person) request.getAttribute("myInput");`  // if "myInput" is an instance of Person class
    Long data = (Long) request.getAttribute("myInput");`  // if "myInput" is a Long
    

    So now you know what is the different between the two codes, one reads the value from a request parameter (request.getParameter()) and other from request attribute (request.getAttribute()).

    Let me know if this is not what you wanted.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to know the best way to read data from an uploaded
I would like to know what's the best way to organize my php project
I would like to know What is the best way to include 3rd party
I would like to know how to use Queue in the best functional way.
I would like to know what is the best, fastest and easiest way to
I would like to know what the best in terms of industry practice way
I would like to know how is the best way to implement my own
I would like to know what are the best approaches for protecting apllication and
I would like to know what is the best import strategy within django reusable
I would like to know what is the best solution for storing large amount

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.