Javabeans in JSP

When i use a javabean in my jsp it doesnt find my class, I need to put anything in web.xml?? Im using Tomcat 4.0
I have beans.jsp:
<jsp:useBean id="languageBean" scope="page" class="LanguageBean">
     <jsp:setProperty name="languageBean" property="*"/>
</jsp:useBean>
<html>
     <head>
          <title>useBean action test result</title>
And LanguageBeans.class in web-inf/classes/LanguageBean.class
what must I put in web.xml?
Thanks,
Daniel

Hi Daniel,
1. Check ur classpath.
2. add .class to the foll code : class="LanguageBean.class" >
3. Comment out the code to check the bean's availability in the jsp code.
<jsp:setProperty name="languageBean" property="*"/>
Try to execute a method available in the LanguageBean class.
If ur still getting the error post ur bean code here and the stack trace.
Seetesh

Similar Messages

  • Problem with JavaBeans in JSP.IT'S URGENT!!!

    Hi, i have problems with JavaBeans in JSP.
    In a jsp file( locating in ROOT directory of tomcat 4.0.6 :jakarta-tomcat-4.0.6\webapps\root ) i have this code:
    <jsp:useBean id="paramBean" class="licentza.ParamBean" />
    <jsp:setProperty name="paramBean"
    property="nume"
              value='<%= request.getParameter("numeUser") %>' />
    where ParamBean it's a "bean" class locating in jakarta-tomcat-4.0.6\webapps\examples\web-inf\classes\licentza (licentza is the package i'm using).
    And i get this error:
    Generated servlet error:
    D:\jakarta-tomcat-4.0.6\work\Standalone\localhost\_\dora\intrare2$jsp.java:67: Class licentza.ParamBean not found.
    ParamBean paramBean = null;
    What is the problem?Thank you.

    Hi,
    Put the class file or the package under :jakarta-tomcat-4.0.6\webapps\root\WEB-INF\classes.
    Rajesh

  • Using a JavaBean in JSP

    Hello,
    I am very new at this, and I am doing a very simple tutorial to use a JavaBean in JSP. I have followed all the procedures from my tutorial, and I get the following error:
    org.apache.jasper.JasperException: Can't find a method to write property 'make' of type 'java.lang.String' in a bean of type 'com.wrox.cars.CarBean'
    I have the bean:
    package com.wrox.cars;
    import java.io.Serializable;
    public class CarBean implements Serializable {
    private String make = "Ford";
    public CarBean(){
    public String getMake(){
    return make;
    public void SetMake(String make)
    this.make = make;
    and the JSP:
    <jsp:useBean id="myCar" class="com.wrox.cars.CarBean" />
    I have a <jsp:getProperty name="myCar" property="make" /><br>
    <jsp:setProperty name="myCar" property="make" value="Ferrari" />
    Now I have a <jsp:getProperty name="myCar" property="make" /><br>
    The only thing I am missing is this step, where I have been looking for these JAR files and can't find them
    I have downloaded many JSTL libraries, and still can't find them/
    - dom.jar
    - jaxp-api.jar
    - jdbc2_0-stdext.jar
    - sax.jar
    - xalan.jar
    - xercesImpl.jar
    I really appreciate any help.

    Thanks a lot.
    Although I should know that, it seems that the error was in the tutorial.
    Thanks again,

  • In Jsp TagLib how can I get the Attribute value (like JavaBean) in jsp

    Dear Friends,
    TagLib how can I get the Attribute value (like JavaBean) in jsp .
    I do this thing.
    public void setPageContext(PageContext p) {
              pc = p;
    pc.setAttribute("id", new String("1") );
              pc.setAttribute("first_name",new String("Siddharth")); //,pc.SESSION_SCOPE);
              pc.setAttribute("last_name", new String("singh"));
    but in Jsp
    <td>
    <%=pageContext.getAttribute("first_name"); %>
    cause null is returing.
    Pls HELP me
    with regards
    Siddharth Singh

    First, there is no need to pass in the page context to the tag. It already is present. How you get to it depends on what type of tag:
    Using [url http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/SimpleTagSupport.html]SimpleTagSupport
    public class MyTag extends SimpleTagSupport
      public void doTag()
        PageContext pc = (PageContext)getJspContext();
        pc.setAttribute("first_name", "Siddharth");
        pc.setAttribute("last_name", "Singh");
        pc.setAttribute("id", "1");
    }Using [url http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/TagSupport.html]TagSupport or it's subclass [url http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/BodyTagSupport.html]BodyTagSupport the page context is aleady declared as an implicit object:
    public class MyTag extends TagSupport
      public void doStartTag()
        pageContext.setAttribute("first_name", "Siddharth");
        pageContext.setAttribute("last_name", "Singh");
        pageContext.setAttribute("id", "1");
    }In each case, this sort of thing should work:
    <mytags:MyTag />
    <%= pageContext.getAttribute("first_name") %>I

  • Why JavaBeans with JSP

    Hi,
    I know its an easy question and probably a silly one to ask, but still please take time to answer this. Why do we use JavaBeans with JSP to make use of reusable code. Cant we use simple classes for this?
    Thanks in advance

    Hi,
    JavaBeans technology is the component architecture for the Java 2 Platform, Standard Edition (J2SE). Components (JavaBeans) are reusable software programs that you can develop and assemble easily to create sophisticated applications. By using Java beans, JSP allows you to keep much more of your code separate from the html than other html embedded languages. Java beans basically let you keep all the logic of your page (like the code to connect to a database, manipulate data etc�) in a separate file known as a Java bean. Then from within your html page - all you do is use one tag to 'use' the bean, and then a few other short tags to send data to and from the bean.
    the website http://java.sun.com/products/jsp/html/jsptut.html is a good start, simple and easy understand.
    Good luck!
    jmling

  • Scope when using a JavaBean with JSP

    what is the meaning of this question .....?
    "Which of the following can not be used as the scope when using a JavaBean with JSP? "
    question 4
    site :http://java.sun.com/developer/Quizzes/jsptut/

    The question is clearly written. I don't see how you can be confused. But let's assume you are since you would not have posed the question.
    Dumbed-down:
    There are 4 scopes or areas of variable visibility in JavaServer Pages. Which of those can areas can not be used with JavaBeans?
    Does that help?

  • Using JavaBean with JSP...will not work no matter what

    Hi guys. Sorry that this is such a common, newb question, but I don't know where else to turn.
    I'm new to web application development, Tomcat, and JSP. I'm trying to use a simple JavaBean in a JSP to store some user information. The JSP is located in $CATALINA_HOME\webapps\art , and the UserBean I'm trying to use is in $CATALINA_HOME\webapps\art\WEB-INF\classes . I've tried adding a context in the Tomcat server.xml file, but nothing seems to work, even putting the .class file into the \art directory along with the JSP. The error I get is the following:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 1 in the jsp file: /welcome.jsp
    Generated servlet error:
    [javac] Compiling 1 source file
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\art\welcome_jsp.java:43: cannot resolve symbol
    symbol : class UserBean
    location: class org.apache.jsp.welcome_jsp
    UserBean user = null;
    ^
    The source code is:
    welcome.jsp
    <%@ page import="java.sql.*" %>
    <jsp:useBean id="user" class="UserBean" scope="session"/>
    <html>
    <head>
    <title>Art Webapp Test</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <h1>Art Site</h1><br><br>
    <h3>Welcome Page</h3><br><br>
    <%
         user.setUsername("joe");
    user.setTitle("admin");
    %>
    </body>
    </html>
    UserBean:
    public class UserBean {
    private String username = null;
    private String title = null;
    public UserBean()
         this.username = null;
         this.title = null;
    public String getUsername()
         return this.username;
    public String getTitle()
         return this.title;
    public void setUsername(String inName)
         this.username = inName;     
    public void setTitle(String inTitle)
         this.title = inTitle;     
    }//UserBean
    Thanks for any and all help anyone could give me about this. It seems such a simple thing, to get a JavaBean working in a JSP...and it's very frustrating to have it NOT work when it seems I've done everything possible to get it to.

    Ok, I figured out what the problem was. My Bean was not a part of any specific package. It was never made clear to me that Beans are required to be a part of some package...I had no idea (though they always put them in packages in the tutorials, you think I would have picked up on it!).
    So I just added the following line to the Bean:
    package com.art;
    Then compiled it and copied the .class file to CATALINA_HOME\webapps\art\WEB-INF\classes\com\art
    Ta-da
    Thanks for the help and sorry for taking up space on this board.
    -Matt

  • JavaBean and JSP

    Hi
    I'm new to Java Prog. I've been trying many days to come up with a JSP that works with a JavaBean to validate a login with a SQL server. I somehow still cannot make my beans work.
    It's a very simple JSP login.html with 2 fields: userName and userPass.
    This page will action to the checkLogin.jsp where all the connection to the beans take place. If successful, it will forward to the nextPage welcome.jsp.
    Can anyone pls help with a simple solution? I'm a beginner after all.
    Thanks in advance.

    Create a bean with one method that takes in two strings, username and userpass. This method checks against the datbase and simply returns a true if the combination exists in the database. Otherwise, flase.
    In checkLogin.jsp, extract the parameters sent in from login.html. Call the method on the bean.
    If false is returned, display an error message or redirect back to login.html.
    If true is returned, create a session variable like "loggedIn" and set value of it to be "true" or something like that.
    Then use redirect to the welcome.jsp.
    welcome.jsp first checks to see if that session variable "loggedIn" exists. If it does, it proceeds, otherwise, display an error message and/or redirect to login.html.
    A logout.jsp can be written in a similar way except it would remove the session variable "loggedIn"

  • JDBC JavaBean and JSP

    I have a JavaBean where I am just trying to display information from MySQL database.
    I keep getting a null output but should really get back 1 record.
    Please advise what I am doing wrong because I have spent hours on this and I cant see what I did wrong:
    package num;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    public class dbBean implements Serializable
       protected transient String query;
       protected transient String resultTable;
       protected transient Connection conn;
       public dbBean()
          query = null;
          resultTable = null;
          conn = null;
         public void setResultTable(String resultTable)
            this.resultTable = resultTable;
       public String getResultTable()
           this.viewDatabaseTable();
           return resultTable;
    public void viewDatabaseTable()
        executeDb(query);
    public void executeDb(String query)
        if(conn == null)
           initializeDb();
        try
          Statement stmt = conn.createStatement();
          ResultSet results = stmt.executeQuery("SELECT * from user where lastname = 'Jones'");
          while(results.next())
                results.getString("lastname");
    stmt.close();
    results.close();
    conn.close();
        catch (SQLException sqle)
           sqle.printStackTrace();
    public void initializeDb()
        try
                 Class.forName("org.gjt.mm.mysql.Driver");
                 conn = DriverManager.getConnection("jdbc:mysql://localhost/myfirst?user=root&password=mypassword");
         catch (SQLException sqle)
            sqle.printStackTrace();
         catch (ClassNotFoundException cnfe)
        cnfe.printStackTrace();
    }The JSP:
    <%@ page import = "num.dbBean" %>
    <jsp:useBean id="db" scope="session" class="num.dbBean">
    </jsp:useBean>
    <html>
    <body>
    <jsp:getProperty name="db" property="resultTable" />
    <br>
    data here
    </body>
    </html>If I put this in a scriplet it works and I can get back a record.
    Please advise.

    while(results.next())
                results.getString("lastname");
          }Well you are iterating through your result set, but you aren't doing anything with the value now are you?
    String lastName = results.getString("lastname");
    what do you do with this value now?
    Where do you call setResultTable() from?

  • Populating combobox in jsp page from javabean using jsp:getProperty tag

    hi,
    i am new to jsp, so i don;t know how to populate a combobox in jsp page with productid attribute from a javabean called Bid . i want to have a code to automatically populating combobox using the attribute value from javabean.
    please reply me.
    <jsp:useBean id="bidpageid" class="RFPSOFTWARE.Bid" scope="session" />
    <jsp:setProperty name="bidpageid" property="*"/>
      <table  width="50%" align="center" border="0">
       <tr>
        <td  width="30%" align="left"><h4><b><label>Date (dd/mm/yyyy) </label></b></h4> </td>
        <td><input type="text" name="date" size="11" maxlength="10" readonly="readonly" value="<jsp:getProperty name="bidpageid" property="date"/>"  > </td>
      </tr>
      <tr> <td > </td> </tr>
      <tr>
        <td  width="30%" align="left"><h4><b><label>ProductId </label></b></h4> </td>
        <td><select name="productid" tabindex="1" size="1" >
          <option  value="<jsp:getProperty name=bidpageid" />Sachin</option>
          <option value="Hello">Vishal</option>
        </select></td>
      </tr>  and the javabean for Bid is as follow :
    import java.util.Date;
    import RFPSOFTWARE.Product;
    public class Bid{
    private Product product;
    private Integer bid_id;
    private String description;
    private Date date= new Date();
    public Integer getBid_id() {
    return bid_id;
    public Date getDate() {
    return date;
    public String getDescription() {
    return description;
    public Product getProduct() {
    return product;
    public void setBid_id(Integer bid_id) {
    this.bid_id = bid_id;
    public void setDate(Date date) {
    this.date = date;
    public void setDescription(String description) {
    this.description = description;
    public void setProduct(Product product) {
    this.product = product;
    }

    No Sir,
    I think I did not explained clearly.what I try to say is I dont want to use JSTL.I am using only Scriptlets only.I can able to receive the values from the database to the resultset.But I could not populate it in Combobox.
    My code is :
    <tr>
    <td width="22%"><font color="#000000"><strong>Assign To Engineer</strong></font></td>          
    <td width="78%">
         <select NAME="Name" size="1">
    <option><%=Username%></option>
    </select> </td>
    </tr>
    in HTML
    and in Scriptlets:
    ps1 = con.prepareStatement
              ("SELECT Username FROM Users");
              rs2=ps1.executeQuery();
              System.out.println("SECOND Succesfully Executed");
              while(rs2.next())
                   System.out.println("Coming inside rs2.next loop to process");
                   Username=rs2.getString("Username");
                   System.out.println("Success");
                   System.out.println("The value retrieved from UsersTable Username is:"+Username);
    In the server(Jboss console) I can able to display the username but I could not populate it in the Combobox .
    Can you now suggest some changes in my code,Please..
    Thanks a lot
    With kind Regds
    Satheesh

  • Having problem implementin javabeans in JSP

    here is my code:
    <html>
    <body>
    <%@ page language="java" import="dbBean"\%>
    <jsp:useBean id="dbBean" scope="request" class="dbBean" />
    <%
    dbBean.setUserID(request.getParameter("id"));
    dbBean.setUserPass(request.getParameter("pass"));
    dbBean.setFirstName(request.getParameter("fname"));
    dbBean.setLastName(request.getParameter("lname"));
    dbBean.setEmail(request.getParameter("email"));
    %>
    The result of the query is:
    <table>
    <tr>
    <th>UserID </th> <th> UserPass </th> <th> FirstName </th><th>LastName
    </th><th>Email </th>
    </tr>
    <%= dbBean.InsertInfo() %>
    </table>
    <p>
    </body>
    </html>
    <html>
    <head>
    <title>Register New Users</title>
    <SCRIPT LANGUAGE=JAVASCRIPT>
    <!--//var correct = true
    function checkData(){
    if (document.FrmAdd.fname.value == ""){
         alert("Please enter First Name!");
         FrmAdd.fname.focus();
         FrmAdd.fname.select();
         return false; }
    else if (document.FrmAdd.lname.value == ""){
         alert("Please enter Last Name!");
         FrmAdd.lname.focus();
         FrmAdd.lname.select();
         return false;
    else if(document.FrmAdd.email.value == ""){
         alert("You must type in an email address")
         FrmAdd.email.focus()
         FrmAdd.email.focus()
         return false
    //if the emailAddrs does not contain the @ symbol
    else if(document.FrmAdd.email.value.indexOf('@')== -1){
         alert("Your email address is missing an @ symbol")
         FrmAdd.email.focus()
         FrmAdd.email.focus()
         return false
    //if the emailAddrs does not contain a full stop
    else if(document.FrmAdd.email.value.indexOf('.')== -1){
         alert("Your email address is missing a period")
         FrmAdd.email.focus()
         FrmAdd.email.focus()
         return false
    else if (document.FrmAdd.id.value == ""){
         alert("Please enter Login ID!");
         FrmAdd.id.focus();
         FrmAdd.id.select();
         return false;}
    else if (document.FrmAdd.pass.value == ""){
         alert("Please enter Login Password!");
         FrmAdd.pass.focus();
         FrmAdd.pass.select();
         return false;}
    else if (document.FrmAdd.pass1.value == ""){
         alert("Please enter Login Password!");
         FrmAdd.pass1.focus();
         FrmAdd.pass1.select();
         return false; }
    else if(document.FrmAdd.pass.value != document.FrmAdd.pass1.value){
         alert("Both password doesnt match");
         FrmAdd.pass1.focus();
         FrmAdd.pass1.select();
         return false;}
    return true;
    //-->
    </SCRIPT>
    </head>
    <form name="FrmAdd" method="post" action="registration1.jsp" onSubmit="return checkData();">
    <body>
    <Center>
    <table border="0">
    <tr><td align="center">
         <font face = "verdana" size ="4" color="darkblue"><b><I>Welcome to Registration Page</I></b></font>
    </td><tr>
    </table>
    <table>
    <tr>
         <font face="verdana" size="1">Home</font>
         <td bgcolor="#93bee2" style="PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; PADDING-TOP: 2px"
    colspan="2" align="middle">
    <font Face="verdana" color="Darkblue" size="2">Registration</font></td>
    </tr>
    <tr></tr><tr></tr>
    <tr>
    <td bgcolor="#dbeaf5" style="PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; PADDING-TOP: 2px"
    colspan="2" align="middle">
         <font Face="verdana" color="Darkblue" size="2">Profile</font>
    </td></tr>
    <tr>
         <td cellspacing="0" cellpadding="0" align="left"><font size="2"><b>First Name</b></font></td>
    <td>
    <input name="fname" size=23 maxlength=40 tabindex ="1" style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana" ></td>
    </tr>
    <tr>
         <td cellspacing="0" cellpadding="0" align="left"><font size="2"><b>Last Name</b></font></td>
    <td>
    <input name="lname" size=23 maxlength=40 tabindex="2" style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana" ></td>
    </tr>
    <tr>
         <td cellspacing="0" cellpadding="0" align="left"><font size="2"><b>Email Address</b></font></td>
    <td>
    <input name="email" size=17 maxlength=30 tabindex="3" style="FONT-SIZE: 8pt; WIDTH: 154px; FONT-FAMILY: Verdana; HEIGHT: 19px"></td>
    </tr>
    <tr>
    <td style="PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; PADDING-TOP: 2px"
    colspan=2 align="middle"><hr color="#dbeaf5"></td>
    </tr>
    <tr>
    <td bgcolor="#dbeaf5" style="PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; PADDING-TOP: 2px"
    colspan=2 align="middle">
         <font Face="verdana" color="Darkblue" size="2">Account Information</font>
         </td>
    </tr>
    <tr>
         <td cellspacing="0" cellpadding="0" align="left"><font size="2"><b>Sign-in</b></font></td>
    <td><input name="id" size=9 maxlength=9 tabindex="4" style="FONT-SIZE: 8pt; WIDTH: 128px; FONT-FAMILY: Verdana; HEIGHT: 19px"
    ></td>
    </tr>
    <tr>
         <td cellspacing="0" cellpadding="0" align="left"><font size="2"><b>Password</b></font></td>
    <td> <input type="password" name="pass" size=25 maxlength=25 tabindex="5" style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana" ></td>
    </tr>
    <tr>
         <td cellspacing="0" cellpadding="0" align="left"><font size="2"><b>Re-Enter Password</b></font></td>
    <td>
    <input type="password" name="pass1" size=25 maxlength=25 tabindex="5" style="FONT-SIZE: 8pt; FONT-FAMILY: Verdana" ></td>
    </tr>
    </table>
    <table>
    <tr>
    <td cellspacing="0" cellpadding="0" align="middle">
    <INPUT type=submit value="Signup" tabindex="9">
    </td>
    </tr>
    </table>
    </form>
    </Center>
    </body>
    </html>
    import java.sql.*;
    import java.io.*;
    public class dbBean{
         private String dbURL = "jdbc:odbc:TheDataSourceName";
         private String dbDriver = "sun:jdbc:odbc:jdbcOdbcDriver";
         private Connection dbCon;
         String UserID = null;
         String UserPass = null;
         String Email = null;
         String FirstName = null;
         String LastName = null;
    public dbBean(){
         super();
    public String getUserID(){
         return this.UserID;
    public void setUserID(String UserID){
         this.UserID = UserID;
    public String getUserPass(){
         return this.UserPass;
    public void setUserPass(String UserPass){
         this.UserPass = UserPass;
    public String getEmail(){
         return this.Email;
    public void setEmail(String Email){
         this.Email = Email;
    public String getFirstName(){
         return this.FirstName;
    public void setFirstName(String FirstName){
         this.FirstName = FirstName;
    public String getLastName(){
         return this.LastName;
    public void setLastName(String LastName){
         this.LastName = LastName;
    public String connect(){
         try
              Class.forName(dbDriver);
              return "Driver Loaded";
         }catch(Exception E){
              return "Unable to load Driver";
    public String insertInfo(){
         try{
              dbCon = DriverManager.getConnection(dbURL);
              PreparedStatement ps = null;
              ps = dbCon.prepareStatement("Insert INTO Logins " +
              " (userName, userPass, firstName, lastName, email) Values (?, ?, ?, ?, ?) ");
                   ps.clearParameters();
                   ps.setString(1, this.getUserID());
                   ps.setString(2, this.getUserPass());
                   ps.setString(3, this.getFirstName());
                   ps.setString(4, this.getLastName());
                   ps.setString(5, this.getEmail());
                   ps.executeUpdate();
                   ps.close();
                   dbCon.close();
                   return "Inserted row";
              }catch(Exception e){
              return "Error" + e.toString();
              }//catch(SQLException e1){
              //return "SQLException: " + e1.getMessage();
    can anyone help me out i have paste my .jsp file, html file, and javabeans file

    i took out that line..now i'm getting this error:
    i put all my .html and .jsp file under webapps\sgoyal
    sgoyal is my folder name under webapps..
    i put all of my .class files under webapps\sgoyal\WEB-INF\classes
    org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
    An error occurred at line: 3 in the jsp file: /registration1.jsp
    Generated servlet error:
    C:\unzipped\jakarta-tomcat-4.0.6\jakarta-tomcat-4.0.6\work\Standalone\localhost\sgoyal\registration1$jsp.java:60: Class org.apache.jsp.dbBean not found.
    dbBean dbBean = null;
    ^
    An error occurred at line: 3 in the jsp file: /registration1.jsp
    Generated servlet error:
    C:\unzipped\jakarta-tomcat-4.0.6\jakarta-tomcat-4.0.6\work\Standalone\localhost\sgoyal\registration1$jsp.java:63: Class org.apache.jsp.dbBean not found.
    dbBean= (dbBean)
    ^
    An error occurred at line: 3 in the jsp file: /registration1.jsp
    Generated servlet error:
    C:\unzipped\jakarta-tomcat-4.0.6\jakarta-tomcat-4.0.6\work\Standalone\localhost\sgoyal\registration1$jsp.java:68: Class org.apache.jsp.dbBean not found.
    dbBean = (dbBean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "dbBean");
    ^
    3 errors, 1 warning
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:285)
         at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:548)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:176)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:188)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
         at java.lang.Thread.run(Thread.java:536)
    please help me out it's my first time i'm javaBean

  • Have a question about using javabean in jsp

    Hello,
    Could I have a constructor with arguments in javabean?
    Thanks.

    Yes, but if you want to instantiate the bean using that constructor you have to do it in a snippet of java code, not using a jsp tag:
    You can use
    <%
    MyBeanClass mbc = new MyBeanClass(arg1, arg2, ...);
    %>You can't use
    <jsp:useBean id="mbc" class="MyBeanClass">

  • JavaBeans in JSP on iPlanet server problem

    Hi-
    I have deployed several JSPs, but this is my first attempt at using JavaBeans in the pages. We are using the iPlanet 4.1 web server.
    The following is my JSP code (MyTest.jsp):
    <html>
    <head>
    <title> Test case</title>
    </head>
    <body>
    <jsp: useBean id="myBean" class="Beans.MyBean" />
    </body>
    </html>
    The following is the bean code:
    package Beans
    public class MyBean {
    private String message = "No Message";
    public String getMessage() {
    return(message);
    public void setMessage(String message) {
    this.message = message;
    I have the JSP and bean in the same directory. I'm not clear on where to put it on an iPlanet server. The bean compiles fine, and iPlanet seems to be able to see it. However, when I compile the JSP I get the following error on iPlanet:
    recompiling JSP file: /<dir path>/Beans/MyTest.jsp
    JSP compilation error: java.lang.Exception: JSP parse error (line24) - Incomplete tag ending of /jsp:useBean, stack: java.lang.Exception: JSP parse error(line 24) - Incomplete tag ending of /jspuseBean
    I've looked through several books and the JSP coding to useBean looks fine. Is this error related to iPlanet? Is it tied to the directory structure? We are using JDK1.3, is it set up for JavaBeans - or do we need to download some other files?
    Any help is welcomed!
    Thanks,
    Leilani

    Leilani,
    Have you got your JSP and beans to work. I'm having a similar problem. I am getting the following error when trying to load the JSP:
    [10/Dec/2001:11:46:42] info ( 1688): Internal Info: loading servlet /wacc/jsp/pickProgram.jsp
    [10/Dec/2001:11:46:47] info ( 1688): JSP: JSP1x compiler threw exception
    org.apache.jasper.JasperException: Unable to compile class for JSPC:\iPlanet\Server4\https-wacc\config\..\ClassCache\_jsps\_wacc\_jsp\_pickProgram_jsp.java:86: Undefined variable or class name: menu
    menu.setUserId(userId);
    ^
    1 error
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:260)
         at com.netscape.server.http.servlet.NSServletEntity.load(NSServletEntity.java:230)
         at com.netscape.server.http.servlet.NSServletEntity.update(NSServletEntity.java:149)
         at com.netscape.server.http.servlet.NSServletRunner.Service(NSServletRunner.java:463)
    [10/Dec/2001:11:46:47] warning ( 1688): Internal error: Failed to get GenericServlet. (uri=/wacc/jsp/pickProgram.jsp,SCRIPT_NAME=/wacc/jsp/pickProgram.jsp)
    My iPlanet "Configure JVM Attributes" has the path to the beans directory (I have also tried adding it to the Windows CLASSPATH variable):
    C:\dir\dir\beansdir;
    and here is the JSP code snippet:
    <%@ page info="Pick Program into page" %>
    <HTML>
    <HEAD>
    </HEAD>
    <BODY BGCOLOR="#ffffff">
    <USEBEAN name="menu" type=ford.wacc.beans.Menus lifespan=page></USEBEAN>
    <%
    PrintWriter myOut = response.getWriter();
    // get logged in user id
    String tmpStr = "userid";
    String userId = tmpStr.toUpperCase();
    // store user id in bean
    try {
    menu.setUserId(userId);
    } catch (Exception ex) {
    // global variables
    String[] menuItems = null;
    %>
    <%= tmpStr %>
    <%= userId %>
    </BODY>
    </HTML>
    I believe I have my iPalnet server configured correctly but it seems to me that it is a path problem. If anyone can point me in the right direction, I'd appreciate it. Thanks.

  • How can I load javaBeans in jsp without restart WL?

    hi,
              Restart WL every time I modify my bean really drive me crazy!
              Following the manual, I set up my servletclasspath and put all the beans
              I use in my jsp under that directory, I find out something strange:
              if my beans' scope is page and if I modify the jsp page as well every
              time I modify the beans, I can autoload the fresh new beans without
              restarting;
              if my beans' scope is larger than page( such as session), then even I
              modify the jsp, instead of the fresh new beans I get the following
              exception:
              java.lang.ClassCastException: com.aa.mybean at
              jsp_servlet._test._classquery._jspService(_mybean.java:81) at
              weblogic.servlet.jsp.JspBase.service(JspBase.java:27) at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:124)
              at
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:760)
              at
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:707)
              at
              weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContextManager.java:251)
              at
              weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:369)
              at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:269)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled Code)
              who knows how to autoload the new session scope javabeans in a jsp page
              without restarting WL?
              thanks in advance...
              

    That makes sense. If the session contains an instance of an old class, and
              you cast it to the new class, then you should get a class cast exception.
              One way around this is to use interfaces that are (for development) in one
              of the outer class paths (system or weblogic, I can't remember which) ...
              the only time you mention the class name is to new it. Then you cast the
              contents of the session attributes to those interfaces. The interfaces can
              not change without restarting the server, but the implementations can.
              Cameron Purdy
              [email protected]
              http://www.tangosol.com
              WebLogic Consulting Available
              "Richard Wu" <[email protected]> wrote in message
              news:[email protected]...
              > hi,
              >
              > Restart WL every time I modify my bean really drive me crazy!
              >
              > Following the manual, I set up my servletclasspath and put all the beans
              > I use in my jsp under that directory, I find out something strange:
              >
              > if my beans' scope is page and if I modify the jsp page as well every
              > time I modify the beans, I can autoload the fresh new beans without
              > restarting;
              > if my beans' scope is larger than page( such as session), then even I
              > modify the jsp, instead of the fresh new beans I get the following
              > exception:
              >
              > java.lang.ClassCastException: com.aa.mybean at
              > jsp_servlet._test._classquery._jspService(_mybean.java:81) at
              > weblogic.servlet.jsp.JspBase.service(JspBase.java:27) at
              >
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              :124)
              > at
              >
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
              l.java:760)
              > at
              >
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
              l.java:707)
              > at
              >
              weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
              Manager.java:251)
              > at
              >
              weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:369)
              > at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:269)
              > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled Code)
              >
              > who knows how to autoload the new session scope javabeans in a jsp page
              > without restarting WL?
              >
              > thanks in advance...
              >
              >
              

  • Calling JavaBean From JSP

    I wrote a very simple program to try to figure out how to use a javabean from multiple jsp pages. There are 2 jsps ("page1.jsp", "page2.jsp") and 1 bean ("TestBean.java"). The 1st JSP uses a bean called "myBean". It sets a value and successfully displays the value using the bean id ("myBean"). When I click the link to go to page2.jsp, however, I get a "cannot resolve symbol" error (italicized below). This error doesn't make sense to me because I set the bean to "session" scope and I never closed my browser during the session. I know I must be missing something very basic but I can't figure out what it is. Any help would be much appreciated!
    C:\jakarta-tomcat-5.0.18\work\Catalina\localhost\test\org\apache\jsp\page2_jsp.java:46: cannot resolve symbol
    symbol : variable myBean
    location: class org.apache.jsp.page2_jsp
    int beanInt = myBean.getMyInt();
    ^
    1 error
    Page1.jsp:
    <jsp:useBean id="myBean" scope="session" class="test.TestBean" />
    <jsp:setProperty name="myBean" property="myInt" value="99" />
    <html><head> <title></title></head><body>
    <% int someInt = myBean.getMyInt(); %>
    <%= "someInt = " + someInt %>
    <A href="page2.jsp">Continue</A>
    </body></html>-----------------------------------------------------------
    Page2.jsp:
    <html>
    <head><title></title></head><body>
    <%
         int beanInt = myBean.getMyInt();
    %>
    <%= "beanInt = " + beanInt %>
    </body></html>-----------------------------------------------------------
    TestBean.java:
    package test;
    public class TestBean {
         int myInt;
         public void setMyInt(int a) {
              myInt = a;
         public int getMyInt() {
              return myInt;

    Yes you set your bean to session scope,
    but you need to include the useBean statement on every
    page you want to use that bean in scriptlet code.
    <jsp:useBean id="myBean" scope="session"
    class="test.TestBean" />
    It worked, thanks! I have a follow-up question though:
    What if I decide in "page2.jsp" to change the definiton of my useBean statement (but NOT the "id")? For example, in "page2.jsp" what would the effect be if I wrote this statement (changes only in the scope of the bean)...
    <jsp:useBean id="myBean" scope="application" class="test.TestBean" />...or...
    <jsp:useBean id="myBean" scope="request" class="test.TestBean" />I chose those 2 scopes since one is broader and the other is "less broad". From the small amount of testing I've done it looks like any changes in the definition of the bean cause a new bean to be created (regardless of the "id" used). Does that sound correct to you or is there more to it than this? I just want to make sure I have the concept down. And, again, thanks very much for the help.

Maybe you are looking for

  • Importing to Specific Library

    I want to be able to import audiobooks into a audiobook file in my itunes library. I can only get the files to import into my music folder. Is there anyway to either import straight into the audiobooks folder or move from the music folder to the audi

  • Don't want cancellation of billing document to be cleared automaticly

    When I cancel an RV Billing document, and this document isn't cleared yet (in FI), the cancelationdocument is automatically booked in FI and cleared with the RV Billing document. I don't want this to happen because I have to send an overview of new n

  • Flash won't update for Firefox (works in IE)

    ok ok, im not the greatest when it comes to stuff like this, but here's my problem listening to music on myspace isn't really my #1 concern when getting on the computer, but adobe hasnt been updated for SO long now that it's getting old ive installed

  • What are the new tax patches to be attached for the FY 2008 in India....

    Hi Experts.... What are the new tax patches to be added for the tax calculations for the Financial year 2008.Please advice... regards, sai.

  • Samsung d357 bluetooth internet connect

    I'm trying to connect to the internet using PPP over a bluetooth connection to my phone. my phone is a Samsug d357 I can get the phone to start dialing, but the call always fails and the computer (an iBook running 10.4.7) says that no carrier was det