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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:31:04+00:00 2026-05-15T14:31:04+00:00

i create a class called Data and call it in JSP.. when i comple

  • 0

i create a class called “Data” and call it in JSP.. when i comple it, the error says,

Data cannot be resolved to a type
2: pageEncoding="ISO-8859-1"%>
3: <%@ page import= " Data" %>
4: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
5: <jsp:useBean id="user" class="Data" scope="session"/> 
6: <jsp:setProperty name="user" property="*"/>
7: <html>
8: <head>

public class Data
{

 String Classname ;
        String Individualname;
        String Link;
        public  void Setclassname(String value)
 {
  Classname = value;

 }
        public String GetClassname()
 { 

  return Classname;

 }
}

jsp file

<jsp:useBean id="user" class="Data" scope="session"/> 
<jsp:setProperty name="user" property="*"/>

<body>

You entered<BR>
Class Name: <%= user.GetClassname() %><BR>


</body>

i didn’t deploy the project….

  • 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-15T14:31:04+00:00Added an answer on May 15, 2026 at 2:31 pm

    You don’t need @page import. This is only linked into the scriptlet scope, not into taglibs. You don’t want to use scriptlets here. The following should work:

    <jsp:useBean id="user" class="com.example.Data" scope="session"/> 
    

    Further, you should always put classes in a package whenever you’d like to import/reuse it in other classes. Packageless classes are not importable in other classes. Add a package declaration and put the class in the right location in the folder structure.

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

    When building manually, it should end up in /WEB-INF/classes/com/example/Data.class. When building using an IDE, like Eclipse, put it in src/com/example/Data.java and the IDE will worry about compiling and putting it in the right location.

    You should also really fix the naming conventions of the variables and getters/setters. Follow the Java Naming Conventions.


    Update as per the comments:

    thanks… i did it what you said here.. still with the same issue.. now error says Cannot find any information on property ‘Data’ in a bean of type ‘Ont.Data’

    First: please, follow the Java Naming Conventions. Package names should not start with uppercase. Further, this error message means that there’s no getter for the named property. You should also really follow the Javabean specifications. Property names should start with lowercase, e.g. propertyname and getter methods should be public and be named like so getPropertyname(), a get, then first letter of propertyname uppercased and the remnant exactly the same as original propertyname. The same applies for setters like so setPropertyname().

    Here’s a rewrite of your Data class:

    package com.example;
    
    public class Data {
        private String classname;
        private String individualname;
        private String link;
    
        public String getClassname() {
            return classname;
        }
    
        public String getIndividualname() {
            return individualname;
        }
    
        public String getLink() {
            return link;
        }
    
        public void setClassname(String classname) {
            this.classname = classname;
        }
    
        public void setIndividualname(String individualname) {
            this.individualname = individualname;
        }
    
        public void setLink(String link) {
            this.link = link;
        }
    }
    

    Most IDE’s, for example Eclipse, can autogenerate Javabeans in this flavor. Take benefit of it.

    See also:

    • Beginning and intermediate JSP/Servlet tutorials.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a class called Musician which inherits from my class Person
I would like to create a thread pool. I have a class called ServerThread.cpp,
I would like to create a class whose methods can be called from multiple
I'm trying to create a point class which defines a property called coordinate. However,
I create a new Django app (not project) called Bussinesses, then add following class
I am trying to call a method on a class to sort data of
I'm trying to write a singleton class for maintain game data, It's called GameManager,
Lets say in main() I create an object pointer called BOB from a class
I've created a class called SpecialArray and I'd like to customize what sort of
I have created a class called Class1, and in another module, I want to

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.