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 6834241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:05:14+00:00 2026-05-26T23:05:14+00:00

I am beginner at using JSP and am following a tutorial. I have a

  • 0

I am beginner at using JSP and am following a tutorial. I have a basic question. There is a simple class named NameHandler that has only one String field called name.

index.jsp looks like this:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>Entry Form</h1>
        <form name="Name Input Form" action="response.jsp">
            Enter name
            <input type="text" name="name"/>        
            <input type="submit" value="OK"  />
        </form>

    </body>
</html>

and response.jsp looks like this:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body><jsp:useBean id="mybean" scope="session" class="org.mypackage.hello.NameHandler" />
        <jsp:setProperty name= "mybean" property= "name"/> 
        <h1>Hello, <jsp:getProperty name="mybean" property="name" />!</h1>
    </body>
</html>

My question is this: I tried to understand how this sets the name member in NameHandler class when the user enters a string. here what does name =”name” mean? I tried to understand how this sets the name member of the class. The code works correctly, so where and how does this set the name member of the class?

I also know that I can use the name of the bean and call a class function like <%=beanname.classfunction %>. So which one is better? First way or second way? What are the differences.

  • 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-05-26T23:05:15+00:00Added an answer on May 26, 2026 at 11:05 pm

    The tag <jsp:setProperty name= "mybean" property= "name"/> works as the following. First it finds bean named mybean. The it takes value of property attribute (name in your case), capitalizes it and prepends set, and constructs method name:

    String methodName = "get" + str.substring(0, 1).toUpperCase() + str.toLowerCase(str).

    Then it calls getMethod(methodName)

    If this call succeeds it calls it using method.invoke()

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

Sidebar

Related Questions

Is there a book out there that teaches jQuery beginner by using a complete
very beginner question. I am using Rails 3's query interface as shown: class User
I have a beginner question using pointers in delphi. I create an object and
Is there an easy beginner way to take the current time using <ctime> to
This is a beginner question with regard to using the SecureSocial(version 0.2.3 module with
I am a beginner in iOS development and have just start using the lasted
I am a beginner of Android apps and am using Eclipse. I have found
I'm a beginner using ANTLR. I'm just doing the following for test purposes and
I am a beginner in using LINQ. I have an xml data with the
iOS beginner here. I'm using the following code to save my facebook accessToken and

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.