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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:13:53+00:00 2026-05-20T11:13:53+00:00

Good day! I tried using JSTL in java but there’s an error: exception javax.servlet.ServletException:

  • 0

Good day!

I tried using JSTL in java but there’s an error:

exception
javax.servlet.ServletException: java.lang.InstantiationException: class session.Item : java.lang.InstantiationException: session.Item

root cause
java.lang.InstantiationException: class session.Item : java.lang.InstantiationException: session.Item

My code is as follows:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <title>DISPLAY ITEM</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>

    <jsp:useBean id="invenItem" class="session.Item" scope="request"/>  
    <c:choose>
        <c:when test="${invenItem != null}">
             <h1>Inventory Item Details: JSP Tester</h1>
             Stock ID  : <jsp:getProperty name="invenItem" property="stockID" /><br/>
             Name      : <jsp:getProperty name="invenItem" property="itemName" /><br/>
             Unit Price: <jsp:getProperty name="invenItem" property="unitPrice" /><br/>
             On Stock  : <jsp:getProperty name="invenItem" property="onStock" />
            <h1> Inventory Item Details Tester: EL Method </h1>
            Stock ID  : ${invenItem.stockID} <br/>
            Name      : ${invenItem.itemName}<br/>
            Unit Price: ${invenItem.unitPrice}<br/>
            On Stock  : ${invenItem.onStock}
        </c:when>
        <c:otherwise>
            <%@ include file ="DataForm.html" %><br>
            Item not existing!<br>
            <%@ include file ="ItemEntry.html" %>
        </c:otherwise>
    </c:choose>

</body>
</html>

I’ve read this JLPT already and followed all the instructions there. Please help. Thank you.

EDIT…

I resolved the error as suggested, but still the JSTL (if else logic) is not working. HELP PLEASE!!!!

  • 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-20T11:13:54+00:00Added an answer on May 20, 2026 at 11:13 am

    If invenItem already exists as a request attribute, then you don’t need to use <jsp:useBean> to retrieve it, you can just use it directly in your JSP, so just remove the <useBean> line completely.

    If invenItem doesn’t already exist as a request attribute, then <jsp:useBean> will create one for you, but whatever you put in the class attribute must be the fully-qualified name of a class with a public, default constructor, else you’ll get the exception you saw.

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

Sidebar

Related Questions

good day stackoverflow! im not sure if any of you has tried this but
Good day, Currently, we are using ByteArrayInputStream for our reset-able InputStream. My problem with
Good day all, It's the first time I am using Qt on Windows CE
Good day all; I am trying to manually (not using sublayers) draw images within
Good day. I'm using the WebClient class in my C# application in order to
I'm in the day 10 of Symfony's Jobeet Tutorial. Everything worked good, but when
Good day! I've the following ViewModel class I use for login form: using System.ComponentModel.DataAnnotations;
Good day. I decided to learn Java. I installed JDK and downloaded eclipse-java-helios-SR1-win32 for
Good day, I have searched far and wide but all I can find is
Good day, We just converted our web application .NET 1.1 to .NET 2.0. We

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.