JSP/Servlet/Bean help

Pretty new to java and I am getting an error that I have tried to figure out for a few days here and ... well... not getting far.
I have a servlet that calls one of two jsp pages depending on GET or POST. index.jsp is called on GET and works fine. On POST the servlet gets a db pool connection does a quick select count(*) query and then populates a bean with the results. This all works fine (as I have system.out.println's showing me the results)
But when it forwards to the next jsp page the page bombs out because it can't seem to find the Bean.
The error is below.
my set up is Tomcat 4.x
the main servlet AECPhoneServlet is in ...webapps/damn/WEB-INF/classes
the bean (QueryBean) is in ...webapps/damn/WEB-INF/classes/com/phone
jsp's are in ...webapps/damn
web.xml looks like this
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>AECPhoneServlet</servlet-name>
<servlet-class>AECPhoneServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>AECPhoneServlet</servlet-name>
<url-pattern>/AECPhone</url-pattern>
</servlet-mapping>
</web-app>
Classpath is
echo $CLASSPATH
:/usr/tomcat/jakarta-tomcat-4.1.24/webapps/damn/WEB-INF/classes/com/phone:.:/usr/tomcat/jakarta-tomcat-4.1.24/common/lib/servlet.jar
I am beating my head against the wall here. Any and all help would be greatly appreciated. Assume I know nothing. lol. Because basically I don't.
ype Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 2 in the jsp file: /rs.jsp
Generated servlet error:
[javac] Since fork is true, ignoring compiler setting.
[javac] Compiling 1 source file
[javac] Since fork is true, ignoring compiler setting.
[javac] /usr/tomcat/jakarta-tomcat-4.1.24/work/Standalone/localhost/damn/rs_jsp.java:8: package com does not exist
[javac] import com.phone;
[javac] ^
[javac] /usr/tomcat/jakarta-tomcat-4.1.24/work/Standalone/localhost/damn/rs_jsp.java:45: cannot resolve symbol
[javac] symbol : class TestBean
[javac] location: class org.apache.jsp.rs_jsp
[javac] TestBean tBean = null;
[javac] ^
An error occurred at line: 2 in the jsp file: /rs.jsp
Generated servlet error:
[javac] /usr/tomcat/jakarta-tomcat-4.1.24/work/Standalone/localhost/damn/rs_jsp.java:47: cannot resolve symbol
[javac] symbol : class TestBean
[javac] location: class org.apache.jsp.rs_jsp
[javac] tBean = (TestBean) pageContext.getAttribute("tBean", PageContext.PAGE_SCOPE);
[javac] ^
An error occurred at line: 2 in the jsp file: /rs.jsp
Generated servlet error:
[javac] /usr/tomcat/jakarta-tomcat-4.1.24/work/Standalone/localhost/damn/rs_jsp.java:50: cannot resolve symbol
[javac] symbol : class TestBean
[javac] location: class org.apache.jsp.rs_jsp
[javac] tBean = (TestBean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "TestBean");
[javac] ^
[javac] 4 errors
     at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:130)
     at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
     at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:353)
     at org.apache.jasper.compiler.Compiler.compile(Compiler.java:370)
     at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
     at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
     at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
     at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
     at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
     at AECPhoneServlet.doPost(AECPhoneServlet.java:56)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
     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:256)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
     at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
     at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
     at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
     at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
     at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
     at java.lang.Thread.run(Thread.java:536)

my set up is Tomcat 4.x
the main servlet AECPhoneServlet is in
...webapps/damn/WEB-INF/classes
the bean (QueryBean) is in
...webapps/damn/WEB-INF/classes/com/phone
jsp's are in ...webapps/damn
/usr/tomcat/jakarta-tomcat-4.1.24/work/Standalone/local
ost/damn/rs_jsp.java:45: cannot resolve symbol
[javac] symbol : class TestBean
[javac] location: class org.apache.jsp.rs_jsp
[javac] TestBean tBean = null;
[javac] ^
I don't know if this is a typo, but above you say the class name is QueryBean. However, the compiler errors refer to a class called TestBean.

Similar Messages

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

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

  • Jsp,servlet,bean question,please help

    The Tomcat Web server set up like this.......
    The directory structure is
    e:/sampleapp/WEB-INF/classes
    /lib
    And the web.xml is in the WEB-INF for the use of ay potential servlet.
    The basic understanding is that all the .java files go into the WEB-INF directory and the .class files go into the classes directory.
    All the .jsp files go into the sampleapp directory.Till here is correct I feel.
    Now for my qustion......
    I plan to use jsp,servlet and beans for a potential web application...,where do all these files go?,just the same as above or is there a difference.
    Hope that I have given a reasonable explaination to my question.
    Thanks for any replies
    AS

    All of your compiled servlet and java bean (java
    classes in general) will be placed into the following
    directory (under a directory structure matching the
    java package they are in):
    e:/sampleapp/WEB-INF/classesAll of your .jar files that are used as libraries (not
    your .jar files for applets):
    e:/sampleapp/WEB-INF/libAll of the rest of your JSP files, javascript files,
    HTML files, JAR files, images files, etc. will go into
    the following directory:
    e:/sampleappYou must make sure you put your sampleapp directory
    where tomcat can load it. Or use the admin tool to
    load it. If you make a .WAR file with a corresponding
    web.xml file in it, it will simplify loading it into
    tomcat. It also will help you do your servlet
    mappings, etc. I hope this helps.Thanks for your timely response.To add to it,let me tell you.
    The <b>bean</b> files are put into a package right,so they should be put into the WEB-INF/classes/<package name>
    What about The <b> servlet </b> files...... they are just put into the WEB-INF/classes/ directory????
    Kindly let me know.
    Thanks
    AS

  • Jsp / Servlet / bean / upload

    Hello,
    I use a jsp to enter several fields. These fields are sent to a servlet by using a bean (recorded in the current session). Until now there is no problem. The servlet receives all information. Now I must also send 5 files which must be stored on the server. I have thus to add in my jsp 5 file fields.
    My question :
    Is it possible to integrate the FileUpload package for uploader my files without anything to change in my code (by using of a bean to exchange the data between my jsp and my servlet). ??
    In other words, it is possible to use my bean to also transport files. ??
    Tank u for u help

    Yes it is possible..
    download cos.jar from www.oreily.com for file upload..
    it will read dat from the form as two parts ..
    parameter part and file part..
    and you can implement it throgh a servlet easily..
    for more follow oreily JSP/servlets Cookbook

  • Change Drop Down from Other JSP/Servlet/Bean

    I am wanting to have a select box populate from a database query based on the information pulled from another select box as the user chooses it (ie a user chooses a state and the city choices populate or something like that). I am using JSP, Servlets and Beans. Seems that I need to us JSF, but I was wondering if there is another way or better way.
    Thanks for the thoughts.

    user12081556 wrote:
    I meant to put in my question above, aren't jsf tags just imbedded in some jsp/html code?Not jsp code no. I don't know whether it's possible to use jsf and jsp together, but I wouldn't try.
    While JSP has evolved over time from Html and Java code mixed together to standard tags responsible mostly for displaying the data, it's still an old "hack" that compiles jsp pages into servlets.
    JSF at least alleviates some of those problems and works nicely with proper xhtml formatted views too (and there's facelets etc. etc. etc.).
    Granted, if you're shown some jsp tags and jsf tags, you might not appreciate the difference in the technologies.

  • JSP - Servlet - Please help

    Hi:
    Can any one suggest me the code for the following scenerio, Am new to jsp-Servlet....
    I need to give an EMPNAME in a Textbox on clicking GO button from my JSP page, a servlet must process thei query and display the output of that employee details back to that JSP page..
    Please help me out with some code snippets...
    Regards,

    The sun's site provides a detailed introduction to JDBC. or
    have to google for JDBC and once you've understood the JDBC concept, then you could progress from there. There is no simple way of doing what you asked.
    You will need a database, though you could use MS Access. But you still need the JDBC.

  • SOme more help on JSP-Servlets-Beans plz...!!

    Thanx a lot for your help !
    But I could not understand some things ...
    Suppose, I create 5 bean instances in my servlet, & "set" them with data from 5 tuples.
    Now, I need to pass these 5 bean objects to a JSP .
    HOW exactly can I pass them via a List object thru request attribute ?
    And, after doing that, HOW will I be able to access the individual Bean objects in the JSP ?
    Plz., see if you can send me some Code Snippets that illustrate the same.
    Once again, Thanks a lot for bearing with me !!
    Awaiting your response...
    Truly yours,
    Raghu

    Servlet:
    request.setAttribute ("someUniqueName", yourBeanList);
    JSP:
    Either <jsp:useBean> or insert a scriplet like <% List beanList = (List) request.getAttribute("someUniqueName"); %>

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

  • Synchronized problem in JSP/Servlet, please help me.

    Hi, all
    I have many processes in one JSP page or Servlet program of my project.
    When many people visit at one time, then the project throws some SQL/DB Errors.
    I have updated it and test it many times, I think, that is a synchronized problem.
    At last I used ��synchronized (this){my JSP/Servlt SQL/DB processes}�� to synchronize
    The process. Then the errors removed.
    And now I think that too danger to use the ��synchronized (this){}�� to synchronized.
    If use it then some other problem may be growling on. Such as when one people need to use
    This service others must to wait, the process may be too slow! And when an exception throws
    from the SQL/DB or some other place, what I do? Need any advice from you.
    Sincerely
    Urey
    *** my JSP/Servlt Server is tomcat ***

    As Chuck points out, there isn't a new instance of the Servlet/JSP for each request - they are probably all calling the same instance so any state will be shared. If your Connection is stored as a member variable then you'll have problems with it already being in use if two people hit the page at the same time.
    Limited resources such as database connections should ideally be pooled anyway to ensure that you're not opening them all the time and that you can control how many are open across the entire application. Then you'd simply need to get a fresh connection out of the pool at the top of the page and make sure you put it back when you're done.
    Incidentally, although it might work, synchronizing the database access in the JSP would be a bad idea since you'd just create a queue of requests waiting to use the one Connection whereas you really need a number of Connections to deal with everyone simultaneously.
    If you need some example code for a simple JSP using a database connection pool (DataSource) just say.
    Hope this helps.

  • 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

  • What are JSP, Servlet , Bean in MVC ??..how does it function?

    suppose there's a bean file (.java) consisting of SQL query, and a servlet (.java) used to show an image, and lastly a jsp page when clicked shows the image.............can you please explain how does this work,how the logic flows,what happens step by step.....i really need to understand this, thankz.

    A JSP page is essentially an easy way to create an abstract behind the scenes servlet where its whole purpose is to serve HTML. JSP tags and java code within the page are processed on the server side first and then a response is sent containing the HTML.
    The JSP can send its request to another handler or servlet that can do the processing.
    I don't understand where a java bean comes into play in this situation.

  • Sample JSP&Servlet application required?

    hey all
    iam new to jsp&servlets
    i did read some tutorials about the basics
    and i want any link to a tutorial or a project that uses both jsp&servlets
    any help?

    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.

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

  • Error Compilation When I browse JSP with bean, please Help Me

    Hello,
    I am new in EJB. I have a problem that I am not understand. please help me.
    I have write my bean and deploy it using JRUN server. The name is SpellCheck.jar
    But when I called the bean from JSP page, always error. Here is my JSP page.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <jsp:useBean id="help" scope="request" class="projsp.SpellCheck"/>
    <jsp:setProperty name="help" property="*"/>
    <html>
    <head>
    <title>Untitled</title>
    </head>
    <body>
    You Entered the input,
    <b>
    <%= request.getParameter("word") %>
    </b>
    <br>
    The processed output is:<br>
    <%= integer.parseInt(request.getparameter("mode"))==1 ?help.reverse():""+help.check() %>
    </body>
    </html>
    and the error messages is:
    Compilation error occured:
    allaire.jrun.scripting.DefaultCFE:
    Errors reported by compiler:Compilation of file 'C:\Program Files\Allaire\JRun\servers\default\veronika\WEB-INF\jsp\jrun__wordpro2ejspc.java' failed with no errors. Please check that your compiler is a working compiler.
    at allaire.jrun.scripting.JavaCompilerService.compile(../scripting/JavaCompilerService.java:100)
    at allaire.jrun.jsp.Translator.compilePage(../jsp/Translator.java:247)
    at allaire.jrun.jsp.Translator.translate(../jsp/Translator.java:399)
    at allaire.jrun.jsp.Translator.translate(../jsp/Translator.java:92)
    at allaire.jrun.jsp.JSPTranslator.translate(../jsp/JSPTranslator.java:75)
    at allaire.jrun.jsp.JSPTranslator.translate(../jsp/JSPTranslator.java:67)
    at allaire.jrun.jsp.JSPServlet.service(../jsp/JSPServlet.java:216)
    at allaire.jrun.jsp.JSPServlet.service(../jsp/JSPServlet.java:196)
    at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1416)
    at allaire.jrun.session.JRunSessionService.service(../session/JRunSessionService.java:1082)
    at allaire.jrun.servlet.JRunSE.runServlet(../servlet/JRunSE.java:1270)
    at allaire.jrun.servlet.JRunRequestDispatcher.forward(../servlet/JRunRequestDispatcher.java:89)
    at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1552)
    at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1542)
    at allaire.jrun.servlet.JvmContext.dispatch(../servlet/JvmContext.java:364)
    at allaire.jrun.http.WebEndpoint.run(../http/WebEndpoint.java:115)
    at allaire.jrun.ThreadPool.run(../ThreadPool.java:272)
    at allaire.jrun.WorkerThread.run(../WorkerThread.java:75)
    but if I delete the syntax for calling Bean (usebean, setProperty, and request.getParameter) the browser run properly. Can anybody help me, please?
    thanks
    Veronika

    Hi Veronika,
    The <jsp:usebean> is used for only javabeans not EJB (Enterprise javabean). You said that you have deployed SpellCheck.jar to the JRun server. So that must be an EJB. Where are you accessing this EJB from in your JSP? ARe you doing it inside the projsp.SpellCheck javabean? If yes, can you post some code from the javabean.
    Cheers
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <jsp:useBean id="help" scope="request" class="projsp.SpellCheck"/>
    <jsp:setProperty name="help" property="*"/>
    <html>
    <head>
    <title>Untitled</title>
    </head>
    <body>
    You Entered the input,
    <b>
    <%= request.getParameter("word") %>
    </b>
    <br>
    The processed output is:<br>
    <%= integer.parseInt(request.getparameter("mode"))==1 ?help.reverse():""+help.check() %>
    </body>
    </html>

Maybe you are looking for

  • How to process F-29 in mass?

    Hi all, I have many noted items (maybe 200) which I must associate to down payment request (F-29). Could you give me advice on the way to do this? (Using a specific program, a mass transaction...?) Thanks for your advice! David

  • Can an error be forced in the Post method of Create Purch. Req. ME51N

    Hello Developers, I need to prevent the Posting from ME51N after displaying errors in custom code. I created an enhancement at the beginning of the Post method to perform edits but even after a message type "E" occurs the PR number displays on the sc

  • CS4 won't open now

    Can anyone help me understand why PPro CS4 won't open all of a sudden? I've tried rebooting, not sure what happened in the last 12 hours. I assume i'll have to reinstall the software, but does anyone know why this happens?

  • Wrong info about PCI-4452 on Catalog 2005?

    Hi. I found that on page 254 of Catalog 2005 there's a table where it says that NI PCI-4452 has IEPE conditioning. Is that true? Regards, Daniel Ramírez MSc - Mechanical Engineer Universidad de Concepción

  • How to upgrade to lion

    What are the steps to upgrade from OS 10.4 to 10.7.  The downloads site is confusing.