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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:43:52+00:00 2026-05-27T06:43:52+00:00

I’m just playing around with JSP. I just wanted to test some <jsp:useBean> stuff,

  • 0

I’m just playing around with JSP. I just wanted to test some <jsp:useBean> stuff, but I can’t. Every time if I’m using <jsp:useBean>, I get an error. Even if I just have this, I get an error:

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Test</title>
  </head>
  <body>
    <jsp:useBean id="mybean" class="Users" scope="session" >
      <jsp:setProperty name="mybean" property="name" value="Hello world" />
    </jsp:useBean>
  </body>
</html>

Without the <jsp:useBean> it runs fine. With the <jsp:useBean> I get an error like:

Servlet.service() for servlet [jsp] in context with path [/JSPTest] threw exception [Unable to compile class for JSP: 

An error occurred at line: 10 in the jsp file: /index.jsp
Users cannot be resolved to a type
7:     <title>Insert title here</title>
8:   </head>
9:   <body>
10:     <jsp:useBean id="mybean" class="Users" scope="session" >
11:       <jsp:setProperty name="mybean" property="name" value="Hello world" />
12:     </jsp:useBean>
13:   </body>

I am using Eclipse, Tomcat 7.0.23 and Java 1.7.0_01.

Any ideas?

PS: I had to change the port 8xxx to 9xxx because the oracle DB is using the standard 8xxx. But that’s likely not the cause of the problem.

  • 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-27T06:43:52+00:00Added an answer on May 27, 2026 at 6:43 am

    You need to put classes in a package in order to be able to use them in another classes. Classes in the default package are invisible to classes which are by itself in a package (like as the JSP would end up).

    So, give the Users class a package like so:

    package com.example;
    
    public class Users {
        // ...
    }
    

    Recompile and put it in /WEB-INF/classes/com/example/Users.class.

    Then you can reference it as follows:

    <jsp:useBean id="myBean" class="com.example.Users" />
    

    Unrelated to the concrete problem, having a plural as class name of an entity is usually a smell. Does a single instance of that class really represent multiple users? Why would you not have a List<User> for example? Or does it actually represent a single user? It should then be named User instead.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... 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.