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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:33:30+00:00 2026-05-24T03:33:30+00:00

I have a simple html page where I pass two values, a name (

  • 0

I have a simple html page where I pass two values, a name (String) & the number of nights (int) to a jsp page. There I use a jsp:useBean tag & a jsp:setProperty tag. When I replaced <%= myRes.getName() %> with <jsp:getProperty name="myRes" property="name"> it gives a long exception report. But when I reload the page twice it gives the correct output. The exception report is given below.

org.apache.jasper.JasperException: /hotel_jsp_bean_one.jsp(13,30) According to TLD, tag jsp:getProperty must be empty, but is not
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:41)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:132)
    org.apache.jasper.compiler.Parser.parseBody(Parser.java:1631)
    org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:1002)
    org.apache.jasper.compiler.Parser.parseGetProperty(Parser.java:905)
    org.apache.jasper.compiler.Parser.parseStandardAction(Parser.java:1132)
    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1449)
    org.apache.jasper.compiler.Parser.parse(Parser.java:138)
    org.apache.jasper.compiler.ParserController.doParse(ParserController.java:239)
    org.apache.jasper.compiler.ParserController.parse(ParserController.java:102)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:197)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:372)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:352)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:339)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:594)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:344)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

My bean class is :

package hotel;

public class Hotel
{
    private String name;
    private int nights;

    public Hotel()
    {
        this.name = "<NOT SPECIFIED>";
        this.nights = -1;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public String getName()
    {
        return this.name;
    }

    public void setNights(int nights)
    {
        this.nights = nights;
    }

    public int getNights()
    {
        return this.nights;
    }

Then my first html page is :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Hotel Califona Reservation</title>
</head>

<body>
    <h2 align="center">Welcom To The Hotel Califonia</h2>
    <br/>
    <br/>
    <form method="post" action="hotel_jsp_bean_one.jsp">
        <label>Enter your name : <input type="text" name="name"/>
        <br/>
        <label>How many nights : </label><select name="nights">
                                            <option value="1">1</option>
                                            <option value="2">2</option>
                                            <option value="3">3</option>
                                            <option value="4">4</option>
                                          </select>
        <br/>
        <input type="submit" name="submit" value="Reserve"/>
    </form> 
</body>
</html>

Then my final jsp page is :

<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Hotel Califonia Reservation</title>
</head>

<jsp:useBean id="myRes" class="hotel.Hotel" scope="page"/>
<body>
    <jsp:setProperty name="myRes" property="*"/>

    <h3 style="color:#0000FF"><jsp:getProperty name="myRes" property="name"> is staying for <jsp:getProperty name="myRes" property="nights"> nights</h3>
</body>
</html>

Please forgive me for any inconvenient mistakes I’ve overlooked. Any help would be greatly appreciated. Thanks in advance.

  • 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-24T03:33:31+00:00Added an answer on May 24, 2026 at 3:33 am

    This is not valid:

    <jsp:getProperty name="myRes" property="name"> is staying for <jsp:getProperty name="myRes" property="nights">
    

    It should be:

    <jsp:getProperty name="myRes" property="name"/> is staying for <jsp:getProperty name="myRes" property="nights"/>
    

    Note the closing / at the end of each getProperty.

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

Sidebar

Related Questions

I have a simple html page which renders with a number of nearly identical
I have a simple jQueryMobile index.html page. Within that I have two pages using
I have a simple HTML page that contains two tabs that show/hide content in
I have a simple html page with a div. I am using jQuery to
There are some HTML based games (ie bootleggers.us) that have a simple login form
iam using a simple insert script function to pass the values from registration html
I have a simple script where I am fetching an HTML page, passing it
Say I have a very simple html page, containing a single line of text.
I have a simple HTML page with a large textarea form field and button.
I have a simple html page and when I load it in Google chrome

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.