Use classes in JSP without jsp:useBean

hi
i want to instantiate my own classes within a jsp.
the classes are in web-inf/classes/chat/
there is one main class which is used all over the app, so i use it with the jsp:useBean and scope on application.
The messages are saved in objects of the class Message. now i want to use this class in my JSP without useBean.
Is this possible without extra setting the classpath?!
I get the error because the interpreter searchs in a package from tomcat itself..
Thanks a lot and rgds
Ruven

I think you can use any class in your jsp file without the <jsp:useBean>, this implies that you have to declare your class in the ordinary way i.e
<% MyClass c = new MyClass() ;
//other code
%>
the important thing is to use the page directive's import attribute i.e include this line in your jsp page
<%@ page import="mypackage.inner.MyClass" %> the web containers when sees this line will assume that you have the following directory structure in your web application ( /mywebapps/web-inf/classes/mypackage.inner/* )
I hope this helps
Regards

Similar Messages

  • How to use class in JSP page ? In java works in JSP not...

    Hello developers,
    I need check if URL exists.. i use this code in java.. it works fine..
    import java.net.*;
    import java.io.*;
    public class Check {
    public static void main(String s[]) {
        System.out.println(exists("http://www.google.com"));
        System.out.println(exists("http://www.thisURLdoesntexis.com"));
    static boolean exists(String URLName){
      try {
        HttpURLConnection.setFollowRedirects(false);
        // note : you may also need
        //        HttpURLConnection.setInstanceFollowRedirects(false)
        HttpURLConnection con =
           (HttpURLConnection) new URL(URLName).openConnection();
        con.setRequestMethod("HEAD");
        return (con.getResponseCode() == HttpURLConnection.HTTP_OK);
      catch (Exception e) {
           e.printStackTrace();
           return false;
    }in java all works fine.. it shows
    TRUE
    FALSE
    but i have no idea how can i implement this java code to my check.jsp page..
    i tried something like this..
    <%@ page import="java.io.*" %>
    <%@ page import ="java.net.*" %>
    <BODY>
    <%
    static boolean exists(String URLName){
      try {
        HttpURLConnection.setFollowRedirects(false);
        // note : you may also need
        //        HttpURLConnection.setInstanceFollowRedirects(false)
        HttpURLConnection con =
           (HttpURLConnection) new URL(URLName).openConnection();
        con.setRequestMethod("HEAD");
        return (con.getResponseCode() == HttpURLConnection.HTTP_OK);
      catch (Exception e) {
           e.printStackTrace();
           return false;
    String a="http://www.google.com";
    %>
    <%= exists(a)%>and i want to see in my jsp page the result.. it means that JSP page shows
    TRUE
    Thanks in advance,

    Hi there,
    One solution is to use JavaBeans and call the methods for the JavaBean from the JSP page.
    Suppose you have a JavaBean called TestConnectionBean as follows:
    package test22;
    import java.net.HttpURLConnection;
    import java.net.URL;
    import java.net.MalformedURLException;
    import java.io.IOException;
      Set the testUrl before checking if connection exists.
    public class TestConnectionBean {
        String testUrl;
        boolean connectionExists;
        public TestConnectionBean() {
        public String getTestUrl() {
            return testUrl;
        public void setTestUrl(String testUrl) {
            this.testUrl = testUrl;
        public boolean getConnectionExists() throws IOException, MalformedURLException {
            HttpURLConnection.setFollowRedirects(false);
            // note : you may also need
            //        HttpURLConnection.setInstanceFollowRedirects(false)
            HttpURLConnection con = null;
            con = (HttpURLConnection) new URL(this.testUrl).openConnection();
            con.setRequestMethod("HEAD");
            return (con.getResponseCode() == HttpURLConnection.HTTP_OK);
        public void setConnectionExists(boolean connectionExists) {
            this.connectionExists = connectionExists;
    }Then you can create a JSP page like this:
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>
      <head><title></title></head>
      <body>
      <jsp:useBean id="testConnectionBean" class="test22.TestConnectionBean"/>
      <jsp:setProperty name="testConnectionBean" property="testUrl" value="http://www.google.com" />
      <br/><br/>
      Does the connection exist for http://www.google.com : <jsp:getProperty name="testConnectionBean" property="connectionExists"/>
      <br/><br/>
      <jsp:setProperty name="testConnectionBean" property="testUrl" value="http://www.thisURLdoesntexis.com" />
      <br/><br/>
      <%-- The following will give an exception : java.net.UnknownHostException: www.thisURLdoesntexis.com since the URL doesn't exist. 
      --%>
      <%--
      Does the connection exist for http://www.thisURLdoesntexis.com : <jsp:getProperty name="testConnectionBean" property="connectionExists"/>
      --%>
      </body>
    </html>The output you see looks like:
    Does the connection exist for http://www.google.com : true
    I think it is better to handle the exceptions in the JavaBean itself, so now yyou can change the method signature of getConnectionExists , remove all exceptions from method signature but handle them with a try/catch inside the method itself.

  • How to use class in JSP file?

    Hello All,
    I am new to Jsp.
    In Jsp file,I used class of myself.
    Why,the Constractor seems not working?
    Thanks in advance.

    Hi,
    You can import the class in a jsp file.
    Use <% page import = "">
    and call that class.
    If u want to import a funtion in your class, then u can insert that into scriplets like <%! ..%>
    Hope u got that!
    Artz

  • Importing class or jsp:useBean option

    Hi,
    I am bit confused as when to use between "beanClasses" or "tag librery" or "simple java classes useing import". as far as i feel all are capable of doing almost each others task (i.e excuting a method to process something). can anyone help me in understanding this

    Well, first, if I understand correctly,
    "simple java classes useing import"Would be using scriptlets to do the job. It is always best to avoid scriptlets, and the best way to do that is to
    use javabeans. So I would say use "beanClasses" over "simple java classes useing import" whenever humanly possible.
    On the other hand, I use tags and beans for different reasons. I use beans to transport data from one spot to another, such as through pages and requests, or to access non-display logic, like getting data from a database. I use tags mainly for complex display operations.
    For instance, lets use the oft-asked Paging question. I have a database with 500 records. I want to display 20 at a time in a JSP. I would use a Bean to get the information (and store it in a List of another Bean type). Then I would use a tag to do the [prev] 1 2 3 4 5 6 7 8 9 10 ... [next] display and links.
    Hi,
    I am bit confused as when to use between
    "beanClasses" or "tag librery" or . as far as i feel all are
    capable of doing almost each others task (i.e
    excuting a method to process something). can anyone
    help me in understanding this

  • How use bean of array with tag "jsp:useBean"??

    hi,all
    a bean of array put request with a servlet and forward a jsp page,this jsp use "jsp:useBean" of tag get the bean of array.
    how do for jsp:useBean of tag??
    thx.....

    You can't use an array directly in a jsppage. first u have to write the line <useBean /> through which you can access youtr class
    <jsp:useBean id="email" class="Pack.Email" scope="session" />
    after writing this line you have your class in your hand, you can think of "email" as it is a class object of Email class which is a Bean...
    declare a private array in the Bean and then made method getArray() which will return an array ... then you can use your array in jsp....
    an example of using a class variable in JSp is given below
    public String[] getArray() // note method must be public
    return array;
    now in your jsp page you have to use that class with
    <jsp:useBean id="email" class="Pack.Email" scope="session" />
    and cnow you can use array like this....
    <%
    String[] array=email.getArray();
    for (int i=0; i< array.length;i++ )
    out.println(array]);
    %>
    Does it solve your problem now ?

  • JSP:useBean in Tomcat with external libraries

    Hi!
    I would like to use netbeans 4.1 for developing jsp-pages, but are facing a problem when trying to use the built-in jsp compiler.
    in my code I use something like:
    <jsp:useBean id="id" class="package.Classname" scope="application" />while package is an external package initially created from JAXB. To include it into netbeans, I have put the directory containing all the classes into the build libraries and also into the test libraries. In the 'Projects'-Explorer it shows all the classes contained.
    When I try to run the jsp-File, I get an error like this:
    Compiling 1 source file to C:\Develop\ApplicationDescriptionGenerator\build\generated\classes
    C:\Develop\ApplicationDescriptionGenerator\build\generated\src\org\apache\jsp\general_jsp.java:48: cannot find symbol
    symbol: class Classname
    location packageI do not understand this behaviour, especially, as the 'web' folder created by netbeans includes all necessary classes, and when I copy it to my tomcat installation, it works fine.
    Does anybody know, what I have to change, so that I can test it from inside netbeans?
    Thanks a lot!

    Here is the java program or bean class that I'm using, UserData.java compiled into UserData.class:
    public class UserData {
    String username;
    String email;
    int age;
    public void setUsername( String value )
    username = value;
    public void setEmail( String value )
    email = value;
    public void setAge( int value )
    age = value;
    public String getUsername() { return username; }
    public String getEmail() { return email; }
    public int getAge() { return age; }
    To put the data into the session, I used the following form:
    <HTML>
    <BODY>
    <FORM METHOD=POST ACTION="SaveName.jsp">
    What's your name? <INPUT TYPE=TEXT NAME=username SIZE=20><BR>
    What's your e-mail address? <INPUT TYPE=TEXT NAME=email SIZE=20><BR>
    What's your age? <INPUT TYPE=TEXT NAME=age SIZE=4>
    <P><INPUT TYPE=SUBMIT>
    </FORM>
    </BODY>
    </HTML>
    and SaveName.jsp is this:
    <jsp:useBean id="user" class="UserData" scope="session"/>
    <jsp:setProperty name="user" property="*"/>
    <HTML>
    <BODY>
    Continue
    </BODY>
    </HTML>

  • How to Implement jsp:useBean tags

    Hi,
    I hav a trouble with using the Tag jsp:useBean
    Actually im using Tomcat4.1 webserver'
    I created a java file and compiled that
    When i included that class file,The Jsp Compiler seeming me a error that the Required class in not found
    Actually wht my problem is that i cannot find out the storage locations for the corresponding files
    I know where to save the jsp
    but i need to know where to put the class file and its source.Bcz that one which i want to use in that tag{<jsp:useBean>}
    I want to know what should i do
    With Regards
    Ganesh B

    Beans are regular Java classes that follow particular conventions defined by the JavaBean's specification. The don't extend from a particular class, they aren't packaged in a particular package, and - germane to the question - they aren't located in a special place on the server. The classes which are loaded into the JSP by the <jsp:useBean> construct are located in the same location as other classes in a web application. They are located in the classes directory of the WEB-INF directory of the web application directory itself. Or, if you bundle your classes into a jar file, then the jar file will be located in the lib directory of the WEB-INF directory. In either case, remember to use packages for your classes including your beans.

  • Javabean-Installation for jsp:usebean

              Hi!
              I have made a simple JavaBean. I wont use it with
              <jsp:usebean> but i get:
              /index.jsp(6): class 'myBean' could not be loaded
              probably occurred due to an error in /index.jsp line 6:
              <jsp:useBean id="my" class="klaus"/>
              how must i install me Bean (not an EJB)
              thanks Klaus
              

    1. Did you weid your weblogic.properties file as:
              weblogic.httpd.webApp.<AppNameHere>=<AbsolutePath>
              2. Do you have the proper directory structure?
              If you set the <AbsolutePath> above to C:\Temp, you'll need the following:
              C:\Temp\WEB-INF\classes
              You'll also need to import the bean in the code, in addition to the
              jsp:usebean tag.
              If the bean uses a package, (eg com.company), you'll also need
              C:\Temp\WEB-INF\classes\com\company
              Your .jar/.class files go in the one of the directories above, depending how
              the bean was written. The <Whatever.jsp> file would go in C:\Temp in the
              above example.
              3. Make sure the <AbsolutePath> is in your weblogic class path.
              4. Access the bean http://<server>/<AppNameHere>/<Whatever.jsp>
              Chad
              "klaus werner" <[email protected]> wrote in message
              news:3b990f4b$[email protected]..
              >
              > Hi!
              > I have made a simple JavaBean. I wont use it with
              > <jsp:usebean> but i get:
              >
              > /index.jsp(6): class 'myBean' could not be loaded
              > probably occurred due to an error in /index.jsp line 6:
              > <jsp:useBean id="my" class="klaus"/>
              >
              > how must i install me Bean (not an EJB)
              >
              > thanks Klaus
              

  • Calling an inner class in a jsp:usebean tag

    Hi everybody !
    Here's my problem : working in my project on multiple pages, I'm using inner classes/beans to limitate my '.java' files but I'm stuck when calling that 'inner-bean' in my jsp:usebean tag.
    First, I tried to declare in the class parameter : 'class="MyPrincipalBean.theInnerBean" but jsp returns me a 'not found' message.
    I tried an other issue with this :
    'class="MyPrincipalBean$theInnerBean" but I encountered a 'Attempt to use a bean type without a void constructor in jsp:useBean tag (JSP 1.1 specification, 2.13.1)'. Since I can't find that specification, I'm sending an SOS.
    Am I on the good way ? If somebody as encoutered that sort of problem, it would be very kind of you to help me.
    Thanks for your help !
    [email protected]

    Thanks for your help!
    I must recognize that my explainations weren't really precise.
    My principal bean owns a table of my inner-class type :
    public class FirstBean extends EntityBean {
    private SecondBean[] tabSB;
    public SecondBean[] getTabSB() {...}
    public void setTabSB(SecondBean[] p_tabSB) {...}
    public class SecondBean {...}
    So I can call a specific bean from the tab in my Servlet for another page.
    But I think I have the solution and I need your advise :
    I tried this :
    <jsp:useBean id="FirstBean" class="<...>.FirstBean" scope="session" />
    <jsp:useBean id="SecBean" beanName="<...>.FirstBean$SecondBean" type="<...>.FirstBean$SecondBean" scope="request" />
    And would you believe it ? It seems to work ! But I have to test this farther to be sure. What do you think of it ?

  • How to assign the class value dynamically  in jsp:useBean ?its urgent

    Hi
    I want to set the class value of <jsp:useBean> dynamically
    when i am trying to this way
    <jsp:useBean id="<%=id %>" class="<%=beanclass %>" scope="request">
    <jsp:setProperty name="<%=id %>" property="*"/>
    </jsp:useBean>
    where beanclass is .class file that is to be used by the usebean tag
    i am getting following error
    The value for the useBean class attribute <%=beanclass %> is invalid.
    please help as soon as possible
    regards,
    Rameshwari

    You can not do that.The jsp:useBean and jsp:setProperty are action tags and not custom tags. Action tags get translated into Java code in the translation unit and are then compiled. Custom tag are backed by classes and the tag get translated into a method call of the class.

  • Which one better to use - jsp:useBean or import statement

    Hi,
    I just want to know that which one is better to use jsp:useBean or import statement .
    I can instantiate and call method of myclass -
    1) by importing the class through import tag in jsp as <%@page import="myclass"%. or
    2). by using <jsp:useBean tag....
    i have these two option to do the same thing. i know that basically useBean is used to call setter and getter method of bean class and but it can be used to call a normal java file that have some logic .
    so what should i used , which one is better and why?
    useBean provides scope and object instance so no need to create object by new operator. and with import you have to create an instance .
    but which tag should i use in my jsp?
    i am confused???

    ok, means i can use jsp:useBean tag for all my
    classes that are not actually bean. so it will be
    instantiated at run time and provide efficiency .No. Jsp:useBean is used for java bean components.
    >
    but when should i use import statement in my jsp and
    it happen at translation time so will it create any
    type of burden for my code if i import multiple
    classes.For non-java beans, you need to import the classes, period.
    It's not a burden, it's a necessity.

  • How to use Classes stored in "Classes" folder in JSP with tomcat ?

    Hello friends
    im using tomcat as server and MySQL as a Backend. now i am using the date calculation in Diff.class files which i have stored in catalina_home/webapps/prj_dev/Prj_files/classes/diff/DIff.class.
    now i am getting error that :
    Generated servlet error:
    Only a type can be imported. diff.Diff resolves to a package
    wht i have to do ?

    I don't include the "classes" word in my import anymore.. Waa.. I'm going nuts.. T.T
    Now, I'm trying to use the class through useBean..
    this is how my application looks like:
    /webapps
    -----/hangman-jsp
    ------------index.jsp
    ------------/WEB-INF
    -------------------web.xml
    -------------------MysteryPhrase.java
    -------------------/classes
    ---------------------------/beans
    ----------------------------------MysteryPhrase.class
    -----------/images
    -------------------hangman.gif
    This is what is in my MysteryPhrase:
    package beans;
    import java.lang.String;
    import java.lang.StringBuffer;
    public class MysteryPhrase {
         private String answer;
         private StringBuffer mysteryPhrase;
         private int guesses;
         private char[] alphabet;
         public MysteryPhrase () {
         this.alphabet = new char[26];
    public void setMysteryPhrase (String mysteryPhrase) {
         this.answer = mysteryPhrase;
         this.mysteryPhrase = new StringBuffer(mysteryPhrase.length());
         for (int i = 0; i < mysteryPhrase.length(); i++) {
              this.mysteryPhrase.setCharAt(i, '_');
    public void setGuess (char guess) {
         for (int i = 0; i < answer.length(); i++) {
              if (answer.charAt(i) == guess) {
                   mysteryPhrase.setCharAt(i, guess);
         guesses++;
    public String getMysteryPhrase () {
         return mysteryPhrase.toString();
    public String getAnswer () {
         return answer;
    public int getGuesses () {
         return guesses;
    This is what is in my index.jsp (It is not yet finished..I just started..)
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <jsp:useBean id="phrase" class="beans.MysteryPhrase"/>
    <jsp:setProperty name="phrase" property="MysteryPhrase" value="Hello!"/>
    <html>
         <head>
              <title>JSP/JSTL Implementation of Hangman</title>
              <style type="text/css">
                   div {
                        color: white;
                        background-color: gray;
                        position: absolute;
                        border-style: solid;
                        border-width: thin;
                        width: 20%;
                        height: 30%;
                        text-align: center;
                   #guessBoard {
                        top: 28%;
                        left: 42%
                   #mysteryPhraseBoard {
                        top: 50%;
                        left: 25%;
                        z-index: 2;
                   #statisticsBoard {
                        top: 57%;
                        left: 58%;
                        z-index: 2;
                   #categoryBoard {
                        top: 23%;
                        left: 10%
                   #hangman {
                        top: 7%;
                        left: 70%;
                   #char {
                        width: 20px;
                   body {
                        background-color: black;
              </style>
         </head>
         <body>
              <div id="categoryBoard">
                   <form method="post">
                        Please choose a category:
                        <select name="category">
                             <option>Category 1</option>
                             <option>Category 2</option>
                             <option>Category 3</option>
                             <option>Category 4</option>
                             <option>Category 5</option>
                             <option>Category 6</option>
                             <option>Category 7</option>
                             <option>Category 8</option>
                        </select>
                        <input type="submit" value="Change"/>
                   </form>
              </div>
              <div id="mysteryPhraseBoard">
                   The mystery phrase is
              </div>
              <div id="guessBoard">
                   <form method="post">
                        Enter a letter: <input id="char" type="text" name="letter"/>
                        or
                        Enter a word: <input type="text" name="word"/>
                        <input type="submit" value="Guess"/>
                   </form>
              </div>
              <div id="statisticsBoard">
                   Guesses: 0
                   Remaining Letters: 8
              </div>
              <div id="hangman">
                   <img src="images/hangman.gif"/>
              </div>
         </body>
    </html>

  • Converting a class for use in a jsp page.

    I was just wondering if it is possible/normal to convert complex(ish) classes to change the output from the system.out, to a return value from a method that is displayed via a jsp page. (I am just beginning, and trying to make the coversion from asp with COM to jsp with beans/servlets and I am not yet fully understanding the technologies, and how you import classes etc - please bear with me!)
    first, I made a class that has a method that just returns a string. like:
         public String GetAValue()
              return "Hello there.";
         }and then I made a jsp page that imported the class (test) like:
    <%@ page import="Test" %>
    <jsp:useBean id="tst" scope="page" class="Test" />
    st = tst.GetAValue();
    out.println(st);
    Which to my delight, worked fine! Then I made another class that retrieved a value from a web service. kind of like...
         public String GetAValueFromAWebService(){
              return theWebService.GetValueFromWebServiceMethod();
         }This class also works good when I just run via "java testit". But when I went to do the same as above ,ie, import the class, do a usebean then do st=tst2.GetValueFromWebServiceMethod(), I could not get it to work at all. This class does lots more tricky stuff then the first one though - it loads its properties from a .properties file via an instance of another class, and imports funky stuff like - import org.uddi4j.* and import java.util.Vector; and more.
    Ok, now the question! Is what I am trying to do stupid? If so, how should I do it? If its not stupid, how do I include all the extra import statements on the jsp page (there are about 10)
    Wow, sorry about the length of this post. I hope someone can understand my ramblings!
    Thanks,
    nmoog.

    Sorry, yeah...
    I am actually using the UDDI4J package, and it loads various settings with the
    config = Configurator.load(); (a seperate class to load stuff in with)
    The Configurator.Load method basically just does:
    config.load(new java.io.FileInputStream("samples.prop"));
    and then does System.setProperty() with the config.getProperty()
    values.
    I have a test class when I do "java Test" it runs and in the Main method just instantiates the MyWebService class and does the MyWebService.GetAWebServiceValue() which returns a string.
    As I said, this runs fine. But from the JSP code if I do the same thing it gets a NullPointerException.
    "java.lang.NullPointerException
    at java.util.Hashtable.put(Hashtable.java:389)
    at java.util.Properties.setProperty(Properties.java:102)
    at java.lang.System.setProperty(System.java:654)
    at Configurator.load(Configurator.java:43)"
    Why can it load okie-dokey from the test class, but not the jsp page? Any ideas?

  • Using variables in a jsp:useBean tag

    I was wondeing if it is possible in any way to use variables in a jsp:useBean tag. Here is an example of what I am trying to do.
    <%
    String beanType = request.getParameter( "bean" );
    if( beanType.equals( "Bean1" ) ) {
    beanClass = "com.myCompany.Bean1";
    } else {
    beanClass = "com.myCompany.Bean2";
    %>
    <jsp:useBean name="<%= beanType %>" class="<%= beanClass %>"/>
    I also tried using this approach
    <%
    if( beanType.equals( "Bean1" ) ) {
    %>
    <jsp:useBean id="bean" class="com.myCompany.Bean1"/>
    <%
    } else if( beanType.equals( "Bean2" ) ) {
    %>
    <jsp:useBean id="bean" class="com.myCompany.Bean2"/>
    <%
    %>
    Neither approach seems to work. Is there any way around this problem?
    Thanks,
    Marcus.

    Hi,
    check:
    http://forum.java.sun.com/thread.jsp?forum=45&thread=398998&tstart=75&trange=15

  • jsp:useBean error== The value for useBean class is invalid

    Can anybody tell me why am i getting the error for the JavaBean.
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: /SimpleBean.jsp(9,0) The value for the useBean class attribute com.stardeveloper.bean.test.SimpleBean is invalid.
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
         org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1272)
         org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1178)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
         org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
         org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
         org.apache.jasper.compiler.Generator.generate(Generator.java:3426)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:216)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    note The full stack trace of the root cause is available in the Apache Tomcat/6.0.20 logs.
    Apache Tomcat/6.0.20
    my jsp file is in path c:\tomcat6\webapps\dev\SimpleBean.jsp
    my JavaBean compiled class is in path
    c:\tomcat6\webapps\dev\WEB-INF\classes\com\stardeveloper\bean\test\SimpleBean.class
    and my SimpleBean java class declaration is
    package com.stardeveloper.bean.test;
    public class SimpleBean implements java.io.Serializable
    and my jsp page SimpleBean.jsp pages call to useBean is as follows
    <jsp:useBean id="simple" class="com.stardeveloper.bean.test.SimpleBean">
         <jsp:setProperty name="simple" property="name" value="Sujoy" />
         <jsp:setProperty name="simple" property="age" value="26" />
    </jsp:useBean>
    Please help me anybody.

    First, try restarting Tomcat :-)
    Main 3 reasons for "useBean class is invalid"
    - class must be in a package (ok)
    - class must be public, and have public constructor that takes no arguments (check)
    - class must be compiled, valid and on the classpath. Normally this means the WEB-INF/classes directory.
    From what you have told us, everything seems to check out.
    Try recompiling the .class file to ensure it is valid.
    Does your constructor do anything which might thrown an exception?
    Can you invoke it in scriptlet code without getting an exception?
    <%@ page import="com.stardeveloper.bean.test.SimpleBean" %>
    <% SimpleBean sb = new SimpleBean() %>Trying it in scriptlet code like this might give you a different error message that might help your diagnosis.
    cheers,
    evnafets

Maybe you are looking for

  • 6500 slide code problem

    the key safety code is not 12345 .I have tried everything !what do I do?

  • What are my thought on iCloud-

    I thought iCloud is to help me get access to files with my DIVICES with ease . What will happen if i have to be at a meeting and depending of on my keynote presentation and so forth to get access which will not be avlaible . My email is down for over

  • OT: Nostalgic for the 1996 web?

    Type your URL below. http://wonder-tonic.com/geocitiesizer/ Warning: don't do this on psychedelic drugs. Nancy O. Alt-Web Design & Publishing Web | Graphics | Print | Media  Specialists  http://alt-web.com/

  • Physical slot number in Solaris 5.7

    Hi can anyone help me in finding the physical slot number of a network interface card attached to Solaris 5.7 machine? There are two cards such as emulex and digi attached to solaris 5.7 box. In /etc/path_to_inst file, it has the entries, "/pci@0,0/p

  • HP storage server management

    Good-day, Are there any known issues with this software deleting files from source location during replication? thanks.