Jsp:useBean

I really shouldn't be trying to use JSP any more ...
I have been having problems using JavaBeans in JSP pages now - every time a problem is solved, that other little thing that always wanted a go at annoying me arrives ...
The code is:
<jsp:useBean id="pollResult" scope="application" class="com.ora.jsp.beans.poll.PollBean" />Because another JSP page I created (using JavaBeans) worked, using a JavaBean from the directory com.ora.jsp.beans.userinfo.UserInfoBean, I assumed that THIS would work - but it didn't! The error was:
org.apache.jasper.JasperException: /calculate.jsp(11,2) According to TLD or attribute directive in tag file, attribute test does not accept any expressionsAnother problem, is there a solution?
Sincerely, I'm sorry to plague everyone out there with all my problems - maybe I should give up and become a potato farmer instead ...

Hi
My Calculate.jsp looks like this:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:useBean id="pollResult" scope="application"
  class="com.ora.jsp.beans.poll.PollBean" />
<jsp:useBean id="answer" class="com.ora.jsp.beans.poll.AnswerBean" >
  <jsp:setProperty name="answer" property="*" />
</jsp:useBean>
<c:choose>
  <c:when test="${answer.valid}" >
    <c:set target="${pollResult}" property="answer"
      value="${answer}" />
    <jsp:forward page="result.jsp" />
  </c:when>
  <c:otherwise>
    <jsp:forward page="poll.jsp" />
  </c:otherwise>
</c:choose>I am using JSTL 1.1.

Similar Messages

  • 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.

  • Jsp:useBean and assigning a value to that bean

    Hello,
    I have a type called Country and I have declared a bean using the "jsp:useBean" syntax.
    I then try to assign a value to that bean in a scriptlet. Eventually I try to retrieve the values using "jsp:getProperty". The problem is that it appears to null.
    Here is the code of the jsp
    <%@ page language="java" %>
    <%@ page import="com.parispano.latinamericaguide.*" %>
    <%
    /* We retrieve the Countries object from the servlet context. */
    ServletContext sc = getServletContext();
    Countries cs = (Countries)sc.getAttribute("countries");
    %>
    <jsp:useBean id="country" class="com.parispano.latinamericaguide.Country"/>
    <%
    /* If the request contains a country id, then we set the variable. */
    country = cs.getCountryFromId(Integer.parseInt(request.getParameter("countryID")));
    %>
    <html>
    <head>
    <title>Country details</title>
    </head>
    <body>
    <table>
    <tr><td>Name</td><td><jsp:getProperty name="country" property="name"/><!-- This is not working--></td></tr>
    <table>
    <%
    out.println(country.getName());//This is working
    %>
    </body>
    </html>This is the code for the bean
    package com.parispano.latinamericaguide;
    * @author Julien Martin
    * Represents a country.
    public class Country implements Comparable {
         private int id;
         private String name;
         private int landArea;
         private String capital;
         private String currency;
         private String flag;
         private String internet_domain;
         private String dialling_code;
         private float literacy;
         private float male_life_expectancy;
         private float female_life_expectancy;
         private String map;
         private int population;
         private int population_year;
         private float birth_rate;
         private int birth_rate_year;
         private float death_rate;
         private int death_rate_year;
         private int gdp;
         private int gdp_per_head;
         private int gdp_year;
         private float unemployment_rate;
         private int unemployment_rate_year;
         public Country() {
         public Country(
              int id,
              String name,
              int landArea,
              String capital,
              String currency,
              String flag,
              String internet_domain,
              String dialling_code,
              float literacy,
              float male_life_expectancy,
              float female_life_expectancy,
              String map,
              int population,
              int population_year,
              float birth_rate,
              int birth_rate_year,
              float death_rate,
              int death_year_rate,
              int gdp,
              int gdp_year,
              float unemployment_rate,
              int unemployment_rate_year) {
              this.id = id;
              this.name = name;
              this.landArea = landArea;
              this.capital = capital;
              this.currency = currency;
              this.flag = flag;
              this.internet_domain = internet_domain;
              this.dialling_code = dialling_code;
              this.literacy = literacy;
              this.male_life_expectancy = male_life_expectancy;
              this.female_life_expectancy = female_life_expectancy;
              this.map = map;
              this.population = population;
              this.population_year = population_year;
              this.birth_rate = birth_rate;
              this.birth_rate_year = birth_rate_year;
              this.death_rate = death_rate;
              this.death_rate_year = death_year_rate;
              this.gdp = gdp;
              this.gdp_year = gdp_year;
              this.unemployment_rate = unemployment_rate;
              this.unemployment_rate_year = unemployment_rate_year;
         public float getBirth_rate() {
              return birth_rate;
         public int getBirth_rate_year() {
              return birth_rate_year;
         public String getCapital() {
              return capital;
         public String getCurrency() {
              return currency;
         public float getDeath_rate() {
              return death_rate;
         public int getDeath_rate_year() {
              return death_rate_year;
         public String getDialling_code() {
              return dialling_code;
         public float getFemale_life_expectancy() {
              return female_life_expectancy;
         public String getFlag() {
              return flag;
         public int getGdp() {
              return gdp;
         public int getGdp_per_head() {
              return gdp / population;
         public int getGdp_year() {
              return gdp_year;
         public int getId() {
              return id;
         public String getInternet_domain() {
              return internet_domain;
         public float getLiteracy() {
              return literacy;
         public float getMale_life_expectancy() {
              return male_life_expectancy;
         public String getMap() {
              return map;
         public String getName() {
              return name;
         public int getPopulation() {
              return population;
         public int getPopulation_year() {
              return population_year;
         public int getLandArea() {
              return landArea;
         public float getUnemployment_rate() {
              return unemployment_rate;
         public int getUnemployment_rate_year() {
              return unemployment_rate_year;
         public void setBirth_rate(float f) {
              birth_rate = f;
         public void setBirth_rate_year(int i) {
              birth_rate_year = i;
         public void setCapital(String string) {
              capital = string;
         public void setCurrency(String string) {
              currency = string;
         public void setDeath_rate(float f) {
              death_rate = f;
         public void setDeath_rate_year(int i) {
              death_rate_year = i;
         public void setDialling_code(String string) {
              dialling_code = string;
         public void setFemale_life_expectancy(float f) {
              female_life_expectancy = f;
         public void setFlag(String string) {
              flag = string;
         public void setGdp(int i) {
              gdp = i;
         public void setGdp_per_head(int i) {
              gdp_per_head = gdp/population;
         public void setGdp_year(int i) {
              gdp_year = i;
         public void setId(int i) {
              id = i;
         public void setInternet_domain(String string) {
              internet_domain = string;
         public void setLiteracy(float f) {
              literacy = f;
         public void setMale_life_expectancy(float f) {
              male_life_expectancy = f;
         public void setMap(String string) {
              map = string;
         public void setName(String string) {
              name = string;
         public void setPopulation(int i) {
              population = i;
         public void setPopulation_year(int i) {
              population_year = i;
         public void setlandArea(int i) {
              landArea = i;
         public void setUnemployement_rate(float f) {
              unemployment_rate = f;
         public void setUnemployment_rate_year(int i) {
              unemployment_rate_year = i;
         public String toString() {
              return name;
         public int compareTo(Object o) {
              Country c = (Country)o;
              int cmp = name.compareTo(c.name);
              System.out.println(cmp);
              return cmp;
    }Can anyone please help?
    Thanks in advance,
    Julien.

    Thanks,
    I have added scope="application". It still show "null" indicating that the bean is not initialized with the properties. I would like a quicker way to initialize a bean property than invoking the setProperty tag for each property.
    Here is a simple example that demonstrates the problem:
    <%@ page language="java" %>
    <%@ page import="com.tests.*" %>
    <jsp:useBean id="monBean" class="com.tests.MonBean" scope="application"/>
    <%
    MonBean mb = new MonBean();
    mb.setName("toto");
    monBean= mb;
    %>
    <html>
    <head>
    <title>Lomboz JSP</title>
    </head>
    <body bgcolor="#FFFFFF">
    <jsp:getProperty name="monBean" property="name"/>
    </body>
    </html>And the bean
    package com.tests;
    public class MonBean {
    private String name;
    public String getName() {
         return name;
    public void setName(String name) {
         this.name = name;
    }This show "null".
    Any other idea why this is not working?
    Thanks,
    Julien

  • Jsp:useBean giving error while compiling JSP's in JDeveloper

    Hello,
    I am having another problem with JSP's in JDeveloper 10.1.3. jsp:useBean and jsp:setProperty are all giving problems. I am not sure what I need to do to get rid of this error
    Thanks,
    Lakshmisri

    Your original post mentions issues with jsp:useBean and jsp:setProperty, now you're talking about tag libraries and directives. Can you be more specific about what you're trying to do? Are you having problems getting JDev to recognize a tag library or are you having problems with the tag library when running the app? What directive are you trying to use that causes the termination error?

  • Jsp:usebean How to get value of an object from a bean

    I am new to JSP and am struggling from past few days to solve a problem. Consider the below scenario
    Class Book{
    private String author;
    public void setAuthor(String author)
    public String getAuthor(){
    return author; }
    Class Rack{
    private Book []books;
    public []Book getbooks()
    return books;
    public void setbooks([]Book val){....}
    Suppose Books gets populated only using Rack and I have Rack populate in my session, using jsp:usebean or any other tag how can I get value of author? Does using tag handle null value check of books, if books are not set by any chance?
    Regards,
    Dhyan

    I got a way out to access the attribute, i feel it is
    <jsp:usebean id="myRack" class="settings.Rack"/>
    <c:foreach var="book" item="myRack.books">
    </c:foreach>
    I am not able to check if this is correct or not because myRack.books is not having any value set by me in the request scope. How do i get instance of Rack class set by another page in the current request? I can get the value if i use scriptlet but i dont want to use scriptlet.
    I am continiously trying, if I get an answer, I shall post, else pls somebody guide.

  • 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.

  • Why do we need jsp:useBean???

    Hi All,
    I am going over both the J2EE tutorial and JSP1.2 spec.
    As far as I read, it seems to me that "jsp:useBean" is a way of creating a bean object.
    <jsp:useBean id="local" scope="application" class="Mylocales">
    If I put the class file in the import statement, can I create the object in the scriptlet
    <% Mylocales local = new Mylocales(); %>
    and set/get properties by calling
    local.setName(); // assume these methods are in the class
    local.getName();
    without using "jsp:setProperty" and "jsp:getProperty".In this way, isn't it a redundancy to have "jsp:useBean" in JSP spec? We can always create any kind of objects in the scriptlets.
    Since "jsp:useBean" has been there for years, I believe something must be wrong with my rationale. However, both the spec and the tutorial couldn't answer this question. Can anyone clear it up to me?
    Thx in advance.
    Kevin

    There's nothing wrong with your rationale; useBean IS a redundant tag, but it does provide some compact functionality without having to write extra code.
    http://java.sun.com/products/jsp/tags/11/syntaxref1115.html covers the syntax of this tag; one advantage of using this tag is the 'scope' attribute, that allows you to define, at object creation, just how long the object will be around. You can limit an object's scope to the page that declared it, or allow it to be accessed by any page that shares the same session, or request, or application.
    I do believe that the main point of this tag comes in at the design level; one of the strongest reasons to use JSPs at all is to separate out the application logic from the page presentation. This means that anyone who can use HTML should be able to maintain the JSP pages in the application. Instead of having to teach a non-programmer a little bit of code, just demonstrate the use of a single tag that can be reused throughout the application. The logical extension of this idea is the tag library.
    Myself, I mix and match as needed, but there are never more than a few lines of scriptlet code in my JSP pages. If there's more code than HTML in my JSP page, I'll go ahead and use a servlet instead.
    Anyway, I guess my point is that JSP pages are flexible, you can pick the functionality that you want to use, and the useBean tag isn't quite superfluous.

  • jsp: useBean.. and c: coding

    I am trying to understand this coding.
    1. What does the <jsp: useBean .. class="coreservlets.ShoppingCart"> mean? Are we bringing in the content of the ShoppingCart class?
    If we use <% import="coreserlets.*"> at the top of JSP, wouldn't this work to apply all the class in the application?
    2.What is the <c:> coding? I have never seen this before (I am pretty new with Java). Is this new version of Java?
    Thanks.
    Here is coding sample.
    <jsp:useBean id="cart" class="coreservlets.ShoppingCart" scope="session"/>
    <c:choose>
      <c:when test="${empty cart.itemsOrdered}">
        <h2><i>No items in your cart...</i></h2>
      </c:when>
      <c:otherwise>
        <table border=1 align="center">
        <tr bgcolor="#FFAD00">
          <th>Item ID</th>
          <th>Description</th>
          <th>Unit Cost</th>
          <th>Number</th>
          <th>Total Cost</th>
        </tr>
        <c:forEach var="item" items="${cart.itemsOrdered}">
           <tr>
             <td><c:out value="${item.itemID}"/></td>
             <td><c:out value="${item.shortDescription}"/></td>
             <td><fmt:formatNumber value="${item.unitCost}" type="currency"/>        
           </tr>
        </c:forEach>
        </table>
      </c:otherwise>
    </c:choose>

    I am trying to understand this coding.
    1. What does the <jsp: useBean ..
    class="coreservlets.ShoppingCart"> mean? Are we
    bringing in the content of the ShoppingCart class?You're telling the JVM that you're going to use an instance of that class.
    >
    If we use <% import="coreserlets.*"> at the top of
    JSP, wouldn't this work to apply all the class in the
    application?No, that's not what import does.
    2.What is the <c:> coding? I have never seen this
    before (I am pretty new with Java). Is this new
    version of Java?It's the JSP Standard Tag Library, or JSTL. It has core tags <c>, xml tags <xml>, formatting tags <format>, and SQL tags <sql>
    <jsp:useBean id="cart"
    class="coreservlets.ShoppingCart" scope="session"/>Looks like there's a ShoppingCart object in session scope.
    >
    Check to see if the shopping cart has items.
    c:choose>If no items, say so.
    >
    <c:when test="${empty cart.itemsOrdered}">
    <h2><i>No items in your cart...</i></h2>
    /c:when>If there are items, display them in a table.
    >
    <c:otherwise>
    <table border=1 align="center">
    <tr bgcolor="#FFAD00">
    <th>Item ID</th>
    <th>Description</th>
    <th>Unit Cost</th>
    <th>Number</th>
    <th>Total Cost</th>
    /tr>
    <c:forEach var="item"
    items="${cart.itemsOrdered}">
    <tr>
    <td><c:out value="${item.itemID}"/></td>
    <td><c:out
    value="${item.shortDescription}"/></td>
    <td><fmt:formatNumber
    value="${item.unitCost}" type="currency"/>
    </tr>
    c:forEach>
    </table>
    c:otherwise>
    </c:choose>
    If you're new to Java, best to learn the base language before tackling JSPs.
    %

  • HELP: jsp:useBean not "working"

    I have written a JSP that utilizes some JavaBeans. With one, I do something similar to the following:
    <jsp:useBean id="BeanA" class="mypackage.myFirstBean" />
    That statement executes just fine, as the debug HTML statement that follows is printed using <c:out>.
    Then I follow that with something nearly identical:
    <jsp:useBean id="BeanB" class="mypackage.mySecondBean" />
    The debug statement after this second <jsp:useBean> call is not executed.
    The two beans have no-argument constructors and are in the same package, and both are found in the right hierarchy under WEB-INF/classes inside my WAR file. Also, both are named properly in the JSP. The only difference is that one "executes," and the other does not. I don't even get to call <c:set> on them to actually make them do some work!
    Any insight is appreciated. Let me know if there is anything else I can provide.
    Thanks for your help, and Happy New Year!

    The symptom you described is certainly curious.
    Can you put the second "useBean" line before the first one? Then please tell us if it "executes".

  • Jsp:useBean gives cannot be resolved to a type in Tomcat

    Hi, I am using Tomcat 5.5
    I have a simple JavaBean for test purposes :
    import java.io.Serializable;
        public class testBean implements Serializable {
            int number;
            public testBean() {
            public int getNumber() {
                return number;
            public void setNumber(int newValue) {
                number = newValue;
        }In a file called testBean.java
    I have successfuly compiled it and put the class file the WEB-INF/classes directory.
    I have the following JSP page :
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <jsp:useBean id="pub" scope="session" class="testBean" />
    <jsp:setProperty name="pub" property="number" value="1" />
    <html>
    <head>
    </head>
    <body>
    <jsp:getProperty name="pub" property="number" />
    </body>
    </html>When I open this jsp page I get the following error:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 2 in the jsp file: /test.jsp
    Generated servlet error:
    testBean cannot be resolved to a typeThis example is pretty minimal and I don't understand why it doesn't work. The error seems to be coming from the first JSP statement.
    Any help would be greatly appreciated.
    Thanks in advance.

    1. Put your bean class in a package.
    package test;
    import...........2. Put the .class file in web-inf/classes/test/testBean.class
    3. Specify the fully qualified name of the class in the useBean declaration.
    <jsp:useBean class="test.testBean" .../>Note: You'd be better off following the java bean naming conventions. Specifically your class name should be TestBean (first letter caps).
    ram.

  • Jsp:useBean vs page import in JSP

    Hi,
    What is the difference between jsp:useBean vs page import in JSP?
    By using page import also I can call the method of the class, apart from jsp:useBean does have scope associated with it. I don't think there is any change between both the 2. Yes by using jsp:useBean we can set the property and get the property as well.
    Is there any major differences between the 2 and when to use which ? Please clarify.
    Thanks.

    797836 wrote:
    Hi,
    What is the difference between jsp:useBean vs page import in JSP?
    By using page import also I can call the method of the class, apart from jsp:useBean does have scope associated with it. I don't think there is any change between both the 2. Yes by using jsp:useBean we can set the property and get the property as well.
    Is there any major differences between the 2 and when to use which ? Please clarify.
    Thanks.Yes there is a difference.
    If you use import, then you have to create/use the reference object to use the class methods. And you can't define the scopes like session, page .. etc. Apart from this you will be using scriptlets <% %>.
    if you are using jsp:useBean , then you can skip the above activities. useBean takes care of it.
    or you can say jsp has provided a utility to access the beans without creating its object or using scriptlets.

  • 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

  • How can i load A gui JTable bean through jsp:useBean tag in a jsp page

    Hi,
    i am chiranjit , i am in a jsp project . i am desparately looking a solution for below stated problem:
    i want to make a jsp page for master entry , that why i want to load a GUI Java bean in my jsp page.This GUI Bean contaning a JTable in which allow grid type data entry in the jsp page. But i am unable load that bean in the jsp page through jsp:useBean tag in my page.So if you have any solution then send in the forum as early as possible.
    Thank you
    chiranjit

    No can do. JSPs can only output plain HTML (and javascript...) They are not used like normal Java classes.
    If you need a complex GUI then you might use an Applet instead. If you want to use a JSP then you are stuck using normal HTML components, like <table> <form...> <input type="text"> etc...

  • 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 ?

  • 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

  • How can I name files separate from the page titles on the menu options?

    Ok, this is so much of a pain. I use a unix based web-server so the content is very case sensitive, and having spaces in the file names is just unmanageable. So.. how can I have pretty menu titles but have real world filenames? Presently I have to ge

  • Cable splitter

    I need to hook up to a charger AND a vga adapter, at the same time... is there a way to do this?  I need to have power on for long presentations.  Can anyone think of a way to do this?

  • Does Oracle Portal Support text/v-card content Type

    I would like to display some text/v-card format information (generated by servlet) within the portlet. And I defined in the porvider.xml something like this: <renderer class="oracle.portal.provider.v2.render.RenderManager"> <contentType>text/x-vcard<

  • Google+ Not Working Properly. Refreshing Google+ doesn't work

    I have updated from Firefox 28 to Firefox 29 and Google+ is not working. I have uninstalled, cleared cache, reset the browser, started in safe mode and it still hasn't worked. Firefox didn't show Google+ on all the computers I tried except a Pentium

  • ***HELP!*** Installation hang!

    I was wiping and installing a student version of Windows 7 over a secure wireless network (DVD-drive shared, Touchsmart connecting via network sharing, etc.).  During installation, I lost power to the TouchSmart, and now, no matter what I do, it gets