Books / literature on JSP/servets/beans

Hi,
Can some one suggest good books/web sites which talks about using JSP/Servlets/Beans in one application
Thanks
Raj

A good site I can think of is "Theserverside.com".

Similar Messages

  • Sample jsp servlet bean (MVC) code

    We want to look into the JSP/Servlet/Bean area for our next project. We wish to understand the technology and as such want to hand build simple applications, and as such do not want to use JDeveloper just yet.
    We have searched and searched for suitable material but cannot anywhere find a sample application that :
    A. Lists contents of a databse table
    B. Each item in trhe list is a link to a page that allows that item, to be edited.
    C. A new item can be added.
    D. Uses the MVC model of JSP/Servlet and bean (preferably with no custom tags)
    There are examples that are too simplistic and do not cover the whole picture. Having spent over 100 GBP on books lately, only to be disappointed with the examples provided, we need to see some sample code.
    The samples provided by Oracle are too simplistic. They should really have provided ones built around the EMP and DEPT tables.
    Anyone know where we can get hold of this sample code.

    At the risk of sounding really dumb the examples are just too complex. There does not appear to be anywhere on the web where I can find a simple JSP/servlet/bean example of the type I described. There is enouigh material describing each individual component, but what I need is an example to cement the ideas, but the ones suggested are too much for a newbie. Even the much vaunted Pet Store thingy causes my eyes to glaze over.
    I dont expect anyone to have written something with my exact requirements, but surely to goodness there must be something that:
    1. On entry presents a search form on a table (e.g. EMP)
    2. On submission list all rows in EMp matchiung the criteria.
    3. The user can either click the link 'Edit' which opens up a form dispalying the row allowing the user to edit and save the changes, or click the 'New' button to show a blank form to create a new EMP.
    All this via a Controller servlet, with the database logic handled by a java bean, and all the presentation done via JSP.
    To me this is the most obvious and instructive example of this technology, but after days of trawling the web, and looking through a number of books, I cannot find such a thing.
    CGI with Perl DBI/DBD was a breeze to work with compared to this stuff ..... maybe ASP with SQL/Server would be a more fruitful use of time.

  • How to convert the source code in JSP,HTML&BEANS into executable files?

    Sir,
    We are developing one s/w product in JSP,HTML&BEANS.Now we are in the implementation phase.During the time of Installation,without copying our source code in the customer's site I want to copy the executable files of the entire source codes? Is it possible in JSP,HTML&BEANS?

    In theory you can do it even with JSP but the you will be unable to run it on the standard JSP engine. :-)
    From other hand, all critical logic should be in the Java Beans or at least in custom tags but not in the JSP code. Then you can protect that code and leave JSP open because there is nothing to steal or break.

  • WLS 8.1 sp1 with Struts 1.1 JSP with bean tag won't compile

              Hello,
              We are currently porting our application which uses struts 1.1 to WLS 8.1 sp1
              from another app server. Everything seems to deploy correctly and pages which
              use struts tags appear to compile and run fine. However, the pages with struts
              <bean:define> tags are not compiling.
              Example JSP Code:
              <bean:define id="userForm" name="userForm" scope="session" toScope="page" type="UserFormBean"/>
              <% if (userForm.hasUserData()) {hasUser=true;} %>
              WLS Console Output:
              ..jsp_servlet\_jsp\_sailor\__home.java:493: cannot resolve symbol
              symbol : variable userForm
              location: class jsp_servlet._jsp._sailor.__home
              if (userForm.hasUserData()) { //[ /jsp/sailor/home.jsp; Line: 38]
              When I look at the JSP's parsed java code (__home.java:493) I find that nowhere
              in the class is the variable userForm declared.
              Is this a bug in WLS? Does anyone know of a workaround?
              Thanks,
              Scott
              

    Please contact customer support [email protected] and request a patch for
              CR112789. AT_END tags do not work correctly in 81sp1
              --Nagesh
              "Scott Fleming" <[email protected]> wrote in message
              news:3f734c0d$[email protected]..
              >
              > Hello,
              >
              > We are currently porting our application which uses struts 1.1 to WLS 8.1
              sp1
              > from another app server. Everything seems to deploy correctly and pages
              which
              > use struts tags appear to compile and run fine. However, the pages with
              struts
              > <bean:define> tags are not compiling.
              >
              > Example JSP Code:
              >
              > <bean:define id="userForm" name="userForm" scope="session" toScope="page"
              type="UserFormBean"/>
              >
              > <% if (userForm.hasUserData()) {hasUser=true;} %>
              >
              > WLS Console Output:
              >
              > ..jsp_servlet\_jsp\_sailor\__home.java:493: cannot resolve symbol
              > symbol : variable userForm
              > location: class jsp_servlet._jsp._sailor.__home
              > if (userForm.hasUserData()) { //[ /jsp/sailor/home.jsp; Line:
              38]
              >
              > When I look at the JSP's parsed java code (__home.java:493) I find that
              nowhere
              > in the class is the variable userForm declared.
              >
              > Is this a bug in WLS? Does anyone know of a workaround?
              >
              > Thanks,
              > Scott
              

  • JSP- Servlet-- Bean-- JSP how to implement

    I have problem.
    My JSP will take a emplyee id .
    Now I want to show all the values regarding that employee in a JSP(JSP form) from the DB(Oracle).
    So Iam planning like
    JSP-->Servlet-->Bean-->JSP
    So my doubts are.
    1. Is it correct approach
    2.If it is correct then which part of the flow connects to DB and stores the value before putting to JSP.
    Iam using Tomcat 4.31
    Plz help me

    I have problem.
    My JSP will take a emplyee id .
    Now I want to show all the values regarding that
    employee in a JSP(JSP form) from the DB(Oracle).
    So Iam planning like
    JSP-->Servlet-->Bean-->JSP
    So my doubts are.
    1. Is it correct approach
    2.If it is correct then which part of the flow
    connects to DB and stores the value before putting to
    JSP.
    Iam using Tomcat 4.31
    Plz help meHI
    What you are probably proposing is an MVC design pattern. I wonder if u have heard of the struts framework. Sruts uses MVC design pattern wherein the servlet u are talking about acts as a controller(C) and the bean acts as the model(M) .The JSPs present the view(V). Hence the name MVC.
    Your approach is right. First get the employee ID from the jsp and get the corresponding data from database(This logic u implement in the servlet). Then save the fetched data in a bean so that the result jsp can fetch data from it.
    Now this is not a strict MVC approach.
    Learn more about struts. It presents a much more cleaner solution.

  • JSP Accesing Bean Problem

    I need a help in this jsp and bean Please provide the solution
              This is the bean
              import java.text.*;
              import java.util.*;
              import java.io.Serializable;
              public class DateBean implements Serializable {
              public DateBean() {}
              SimpleDateFormat sdf;
              public void setFormat(String format) {
              sdf = new SimpleDateFormat(format);
              public String getCurrentTime() {
              return sdf.format(new Date());
              This is the date.jsp
              <html>
              <head>
              <title>A JSP that sets a property</title>
              </head>
              <body>
              The current time and date, in several formats, courtesy
              a bean:<p>
              <!-- begin example -->
              <jsp:useBean
              id="date"
              class="DateBean"/>
              <ul>
              <jsp:setProperty name="date" property="format"
              value="EEEE, MMMM dd yyyy 'at' hh:mm"/>
              <li><jsp:getProperty name="date" property="currentTime"/>
              <jsp:setProperty name="date" property="format"
              value="hh:mm:ss MM/dd/yy"/>
              <li><jsp:getProperty name="date" property="currentTime"/>
              <jsp:setProperty name="date" property="format"
              value="yyyyy.MMMMM.dd GGG hh:mm aaa"/>
              <li><jsp:getProperty name="date" property="currentTime"/>
              </ul>
              <!-- end example -->
              </body>
              </html>
              AND THIS is the compilation error
              Error: [jspc]: 1 file(s) failed:
              /dates.jsp
              [Compilation errors : ]
              E:\DateBean\__dates.java:134: cannot resolve symbol
              symbol : class DateBean
              location: class jsp_servlet.__dates
              DateBean date = null; //[ /dates.jsp; Line: 13]
              ^
              E:\DateBean\__dates.java:135: cannot resolve symbol
              symbol : class DateBean
              location: class jsp_servlet.__dates
              date = (DateBean)pageContext.getAttribute("date"); //[ /dates.jsp; Line: 13]
              ^
              E:\DateBean\__dates.java:138: cannot resolve symbol
              symbol : class DateBean
              location: class jsp_servlet.__dates
              date = (DateBean)pageContext.getAttribute("date"); //[ /dates.jsp; Line: 13]
              ^
              E:\DateBean\__dates.java:140: cannot resolve symbol
              symbol : class DateBean
              location: class jsp_servlet.__dates
              date = new DateBean(); //[ /dates.jsp; Line: 13]
              ^
              4 errors
                   at weblogic.jspc.doCompile(Ljava.lang.String;Ljava.util.List;Lweblogic.utils.Getopt2;ZLjava.lang.String;)V(jspc.java:839)
                   at weblogic.jspc.runJspc(Lweblogic.utils.classloaders.GenericClassLoader;Ljava.io.File;Ljava.util.Map;Z)V(jspc.java:632)
                   at weblogic.jspc.runBodyInternal()V(jspc.java:410)
                   at weblogic.jspc.runBody()V(jspc.java:319)
                   at weblogic.utils.compiler.Tool.run([Ljava.lang.String;)V(Tool.java:146)
                   at weblogic.utils.compiler.Tool.run()V(Tool.java:103)
                   at weblogic.jspc.main([Ljava.lang.String;)V(jspc.java:708)
              java.lang.Exception: [Compilation errors : ]
              E:\DateBean\__dates.java:134: cannot resolve symbol
              symbol : class DateBean
              location: class jsp_servlet.__dates
              DateBean date = null; //[ /dates.jsp; Line: 13]
              ^
              E:\DateBean\__dates.java:135: cannot resolve symbol
              symbol : class DateBean
              location: class jsp_servlet.__dates
              date = (DateBean)pageContext.getAttribute("date"); //[ /dates.jsp; Line: 13]
              ^
              E:\DateBean\__dates.java:138: cannot resolve symbol
              symbol : class DateBean
              location: class jsp_servlet.__dates
              date = (DateBean)pageContext.getAttribute("date"); //[ /dates.jsp; Line: 13]
              ^
              E:\DateBean\__dates.java:140: cannot resolve symbol
              symbol : class DateBean
              location: class jsp_servlet.__dates
              date = new DateBean(); //[ /dates.jsp; Line: 13]
              ^
              4 errors
                   at weblogic.jspc.doCompile(Ljava.lang.String;Ljava.util.List;Lweblogic.utils.Getopt2;ZLjava.lang.String;)V(jspc.java:842)
                   at weblogic.jspc.runJspc(Lweblogic.utils.classloaders.GenericClassLoader;Ljava.io.File;Ljava.util.Map;Z)V(jspc.java:632)
                   at weblogic.jspc.runBodyInternal()V(jspc.java:410)
                   at weblogic.jspc.runBody()V(jspc.java:319)
                   at weblogic.utils.compiler.Tool.run([Ljava.lang.String;)V(Tool.java:146)
                   at weblogic.utils.compiler.Tool.run()V(Tool.java:103)
                   at weblogic.jspc.main([Ljava.lang.String;)V(jspc.java:708)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    I just wanted to say THANK YOU! This stuff can be a real pain when all the documentation shows everything should be working but it doesn't.
    I will pass on this little piece of info to the next confused person.
    shoot me an e-mail sometime [email protected]

  • Do all JSP/Java bean webapps need an xml file?

    Hi all,
    I have a jsp/ java bean webb application. This is being run on Resin at
    Lunarpages.
    The site has been shut down due to 'class-loader' not found. I was told it
    was causing problems for other java users on the server.
    I realise this is limited information but any insight would be welcome.
    This is our first JSP / java bean web app.
    Also if anyone could tell me briefly the purpose of an xml document in a JSP/Java bean webapplication I would greatly appreciate it.
    Thanks in advance
    Regards
    Jim

    Hi there,
    Thanks for the reply.
    Our application allows people to purchase wedding pictures online. It ran locally on resin we then had to change all the relative file paths in order to deploy it on lunarpages.
    Lunarpages use resin also.
    We had the application tested and working on Lunarpages for the last week .This morning they sent us a message saying they had shut our JSP pages down as our application was causing problems for other java users. errant code unknown element ' class-loader' .
    Not too much help from lunarpages...
    thanks

  • How can write string in jsp on beans..

    Hello.
    My English ability very poor sorry....
    I am developing jsp using beans..
    I want to see value on beans....
    but I can't see....
    I want to check my values...
    plz help me....
    how can I view my String , int... on the beans....

    Write a "getter" method for each variable you want to be able to read in the JSP.
    example:
    public class yourBean
    // ... some code, contructor, etc...
    private String yourVariable;
    public void setYourVariable(String s)
    yourVariable = s ;
    public String getYourVariable()
    return yourVariable ;
    You can retrieve the value in your jsp with any of these ways:
    1) use the <jsp:getProperty> tag
    2) <%= yourBean.getYourVariable() %>
    3) <% String s = yourBean.getYourVariable() %>
    }

  • Please recommend IDE for JSP and Beans

    Hi guys,
    I am looking for a decent IDE to work with JSP and Beans. I have tried JBuilder which has too much going on at the same time and I find it to be an overkill for what I am doing; I find NetBeans kind of irritating. I develop web applications, hence I dont need any GUI stuff for beans.
    Just looking for something that will enable me to rapidly develop beans as a support system for JSP pages and at the same time, it should provide good support for coding JSP pages. Little bit of management functions wont hurt either, but are not required. I dont mind if I have to pay for the IDE. Any recommendations?

    I like Eclipse for Java Development, and I use the MyEclipse plug-in for J2EE development.
    There is a free J2EE plug-in (Lomboz) but I'd much rather pay the $29.99/year for MyEclipse. It's been perfect for me.

  • Jsp-servlet-bean problem

    Please help!
    I have a servlet controller, a javabean for the data and a jsp for the view.
    I cannot get the jsp using
    <jsp:useBean id="pList" class="bbs.PostListCommand" scope="request" />
    to access the bean data
    However, when I access the bean in this way
    <%@ page import="bbs.PostListCommand" %>
    // html
    <% bbs.PostListCommand postList = null;
    synchronized(session){
         postList = (bbs.PostListCommand) session.getAttribute("PostListCommand");
         if (postList == null){ %>
              <H1>Nothing in request scope to retrieve ....</H1>
              <P>
    <%     }
         else{  %>
              <TABLE border="1">
    // etc
    � it works
    Does anyone know why the <jsp:useBean> tag does not find the bean
    I have installed tomcat 4.18 and set the environmental variables etc.
    Directory structure is
    E:\Tomcat41\webapps\examples\WEB-INF\jsp          for jsp�s
    E:\Tomcat41\webapps\examples\WEB-INF\classes\bbs     for bean and servlets
    Thanks in advance for any help.
    Chris

    GrayMan - Thanks for your help.
    Let me explain my problem in more detail ...
    Background:
    I have some servlet experience, but I am new to jsp - so sorry if this seems trivial to you ...
    I have a book called bitter java by bruce tate from manning.com . I am trying to get the chapter 3 examples to work
    There are three files
    PostListCommand          the bean
    PostListController     the servlet
    PostListResults          jsp
    And a new test file � PostListResults version 2 with scriptlet code to access the bean.
    There are a couple of typos in the downloaded source files, but nothing that causes the main problem of not being able to access the bean data.
    Program flow
    Servlet instantiates new bean
    Bean � gets data from db
    Servlet passes bean to jsp with a forward
    Jsp outputs data
    I have put the files in the directories �
    E:\Tomcat41\webapps\examples\WEB-INF\jsp          for jsp�s
    E:\Tomcat41\webapps\examples\WEB-INF\classes\bbs     for bean and servlets
    The complete source code for each file is given below.
    1 I have checked the db access � that�s ok
    2 I have also checked reading the bean data back in from the request scope and printing out the results from within the servlet.- ok
    3 I can access the data through a scriptlet (PostListResults version 2), but not with the original PostListResults which uses <jsp:useBean>
    thanks in advance, chris
    PostListController.java
    package bbs;
    // Imports
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    // Import for commands used by this class
    import bbs.PostListCommand;
    public class PostListController
    extends javax.servlet.http.HttpServlet
    implements Serializable {
    * DoGet
    * Pass get requests through to PerformTask
    public void doGet(
    HttpServletRequest request,
    HttpServletResponse response)
    throws javax.servlet.ServletException, java.io.IOException {
    performTask(request, response);
    public void performTask(
    HttpServletRequest request,
    HttpServletResponse response) {
    try {
    PostListCommand postList = (bbs.PostListCommand) java.beans.Beans.instantiate(getClass().getClassLoader(),"bbs.PostListCommand");
    postList.initialize();
    postList.execute();
    request.setAttribute("PostListCommand", postList);
    ServletContext sc = this.getServletContext();
    RequestDispatcher rd =
    sc.getRequestDispatcher("/jsp/PostListResults.jsp");
    rd.forward(request, response);
    } catch (Throwable theException) {
    theException.printStackTrace();
    PostListCommand.java
    package bbs;
    import java.io.*;
    import java.sql.*;
    //import COM.ibm.db2.jdbc.*;
    import java.util.*;
    * Insert the type's description here.
    * Creation date: (07/17/2001 5:07:55 PM)
    * @author: Administrator
    public class PostListCommand {
    // Field indexes for command properties     
    private static final int SUBJECT_COLUMN = 1;
    private static final int AUTHOR_COLUMN = 2;
    private static final int BOARD_COLUMN = 3;
    protected Vector author = new Vector();
    protected Vector subject = new Vector();
    protected Vector board = new Vector();
    // SQL result set
    protected ResultSet result;
    protected Connection connection = null;
    * execute
    * This is the work horse method for the command.
    * It will execute the query and get the result set.
    public void execute()
    throws
    java.lang.Exception,
    java.io.IOException {
    try {
    // retrieve data from the database
    Statement statement = connection.createStatement();
    result =
    statement.executeQuery("SELECT subject, author, board from posts");
    while (result.next()) {
    subject.addElement(result.getString(SUBJECT_COLUMN));
    author.addElement(result.getString(AUTHOR_COLUMN));
    board.addElement(result.getString(BOARD_COLUMN));
    result.close();
    statement.close();
    } catch (Throwable theException) {
    theException.printStackTrace();
    * getAuthor
    * This method will get the author property.
    * Since the SQL statement returns a result set,
    * we will index the result.
    public String getAuthor(int index)
    throws
    java.lang.IndexOutOfBoundsException,
    java.lang.ArrayIndexOutOfBoundsException {
    return (String) author.elementAt(index);
    * getBoard
    * This method will get the board property.
    * Since the SQL statement returns a result set,
    * we will index the result.
    public String getBoard(int index)
    throws
    java.lang.IndexOutOfBoundsException,
    java.lang.ArrayIndexOutOfBoundsException {
    return (String) board.elementAt(index);
    * getSubject
    * This method will get the subject property.
    * Since the SQL statement returns a result set,
    * we will index the result.
    public String getSubject(int index)
    throws
    java.lang.IndexOutOfBoundsException,
    java.lang.ArrayIndexOutOfBoundsException {
    return (String) subject.elementAt(index);
    * initialize
    * This method will connect to the database.
    public void initialize()
    throws java.io.IOException {
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    // URL is jdbc:db2:dbname
    String url = "jdbc:db2:board";
    // URL is jdbc:odbc:bitter3board
    String url = "jdbc:odbc:bitter3board";
    // connect with default id/password
    connection = DriverManager.getConnection(url);
    } catch (Throwable theException) {
    theException.printStackTrace();
    * Insert the method's description here.
    * Creation date: (07/17/2001 11:38:44 PM)
    * @return int
    * @exception java.lang.IndexOutOfBoundsException The exception description.
    public int getSize() {
    return author.size();
    PostListResults.jsp
    <HTML>
    <HEAD>
    <TITLE>Message Board Posts</TITLE>
    </HEAD>
    <BODY BGCOLOR=#C0C0C0>
    <H1>All Messages</H1>
    <P>
    <jsp:useBean id="postList" class="bbs.PostListCommand" scope="request"></jsp:useBean>
    <TABLE border="1">
    <TR>
    <TD>Subject</TD>
    <TD>Author</TD>
    <TD>Board</TD>
    </TR>
    <% for (int i=0; i < postList.getSize(); _i++) { %>
    <TR> <TD><%=postList.getSubject(_i) %></TD>
    <TD><%=postList.getAuthor(_i) %></TD>
    <TD><%=postList.getBoard(_i) %></TD>
    </TR>
    <% } %>
    </TABLE>
    <P>
    </BODY>
    </HTML>
    PostListResults.jsp version 2 � with scriplet code instead of useBean
    <HTML>
    <%@ page import="bbs.PostListCommand" %>
    <!-- This file was generated by the chris -->
    <HEAD>
    <TITLE>Message Board Posts</TITLE>
    </HEAD>
    <BODY BGCOLOR=#C0C0C0>
    <% bbs.PostListCommand postList = null;
    synchronized(request){
         postList = (bbs.PostListCommand) request.getAttribute("PostListCommand");
         if (postList == null){ %>
              <H1>Nothing in request scope to retrieve ....</H1>
              <P>
    <%     }
         else{  %>
              <TABLE border="1">
              <TR>
              <TD>Subject</TD>
              <TD>Author</TD>
              <TD>Board</TD>
              </TR>
         <% for (int i=0; i < postList.getSize(); _i++) { %>
                   <TR> <TD><%=postList.getSubject(_i) %></TD>
              <TD><%=postList.getAuthor(_i) %></TD>
              <TD><%=postList.getBoard(_i) %></TD>
              </TR>
         <% } %>
              </TABLE>
    <%     }
    }%>
    <P>
    goodnight
    </BODY>
    </HTML>

  • Need help with JSP - Session Bean scenario

    I have massive problems with a simple JSP <--> Statefull Session Bean scenario with Server Platform Edition 8.2 (build b06-fcs)
    What I do is generating a Collection in session bean returning it to JSP
    and giving the List back to Session Bean.
    A weird exception happens when giving the List back to Session Bean
    (see Exception details below)
    The same code runs without any trouble on Jboss Application Server 4.0.3
    Any help would be great!
    Please see code below
    Statefull Session Bean
    <code>
    package ejb;
    import data.Produkt;
    import java.util.ArrayList;
    import java.util.Collection;
    import java.util.Iterator;
    import javax.ejb.*;
    * This is the bean class for the WarenkorbBean enterprise bean.
    * Created 17.03.2006 09:53:25
    * @author Administrator
    public class WarenkorbBean implements SessionBean, WarenkorbRemoteBusiness, WarenkorbLocalBusiness {
    private SessionContext context;
    // <editor-fold defaultstate="collapsed" desc="EJB infrastructure methods. Click the + sign on the left to edit the code.">
    // TODO Add code to acquire and use other enterprise resources (DataSource, JMS, enterprise bean, Web services)
    // TODO Add business methods or web service operations
    * @see javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext)
    public void setSessionContext(SessionContext aContext) {
    context = aContext;
    * @see javax.ejb.SessionBean#ejbActivate()
    public void ejbActivate() {
    * @see javax.ejb.SessionBean#ejbPassivate()
    public void ejbPassivate() {
    * @see javax.ejb.SessionBean#ejbRemove()
    public void ejbRemove() {
    // </editor-fold>
    * See section 7.10.3 of the EJB 2.0 specification
    * See section 7.11.3 of the EJB 2.1 specification
    public void ejbCreate() {
    // TODO implement ejbCreate if necessary, acquire resources
    // This method has access to the JNDI context so resource aquisition
    // spanning all methods can be performed here such as home interfaces
    // and data sources.
    // Add business logic below. (Right-click in editor and choose
    // "EJB Methods > Add Business Method" or "Web Service > Add Operation")
    public Collection erzeugeWarenkorb() {
    //TODO implement erzeugeWarenkorb
    ArrayList myList = new ArrayList();
    for (int i=0;i<10;i++)
    Produkt prod = new Produkt();
    prod.setID(i);
    prod.setName("Produkt"+i);
    myList.add(prod);
    return myList;
    public void leseWarenkorb(Collection Liste) {
    //TODO implement leseWarenkorb
    Iterator listIt = Liste.iterator();
    while(listIt.hasNext())
    Produkt p = (Produkt)listIt.next();
    System.out.println("Name des Produktes {0} "+p.getName());
    </code>
    <code>
    package data;
    import java.io.Serializable;
    * @author Administrator
    public class Produkt implements Serializable {
    private int ID;
    private String Name;
    /** Creates a new instance of Produkt */
    public Produkt() {
    public int getID() {
    return ID;
    public void setID(int ID) {
    this.ID = ID;
    public String getName() {
    return Name;
    public void setName(String Name) {
    this.Name = Name;
    </code>
    <code>
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@page import="java.util.*"%>
    <%@page import="data.*"%>
    <%@page import="javax.naming.*"%>
    <%@page import="javax.rmi.PortableRemoteObject"%>
    <%@page import="ejb.*"%>
    <%--
    The taglib directive below imports the JSTL library. If you uncomment it,
    you must also add the JSTL library to the project. The Add Library... action
    on Libraries node in Projects view can be used to add the JSTL 1.1 library.
    --%>
    <%--
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    --%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    </head>
    <body>
    <h1>Online Shop Warenkorb Test</h1>
    <%--
    This example uses JSTL, uncomment the taglib directive above.
    To test, display the page like this: index.jsp?sayHello=true&name=Murphy
    --%>
    <%--
    <c:if test="${param.sayHello}">
    <!-- Let's welcome the user ${param.name} -->
    Hello ${param.name}!
    </c:if>
    --%>
    <%
    Context myEnv = null;
    WarenkorbRemote wr = null;
    // Context initialisation
    try
    myEnv = (Context)new javax.naming.InitialContext();
    /*Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
    //env.put(Context.PROVIDER_URL, "jnp://wotan.activenet.at:1099");
    env.put(Context.PROVIDER_URL, "jnp://localhost:1099");
    env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
    myEnv = new InitialContext(env);*/
    catch (Exception ex)
    System.err.println("Fehler beim initialisieren des Context: " + ex.getMessage());
    // now lets work
    try
    Object ref = myEnv.lookup("ejb/WarenkorbBean");
    //Object ref = myEnv.lookup("WarenkorbBean");
    WarenkorbRemoteHome warenkorbrhome = (WarenkorbRemoteHome)
    PortableRemoteObject.narrow(ref, WarenkorbRemoteHome.class);
    wr = warenkorbrhome.create();
    ArrayList myList = (ArrayList)wr.erzeugeWarenkorb();
    Iterator it = myList.iterator();
    while(it.hasNext())
    Produkt p = (Produkt)it.next();
    %>
    ProduktID: <%=p.getID()%><br></br>Produktbezeichnung:
    <%=p.getName()%><br></br><%
    wr.leseWarenkorb(myList);
    catch(Exception ex)
    %><p style="color:red">Onlineshop nicht erreichbar</p><%=ex.getMessage()%>
    <% }
    %>
    </body>
    </html>
    </code>
    the exception
    CORBA MARSHAL 1398079745 Maybe; nested exception is: org.omg.CORBA.MARSHAL: ----------BEGIN server-side stack trace---------- org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 257 completed: Maybe at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:8101) at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1013) at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:879) at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_abstract_interface(CDRInputStream_1_0.java:873) at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_abstract_interface(CDRInputStream_1_0.java:863) at com.sun.corba.ee.impl.encoding.CDRInputStream.read_abstract_interface(CDRInputStream.java:275) at com.sun.corba.ee.impl.io.IIOPInputStream.readObjectDelegate(IIOPInputStream.java:363) at com.sun.corba.ee.impl.io.IIOPInputStream.readObjectOverride(IIOPInputStream.java:526) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:333) at java.util.ArrayList.readObject(ArrayList.java:591) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.sun.corba.ee.impl.io.IIOPInputStream.invokeObjectReader(IIOPInputStream.java:1694) at com.sun.corba.ee.impl.io.IIOPInputStream.inputObject(IIOPInputStream.java:1212) at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:400) at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:330) at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:296) at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1034) at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:259) at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl$14.read(DynamicMethodMarshallerImpl.java:333) at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl.readArguments(DynamicMethodMarshallerImpl.java:393) at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:121) at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:648) at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:192) at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1709) at com.sun.corba.ee.impl.protocol.SharedCDRClientRequestDispatcherImpl.marshalingComplete(SharedCDRClientRequestDispatcherImpl.java:155) at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.invoke(CorbaClientDelegateImpl.java:184) at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:129) at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:150) at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(Unknown Source) at ejb._WarenkorbRemote_DynamicStub.leseWarenkorb(_WarenkorbRemote_DynamicStub.java) at org.apache.jsp.index_jsp._jspService(index_jsp.java:122) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:105) at javax.servlet.http.HttpServlet.service(HttpServlet.java:860) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:336) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:297) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:247) at javax.servlet.http.HttpServlet.service(HttpServlet.java:860) at sun.reflect.GeneratedMethodAccessor96.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAsPrivileged(Subject.java:517) at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282) at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257) at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55) at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161) at java.security.AccessController.doPrivileged(Native Method) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:189) at com.sun.enterprise.web.connector.grizzly.ProcessorTask.doProcess(ProcessorTask.java:604) at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:475) at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:371) at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:264) at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:281) at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:83) Caused by: java.lang.ClassNotFoundException ... 69 more ----------END server-side stack trace---------- vmcid: SUN minor code: 257 completed: Maybe

    Hi,
    I have found a way out by passing the reference of my EJB in the HttpSession object and using it inside the javabean..

  • Column Not found error while trying to access databse through JSP+Java Bean

    I am trying to acees MS Access 2003 db through JSP using Tomcat 5.0.28.The code for accessing the databse is incorporated in the bean.The jsp only calls the particular method of the bean .
    Code for Java Bean:
    package ActiveViewer;
    import java.sql.*;
    import java.util.*;
    public class CompanyBean
    Connection con;
    ResultSet rs=null;
    Statement st;
         public CompanyBean(){}
         public void connect()
         try
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    System.out.println("Here4");
    con=DriverManager.getConnection("jdbc:odbc:activeviewer","","");
         System.out.println("Here1");
         catch (ClassNotFoundException e)
         System.out.println("Could not locate driver.");
    catch (SQLException e)
    System.out.println("An SQL Exception has occured :: "+e);
         e.printStackTrace();
         catch (Exception e)
    System.out.println("An unknown Exception has occured :: "+e);
         e.printStackTrace();
    public void disconnect()
         try
         if (con!=null)
    con.close();
         catch (SQLException e)
    System.out.println("An SQL Exception has occured :: "+e);
         e.printStackTrace();
    public ResultSet select(String username)
    if(con!=null)
         try
    st=con.createStatement();
         rs=st.executeQuery("select * from company where username='" + username + "'");
    catch (SQLException e)
    System.out.println("An SQL Exception has occured :: "+e);
         e.printStackTrace();
    catch (Exception e)
    System.out.println("An Exception has occured while retrieving :: "+e);
    e.printStackTrace();
    else
    System.out.println("Connection to database was lost.");
    return rs;
    The code for JSP that uses the above bean is:
    <%@ page language="java" import="java.sql.*,ActiveViewer.* " contentType="text/html"%>
    <jsp:useBean id="conn" scope="session" class="ActiveViewer.CompanyBean" />
    <html>
    <body>
    <% String username=request.getParameter("username");
    String password=request.getParameter("password");
    System.out.println("username:"+username);
    System.out.println("password:"+password);
    conn.connect();
    ResultSet rs=conn.select(username);
    System.out.println("Below select ");
    while (rs.next())
    String dbusername=rs.getString("username");
         String dbpassword=rs.getString("password");
         if(dbusername.equals(username) && dbpassword.equals (password))
    { %> out.println("OK");
              <% }
    else { %>Invalid Username and / or Password.
    <br>Clickhere to go back to Login Page.
    <% }
    } %>
    </body>
    </html>
    I get the following error:
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Column not found
    though the database is not int he same folder as the jsp, the DSN is set correctly to pint to the db location.The jsp does print in stdout file:
    Here4 (from connect method above)
    Here 1 (from connect method above)
    Below Select (from jsp)
    This means that the jsp does connect to db but it gives the above error.Also the field name also matches that in the database and data is present in the db too.
    All other things like creating package for bean,incorporating the packakage are done.
    Can someone please help me with their precious advice?

    U're getting this error because there is no field called 'password' in ur database, the field in ur database is named 'cpassword' and not 'password'. So change the statement rs.getString("password"); to rs.getString("cpassword");

  • Jsp, servlet & bean: trying to display records in a jsp

    Hello i'm trying to display records from my MYSQL database into particular fields allready designed in a jsp. Via servlets and beans i want the records in a jsp.
    I can get the resultset of the record, but can't get the resultset in de fields of the jsp.
    Here are my files:
    SERVLET
    package ...;
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public class Zoekklantactie extends HttpServlet {
         ZoekklantBean ZoekklantBean = new ZoekklantBean();
         ZoekklantactieBean ZoekklantactieBean = new ZoekklantactieBean();
         DbBean db = new DbBean();
         public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException
              verwerk(request, response);
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException
         verwerk(request, response);
    public void verwerk(HttpServletRequest request, HttpServletResponse response) throws IOException {
         response.setContentType("text/html");
              PrintWriter out = response.getWriter();
              String hachternaam = request.getParameter("hachternaam");
              String zoekklantnieuw = "SELECT hachternaam FROM klantgegevens WHERE hachternaam = ";
              String zoekklantnieuw2 = zoekklantnieuw + " '"+hachternaam+"' ";
              ResultSet rs = null;
                   //     out.println("debug 1<br>");
         /*     try {
                   //     Statement s;
                        db.connect();
                   //     s = db.getS();
                        rs = db.execSQL("SELECT hachternaam FROM klantgegevens WHERE hachternaam = 'Opgelder'");
                   //          out.println(rs.getString(1)+"hoi");
                        while (rs.next()) {
                   //                retrieve and print the values for the current row
                   //          out.println("debug1a --> "+rs.toString()+"<br>");
                             String str = rs.getString(1);
                   //          out.println("ROW = " + str );
                        } catch (SQLException e) {
                   //                TODO Auto-generated catch block
                   //          out.println("debug2 <br>"+e.toString());
                             e.printStackTrace();
                        } catch (ClassNotFoundException e) {
                   //                TODO Auto-generated catch block
                   //          out.println("debug3 <br>");
                             e.printStackTrace();
         /* ResultSet rs = null;
         out.println("debug 1<br>");
              try {
                   //     Statement s;
                   db.connect();
                   //     s = db.getS();
                   rs = db.execSQL("select * from klantgegevens where hachternaam = 'Opgelder'");
                   //          out.println(rs.getString(1)+"hoi");
                   while (rs.next()) {
                        rs.first();
                   //           retrieve and print the values for the current row
                        out.println("debug1a<br>");
                        String str = rs.getString(1);
                        System.out.println("ROW = " + str );
                   rs = (ResultSet) db.execSQL(zoekklantnieuw2);
                   out.print(rs.getString("hwoonplaats"));
                   out.print(zoekklantnieuw2);
              } catch (SQLException e) {
                   //                TODO Auto-generated catch block
                   out.println("debug2 <br>"+e.toString());
                   e.printStackTrace();
              } catch (ClassNotFoundException e) {
                   //                TODO Auto-generated catch block
                   out.println("debug3 <br>");
                   e.printStackTrace();
              if( hachternaam == "" ){
                   request.setAttribute("jesper",ZoekklantBean);
                   //          Get dispatcher with a relative URL
                   RequestDispatcher dis = request.getRequestDispatcher("Zoekklant.jsp");
                   //           include
                   try {
                        dis.include(request, response);
                   } catch (ServletException e) {
                        e.printStackTrace();
                   } catch (IOException e) {
                        e.printStackTrace();
                   //          or forward
                   try {
                        dis.forward(request, response);
                   } catch (ServletException e) {
                        e.printStackTrace();
                   } catch (IOException e) {
                        e.printStackTrace();
              else{
                   try {
                   //     Statement s;
                        db.connect();
                   //     s = db.getS();
                        rs = db.execSQL(zoekklantnieuw2.toString());
                   //          out.println(rs.getString(1)+"hoi");
                        while (rs.next()) {
                   //           retrieve and print the values for the current row
                   //          out.println("debug1a --> "+rs.toString()+"<br>");
                             String str = rs.getString(1);
                   //          out.println("ROW = " + str );
                   //          out.print(rs);
                        } catch (SQLException e) {
                   //                TODO Auto-generated catch block
                   //          out.println("debug2 <br>"+e.toString());
                             e.printStackTrace();
                        } catch (ClassNotFoundException e) {
                   //                TODO Auto-generated catch block
                   //          out.println("debug3 <br>");
                             e.printStackTrace();
                   request.setAttribute("jesper",ZoekklantactieBean);
                   //          Get dispatcher with a relative URL
                   RequestDispatcher dis = request.getRequestDispatcher("Zoekresultaatklant.jsp");
                   //          include
                   try {
                        dis.include(request, response);
                        } catch (ServletException e) {
                        e.printStackTrace();
                        } catch (IOException e) {
                        e.printStackTrace();
                   //          or forward
                   try {
                        dis.forward(request, response);
                        } catch (ServletException e) {
                        e.printStackTrace();
                        } catch (IOException e) {
                        e.printStackTrace();
    BEAN
    package ...;
    public class ZoekklantactieBean {
         private String hachternaam;
         private String hvoorletters;
         private String hgeslachtMan;
         private String hgeslachtVrouw;
         private String hgeboortePlaats;
         private String hgeboorteDatum;
         private String hnationaliteit;
         private String hsofinummer;
         private String hadres;
         private String hwoonplaats;
         private String hpostcode;
         private String htelefoonnummerPrive;
         private String htelefoonnummerMobiel;
         private String htelefoonnummerWerk;
         private String hemail;
         private String hburgelijkeStaat;
         private String hallimentatie;
         private String hrestduurAllimentatie;
         private Boolean hbetreftOversluiting;
         private String pachternaam;
         private String pvoorletters;
         private String pgeslachtMan;
         private String pgeslachtVrouw;
         private String pgeboortePlaats;
         private String pgeboorteDatum;
         private String pnationaliteit;
         private String psofinummer;
         private String padres;
         private String pwoonplaats;
         private String ppostcode;
         private String ptelefoonnummerPrive;
         private String ptelefoonnummerMobiel;
         private String ptelefoonnummerWerk;
         private String pemail;
         private String pburgelijkeStaat;
         private String pallimentatie;
         private String prestduurAllimentatie;
         private Boolean poversluiting;
         public void setHachternaam( String name )
         hachternaam = name;
         public String getHachternaam()
         return hachternaam;
         public void setHvoorletters( String name )
         hvoorletters = name;
         public String getHvoorletters()
         return hvoorletters;
         public void setHgeslachtMan( String gender )
         hgeslachtMan = gender;
         public String getHgeslachtMan()
         return hgeslachtMan;
         public void setHgeslachtVrouw( String gender )
         hgeslachtVrouw = gender;
         public String getHgeslachtVrouw()
         return hgeslachtVrouw;
         public void setHgeboortePlaats( String name )
         hgeboortePlaats = name;
         public String getHgeboortePlaats()
         return hgeboortePlaats;
         public void setHgeboorteDatum( String date )
         hgeboorteDatum = date;
         public String getHgeboorteDatum()
         return hgeboorteDatum;
         public void setHnationaliteit( String name )
         hnationaliteit = name;
         public String getHnationaliteit()
         return hnationaliteit;
         public void setHsofinummer( String number )
         hsofinummer = number;
         public String getHsofinummer()
         return hsofinummer;
         public void setHadres( String name )
         hadres = name;
         public String getHadres()
         return hadres;
         public void setHwoonplaats( String name )
         hwoonplaats = name;
         public String getHwoonplaats()
         return hwoonplaats;
         public void setHpostcode( String name )
         hpostcode = name;
         public String getHpostcode()
         return hpostcode;
         public void setHtelefoonnummerPrive( String number )
         htelefoonnummerPrive = number;
         public String getHtelefoonnummerPrive()
         return htelefoonnummerPrive;
         public void setHtelefoonnummerMobiel( String number )
         htelefoonnummerMobiel = number;
         public String getHtelefoonnummerMobiel()
         return htelefoonnummerMobiel;
         public void setHtelefoonnummerWerk( String number )
         htelefoonnummerWerk = number;
         public String getHtelefoonnummerWerk()
         return htelefoonnummerWerk;
         public void setHemail( String adress )
         hemail = adress;
         public String getHemail()
         return hemail;
         public void setHburgelijkeStaat( String name )
         hburgelijkeStaat = name;
         public String getHburgelijkeStaat()
         return hburgelijkeStaat;
         public void setHallimentatie( String number )
         hallimentatie = number;
         public String getHallimentatie()
         return hallimentatie;
         public void setHrestduurAllimentatie( String number )
         hrestduurAllimentatie = number;
         public String getHrestduurAllimentatie()
         return hrestduurAllimentatie;
         public void setHbetreftOversluiting( Boolean choise )
         hbetreftOversluiting = choise;
         public Boolean getHbetreftOversluiting()
         return hbetreftOversluiting;
         public void setPachternaam( String name )
         pachternaam = name;
         public String getPachternaam()
         return pachternaam;
         public void setPvoorletters( String name )
         pvoorletters = name;
         public String getPvoorletters()
         return pvoorletters;
         public void setPgeslachtMan( String gender )
         pgeslachtMan = gender;
         public String getPgeslachtMan()
         return pgeslachtMan;
         public void setPgeslachtVrouw( String gender )
         pgeslachtVrouw = gender;
         public String getPgeslachtVrouw()
         return pgeslachtVrouw;
         public void setPgeboortePlaats( String name )
         pgeboortePlaats = name;
         public String getPgeboortePlaats()
         return pgeboortePlaats;
         public void setPgeboorteDatum( String date )
         pgeboorteDatum = date;
         public String getPgeboorteDatum()
         return pgeboorteDatum;
         public void setPnationaliteit( String name )
         pnationaliteit = name;
         public String getPnationaliteit()
         return pnationaliteit;
         public void setPsofinummer( String number )
         psofinummer = number;
         public String getPsofinummer()
         return psofinummer;
         public void setPadres( String name )
         padres = name;
         public String getPadres()
         return padres;
         public void setPwoonplaats( String name )
         pwoonplaats = name;
         public String getPwoonplaats()
         return pwoonplaats;
         public void setPpostcode( String name )
         ppostcode = name;
         public String getPpostcode()
         return ppostcode;
         public void setPtelefoonnummerPrive( String number )
         ptelefoonnummerPrive = number;
         public String getPtelefoonnummerPrive()
         return ptelefoonnummerPrive;
         public void setPtelefoonnummerMobiel( String number )
         ptelefoonnummerMobiel = number;
         public String getPtelefoonnummerMobiel()
         return ptelefoonnummerMobiel;
         public void setPtelefoonnummerWerk( String number )
         ptelefoonnummerWerk = number;
         public String getPtelefoonnummerWerk()
         return ptelefoonnummerWerk;
         public void setPemail( String adress )
         pemail = adress;
         public String getPemail()
         return pemail;
         public void setPburgelijkeStaat( String name )
         pburgelijkeStaat = name;
         public String getPburgelijkeStaat()
         return pburgelijkeStaat;
         public void setPallimentatie( String number )
         pallimentatie = number;
         public String getPallimentatie()
         return pallimentatie;
         public void setPrestduurAllimentatie( String number )
         prestduurAllimentatie = number;
         public String getPrestduurAllimentatie()
         return prestduurAllimentatie;
         public void setPoversluiting( Boolean choise )
         poversluiting = choise;
         public Boolean getPoversluiting()
              return poversluiting;
    JSP
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="ErrorPage.jsp" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <jsp:useBean id = "db" scope = "request" class = "jesper.DbBean" />
    <jsp:useBean id = "ZoekklantactieBean" scope = "request" class = "jesper.ZoekklantactieBean" />
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Klantinvoer</title>
    <style type="text/css">
    <!--
    .style1 {font-family: Verdana, Arial, Helvetica, sans-serif}
    .style3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; }
    -->
    </style></head>
    <body>
    <form id="Zoekklantactie" name="Zoekklantactie" method="post" action="Zoekklantactie">
    <table width="71%" height="447" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td width="20%"><span class="style1">Zoek klant </span></td>
    <td width="20%"><select name="select">
    <option>H. Patat</option>
    <option>B. Opgelder</option>
    <option>Y. de Koning</option>
    </select> </td>
    <td width="8%"> </td>
    <td width="18%"> </td>
    <td width="20%"> </td>
    <td width="14%"> </td>
    </tr>
    <tr>
    <td><span class="style3">Hoofdaanvrager</span></td>
    <td> </td>
    <td> </td>
    <td><span class="style3">Partner</span></td>
    <td> </td>
    <td> </td>
    </tr>
    <tr>
    <td><span class="style1">Naam</span></td>
    <td><input type="text" name="hachternaam" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="hachternaam" />"/></td>
    <td> </td>
    <td><span class="style1">Naam</span></td>
    <td><input type="text" name="pachternaam" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="pachternaam" />"/></td>
    <td> </td>
    </tr>
    <tr>
    <td><span class="style1">Voorletters</span></td>
    <td><input type="text" name="hvoorletters" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="hvoorletters" />"/></td>
    <td> </td>
    <td><span class="style1">Voorletters</span></td>
    <td><input type="text" name="pvoorletters" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="pvoorletters" />"/></td>
    <td> </td>
    </tr>
         <tr>
    <td><span class="style1">Geslacht</span></td>
    <td><span class="style1">
    <label>
    <input name="hgeslachtMan" type="radio" value="<jsp:getProperty name ="ZoekklantactieBean" property ="hgeslachtMan"/>Man" />
    Man
    <input name="hgeslachtMan" type="radio" value="<jsp:getProperty name ="ZoekklantactieBean" property ="hgeslachtVrouw"/>Vrouw" />
    Vrouw </label>
    </span></td>
    <td><span class="style1"></span></td>
    <td><span class="style1">Geslacht</span></td>
    <td><span class="style1">
    <label>
    <input name="pgeslachtMan" type="radio" value="<jsp:getProperty name ="ZoekklantactieBean" property ="pgeslachtMan" />Man" />
              Man
              <input name="pgeslachtMan" type="radio" value="<jsp:getProperty name ="ZoekklantactieBean" property ="pgeslachtVrouw" />Vrouw" />
              Vrouw </label></span></td>
    <td> </td>
    </tr>
    <tr>
    <td><span class="style1">Geboortedatum</span></td>
    <td><input type="text" name="hgeboorteDatum" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="hgeboorteDatum" />"/></td>
    <td> </td>
    <td><span class="style1">Geboortedatum</span></td>
    <td><input type="text" name="pgeboorteDatum" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="pgeboorteDatum" />"/></td>
    <td> </td>
    </tr>
    <tr>
    <td><span class="style1">Geboorteplaats</span></td>
    <td><input type="text" name="hgeboortePlaats" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="hgeboortePlaats" />"/></td>
    <td> </td>
    <td><span class="style1">Geboorteplaats
    </span></td>
    <td><span class="style1">
    <input type="text" name="pgeboortePlaats" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="pgeboortePlaats" />"/>
    </span></td>
    <td> </td>
    </tr>
    <tr>
    <td><span class="style1">Nationaliteit</span></td>
    <td><input type="text" name="hnationaliteit" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="hnationaliteit" />"/></td>
    <td> </td>
    <td><span class="style1">Nationaliteit</span></td>
    <td><input type="text" name="pnationaliteit" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="pnationaliteit" />"/></td>
    <td> </td>
    </tr>
    <tr>
    <td><span class="style1">Sofinummer</span></td>
    <td><input type="text" name="hsofinummer" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="hsofinummer" />"/></td>
    <td> </td>
    <td><span class="style1">Sofinummer</span></td>
    <td><input type="text" name="psofinummer" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="psofinummer" />"/></td>
    <td> </td>
    </tr>
    <tr>
    <td><span class="style1">Postcode</span></td>
    <td><input type="text" name="hpostcode" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="hpostcode" />"/></td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    </tr>
    <tr>
    <td><span class="style1">Adres</span></td>
    <td><input type="text" name="hadres" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="hadres" />"/></td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    </tr>
    <tr>
    <td><span class="style1">Woonplaats</span></td>
    <td><input type="text" name="hwoonplaats" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="hwoonplaats" />"/></td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    </tr>
    <tr>
    <td><span class="style1">Telefoon prive</span></td>
    <td><span class="style1">
    <input type="text" name="htelefoonnummerPrive" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="htelefoonnummerPrive" />"/></span></td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    </tr>
    <tr>
    <td><span class="style1">Telefoon mobiel </span></td>
    <td><span class="style1">
    <input type="text" name="htelefoonnummerMobiel" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="htelefoonnummerMobiel" />"/></span></td>
    <td> </td>
    <td><span class="style1">Telefoon mobiel</span></td>
    <td><span class="style1">
    <input type="text" name="ptelefoonnummerMobiel" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="ptelefoonnummerMobiel" />"/></span></td>
    <td> </td>
    </tr>
    <tr>
    <td><span class="style1">Telefoon werk </span></td>
    <td><span class="style1">
    <input type="text" name="htelefoonnummerWerk" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="htelefoonnummerWerk" />"/></span></td>
    <td> </td>
    <td><span class="style1">Telefoon werk</span></td>
    <td><span class="style1">
    <input type="text" name="ptelefoonnummerWerk" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="ptelefoonnummerWerk" />"/></span></td>
    <td> </td>
    </tr>
    <tr>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    </tr>
    <tr>
    <td><span class="style1">E-mail</span></td>
    <td><input type="text" name="hemail" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="hemail" />"/></td>
    <td> </td>
    <td><span class="style1">E-mail</span></td>
    <td><input type="text" name="pemail" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="pemail" />"/></td>
    <td> </td>
    </tr>
    <tr>
    <td><span class="style1">Burgelijke staat </span></td>
    <td><select name="hburgelijkeStaat" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="hburgelijkeStaat" />">
    <option selected="selected">gehuwd</option>
    <option>ongehuwd</option>
    <option>gescheiden</option>
    </select> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    </tr>
    <tr>
    <td><span class="style1">Allimentatie</span></td>
    <td><input type="text" name="hallimentatie" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="hallimentatie" />"/></td>
    <td> </td>
    <td><span class="style1">Allimentatie</span></td>
    <td><input type="text" name="pallimentatie" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="pallimentatie" />"/></td>
    <td> </td>
    </tr>
    <tr>
    <td><span class="style1">Restduur allimentatie </span></td>
    <td><input type="text" name="hrestduurAllimentatie" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="hrestduurAllimentatie" />"/></td>
    <td> </td>
    <td><span class="style1">Restduur allimentatie </span></td>
    <td><input type="text" name="prestduurAllimentatie" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="prestduurAllimentatie" />"/></td>
    <td> </td>
    </tr>
    <tr>
    <td><span class="style1">Betreft een oversluiting? </span></td>
    <td><input type="checkbox" name="hbetreftOversluiting" value ="<jsp:getProperty name ="ZoekklantactieBean" property ="hbetreftOversluiting" />Betreft oversluiting" /></td>
    <td> </td>
    </tr>
    </table>
    </form>
    <form name="Terug" method="post" action="Menu.jsp"><input name="Terug" type="submit" value="Terug naar hoofdmenu" /></form>
    </body>
    </html>
    Package everywhere the same.
    Have commented some of the code, because i was trying to debug, but just couldn't figure it out.
    Tnx in advance.
    gr. bopgelder

    put your bean in a different package from servlet and include this
    package in your servlet like
    import yourbeanpackage.yourbean
    and then create object of bean and use it

  • Urgent help is needed - JSP & Java beans

    Hi,
    I am getting the following problem when trying to interact with Javabeans from JSP (DB I use is Cloudscape) :
    An exception occurred while interacting with the guestbook database.
    The error message was:
    Cannot create bean of class proj.beans.UserDataBean
    Please try again later
    The problem probably occurs in following line:
    status = guestData.checkUser(userName,emailName);
    where guestData represents a Javabean class.
    The strangest thing is that sometimes, suddenly, the program is working OK without this Error Message but when it occurs I don't know the reason and how to solve it.
    Please advise...
    Thanks a lot.

    Can you copy the entire stack trace and post it? It would probably help.

  • Problem with JSP using bean packaged in jar file

    Hi,
              I am trying to use a java bean in a jsp file. The java bean is packaged
              into a jar file. I am getting class not found compilation error. If the
              bean remains to be a seperated class file, everything work well.
              Does anyone know how I can use bean in a jar file within jsp , i.e. to
              allow the bean to be found during compilation ?
              Thanks,
              Terence.
              [email protected]
              

    Jacek,
              Thanks for replying.
              My JSP's are just files in my document root . However, I found a solution to
              my
              problem. That is to have the jar file defined in my weblogic.class.path. I may
              have missed some files in my original jar file which causes my problem.
              Mayby I should package everything into a web application for deployment. That
              will be my next step.
              Thanks anyway.
              Terence.
              Jacek Laskowski wrote:
              > Terence Lai wrote:
              > >
              > > Hi,
              > >
              > > I am trying to use a java bean in a jsp file. The java bean is packaged
              > > into a jar file. I am getting class not found compilation error. If the
              > > bean remains to be a seperated class file, everything work well.
              >
              > How do you use the JSP file ? Is it a part of web application ? If so,
              > the bean jar package should be located in WEB-INF/lib directory. It's
              > also recommended to put the bean class into a package, so it's not in
              > 'unnamed' package, and <jsp:useBean> can find it.
              >
              > >
              > > Does anyone know how I can use bean in a jar file within jsp , i.e. to
              > > allow the bean to be found during compilation ?
              >
              > see above.
              >
              > > Terence.
              >
              > Jacek Laskowski
              > HP Consulting
              

Maybe you are looking for