Javabeans and JSP

I am new to Beans and JSP. I would like to know how I can 'get' the resultset and output to a JSP? It would have a few records and each record will have field1,field2 and field3.
My question again: How to continue from here in Beans? How to write the code in JSP? Can anyone guide me with some simple codes as I would not be able to understand advance codes.
Thanks.
public String Login(String inputDep) throws SQLException
          String returnString = null;
          String dbUserid = "sa"; // Your Database user id
          String dbPassword = "" ; // Your Database password
          try
               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
               Connection con = DriverManager.getConnection("jdbc:odbc:test", dbUserid ,dbPassword);
               Statement stmt = con.createStatement();
               String sql= "select * from Product where dept = '"+inputDep+"'";
               ResultSet rs = stmt.executeQuery(sql);

You could also try to read the resultset in your bean.
like:
=========== Bean ===============
public class myClass
public AccountData Login(String name, String password)
AccountData data = new AccountData ();
data.setName (resultset.getString ("name"));
//other setter methods
return data;
// use inner class to store values
public class AccountData
    AccountData ()
    private String name = null;
    //further attributes
    pubilic String getName ()
        return name;
    void setName (String name)
        this.name = name;
    //further getter and setter
}=========== JSP ===============
<jsp:useBean id="myBean" scope="session" class="classes.BeanClass"/>
<% MyClass.AccountData data = myBean.Login (name, password); %>
Name : <%= data.getName () %>Note > means %>

Similar Messages

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

  • Java beans and JSP - Training

    Hi
    Does Sun or some other organization conduct any good workshops on Javabeans and jsp technology - hands on training like Microsoft products usually have. - Something like "devcon" ??
    Some people from our workplace have to have some urgent training on these technologies. Thanks in advance.
    Sue

    They sure do... http://courses.coreservlets.com/
    Don't really know how much or how often they offer these courses though.. looks like the guy might be free to do something soon. But to be honest, these courses basically run through the book. If your programmers have a decent background in Java, I'd say you could just as easily get away with getting some books (Profession JSP - Wrox press is amazing). I learned JSP in about 3 days of solid cramming.

  • An error when using JSP to activate connection between Javabean and MySQL

    I just input two paramenters in the input.htm, then click button 'submit' to
    run output.jsp, then activate adder.getSum(); This function is to add two
    number, save the sum to the MySQL database, and return the sum. I think the
    java code and jsp file are no problem. A guess it's the problem relating to
    the servlet engine trying to talk to the Javabean. Should I set some
    envirenment or other? Please take a look. If necessary, I will attach my jsp
    and java codes later.
    The error is as below:
    Apache Tomcat/4.0.1 - HTTP Status 500 - Internal Server Error
    type Exception report
    message Internal Server Error
    description The server encountered an internal error (Internal Server Error)
    that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException:
    at org.apache.jasper.runtime.JspRuntimeLibrary.internalIntrospecthelper(JspRuntimeLibrary.java:273)
    root cause org.apache.jasper.JasperException:
    at org.apache.jasper.runtime.JspRuntimeLibrary.convert(JspRuntimeLibrary.java:184)
    I just selected some. Thanks,

    Yes, I'd be curious to see your code. In principle that should work.
    -chicagoJava

  • JSP JavaBeans and Database

    i am wondering whats the "correct" or best way to connect to a DB using JavaBeans and using this in JSP pages?
    i read abt creating a SQL "Helper" class that has some functions like connect etc... but i am thinking its a bit confusing...
    if i have a function
        public static Statement Connect() {
            try {
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                con = DriverManager.getConnection("jdbc:odbc:auction","","");
                stmt = con.createStatement();
            } catch (SQLException e) {
                System.out.println("ERROR: SQLException occured!\n" + e.getMessage());
            } catch (Exception e) {
                System.out.println("ERROR: An Exception occured!\n" + e.getMessage());
           return stmt;
        }then i use it
    Statement stmt = SqlHelper.connect();when i want to close the connection how do i do it? is it a must to close connections anyway?
    or shld i do it the easy way, having the code
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con = DriverManager.getConnection("jdbc:odbc:auction","","");
    stmt = con.createStatement();on all JSP pages?
    Thank you

    BalusC wrote:Do it in the data layer. Write DAO classes and SQL helper classes. Then let the business layer, the Servlet, interact with the data layer and let the presentation layer, the JSP, display the results.
    And don't return a Statement, but a Connection. And yes, closing a Connection is a must, otherwise you're leaking resources which will cause your web application to crash due to a memory shortage.ya thats what i am trying to do... but how do i? like this? except i return a connection instead? and also, i shld return it by reference? mmm... in java isit like return &con?
    package AuctionSystem;
    import java.sql.*;
    public class SqlHelper {
        private static Connection con;
        private static Statement stmt;
        public SqlHelper() {
            Connection con = null;
            Statement stmt = null;
        public static void Connect() {
            try {
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                con = DriverManager.getConnection("jdbc:odbc:auction","","");
                stmt = con.createStatement();
            } catch (SQLException e) {
                System.out.println("ERROR: SQLException occured!\n" + e.getMessage());
            } catch (Exception e) {
                System.out.println("ERROR: An Exception occured!\n" + e.getMessage());
        public static Connection getCon() {
            return con;
        public static Statement getStmt() {
            return stmt;
        public static void Close() {
            con.close();
            stmt.close();
        public static String FormatString(String string) {
            return "'" + string + "'";
    }Edited by: iceangel89 on May 27, 2008 3:50 AM

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

  • What is a javabean and how to compose it?

    Q1:although have used many java class in jsp within tomcat, but i don't is it a standard javabean. I mean is any java class can be an javabean, or what is the different between javabean and java class.
    for now i found some problem with 'javabean' used in jsp.
    Q2:what is ther difference between use jsp:setProperty,jsp:getProperty and direct give value like 'myBean.variable=100'?
    thanks!

    javabeans are standard classes but have :
    - default constructor
    - getter and setter methods
    javabean can be used on custom tags, so no code on your jsp !
    why don't directly use attributes ?
    look this thread :
    http://forum.java.sun.com/thread.jsp?forum=45&thread=314643
    this is one, but it's not the only, reason.
    Regards.

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

  • How to master good design with EJB and JSP?

    I use JSP to calling EJB. But the .jsp file is complex and it's difficult to maintain...I just want to work higher efficent with EJB,JSP and JavaBean. I want to know is there a good design with EJB and JSP? and is there any good material about MVC for EJB,JSP and JavaBean?

    You should read the J2EE blueprint available on this website. Better download the PDF, and print it for yourself so you can read it anytime.

  • 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

  • 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

  • HELP PLASE ! JavaBean and Javascript in frames :)

    Hello,
    First please excuse me for my bad english I'm French think you in advance for your patience and your help ! :)
    To resum the problem :
    I have 2 frames, a menu frame and a main frame
    I use a javabean wich is saved in application variable.
    When the pages of main frame use the javabean there is no probleme.
    BUT when menu frame calls pages of main frame it don't restore the javabean, it looks like je page called by menu frame, which operates on the javabean, wasn't called, and the changes I do in this page aren't saved
    Menu frame uses javascript to calls main frame pages so I think the problem is conjonction of frame and javascript.
    But I have no choice because it's volonty of my boss, so please help me ! :)
    More precisly :
    the javabean : NavigationBean
    page frame menu : menu_page.jsp
    main pages which use javabean : pageA.jsp, pageB.jsp, pageC.jsp
    pageA.jsp has reference on pageB.jsp which has reference on pageC.jsp
    Traitement of the javabean NavigationBean in pageA.jsp, pageB.jsp and pageC.jsp :
    <jsp:useBean      id="gestionNavigation"
              class= "NavigationBean"          
              scope="application">                         
    </jsp:useBean>
    <jsp:setProperty      name="gestionNavigation"
                   property="request"
                   value="<%=request%>" />     
    (it needs response and request to run)
    <jsp:setProperty      name="gestionNavigation"
                   property="response"
                   value="<%=response%>" />
    <jsp:setProperty      name="gestionNavigation"
                   property="pageActuelle"
                   value="<%=urlActuelle%>" />
    (it saves in NavigationBean object the url where user is)
    In pageA I clean all NavigationBean so all pages saved are deleted
    if user go DIRECTLY on pageA.jsp, all is ok :
    user go on
         pageA -> pageB -> pageC
    and NavigationBean save
         pageA -> pageB -> pageC
    That's good ! :)
    BUT if after user go on menu frame it's wrong !
    user go on
         pageA -> pageB -> pageC -> menu_page.jsp -> pageA -> pageB
    BUT NavigationBean save
         pageA -> pageB -> pageC -> pageB
    instead of
         pageA -> pageB
    To resume, for NavigationBean when user go directly on main pages there is no problem, but when it uses menu frame it doesn't save that user go on pageA
    I clean NavigationBean on pageA, but instead of this problem it doesn't clean and retrieve old datas
    It looks like that when user uses menu FRAME it uses an old NavigationBean object, but when it go directly on pages of main frame it runs !
    And I use scope application so don't understand, I have tried session scope but no change :(
    I have tried using "response.encondeURL" but no change
    Think you in advance for your help, and good luck from Paris for all New York people ! :)
    David

    It sounds like what might be happening is when the user goes 'back' to the menu, they're not requesting the page from the server. So, they're either getting the old page cached by the browser. Maybe. If you reload the menu page manually, does it work?

  • What is the difference of using JavaBean and regular classes?

    Experts,
    I am new to JavaBean(not EJB), and wondering what is the difference of using JavaBean for JSP page compared with using regular Java class?
    I know there are Bean tags which save some lines, what else?
    What does "serialization" mean compared with "not serializable"?
    thanks very much.

    No.
    A JavaBean is a regular JavaClass that:
    1) implements java.io.Serializable
    2) Its data members are private, and its data is accessed via getters and setters. You must define the getters and setters. Getters retrive the property, and must be in the format:
    public PropertyType getPropertyName()
    for most cases. The exception is when the PropertyType is a boolean, in which case you use:
    public boolean isPropertyName()
    Setters assign values to the property, and are in the form:
    public void setPropertyName(PropertyType propValue)
    3) There is also a PropertyChangeEvent model that needs to be followed.
    A marker interface has no methods you need to implement. It just marks the class as supporting certain operations. In the case of Serializable, it means the class can be written to be an ObjectOutputStream for persistant storage.
    As far as an example of JavaBean persistance, take a search on the java.sun.com site for Serializeable
    Also, take a look at this: http://java.sun.com/developer/onlineTraining/Beans/beans02/
    It concentrates mainly on gui component beans, but not all beans need to be gui parts... There are other pages to look at, but I can't find them at the moment, and I have to run...

Maybe you are looking for

  • How do you get your IPHONE 4 off of earphone mode?

    I can't hear anything when I call people.  I have never used ear phones so I don't know how my phone got stuck in headset mode.  Can anyone help me get it out on this mode?  Thanks!!

  • Workflow Problem between  SRM & ECC

    Hi,   We are facing a typical scenario in the workflow for Purchase Requisition. System: 1.     SAP ECC 6.0 2.     SAP SRM 5.0 Problem Description: 1.     In our landscape, ECC is connected to SRM portal for creation of PRs through SRM. 2.     For th

  • Package access level

    hey, i have packages structures as cg.chart, cg.chart.data, cg.chart.graphic etc with classes in all the packages. Now, i also have a getObject() method in each class, but I don't want this method to be visible from outside the cg package...however,

  • Yahoo has taken over my browsers. how do I remove?

    As the titles say's. It started acouple of days ago, don't know where from. It's not just one browser but all. I'd appreciate any feed back. Cheers

  • Stars and rotation won't work

    I just started using CS5 and when I'm in Bridge and try to put a "star" filter on an image or rotate it, nothing happens.  The two two rotation arrows at the top are greyed out and when I try to click on a star (for a filter) nothing happens. This is