First JSP/Tomcat 5.5 test

Hi,
I'm new in Java and i'm trying to create a web application in JSP.
Basically, it should connect to a MS access database for the first steps, after it should use a MySQL DB.
In this purpose i would like to build this web application as flexible as it is, because i don't want to recompile or rebuild code from migration Access to MySQL.
1. where can i find a good tutorial about tomcat 5.5 setup ? I have a book for now, but it's very long way to first test...i just cover 10 % in 2 days. :(
2. where can i find a very good tutorial about connect MS access DB from JSP ?
3. how to it as flexible as i want ?
thx,
Maileen

1. where can i find a good tutorial about tomcat 5.5
setup ? I have a book for now, but it's very long way
to first test...i just cover 10 % in 2 days. :(http://www.coreservlets.com/Apache-Tomcat-Tutorial/
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/index.html
2. where can i find a very good tutorial about
connect MS access DB from JSP ?you mean JDBC http://java.sun.com/j2se/1.5.0/docs/guide/jdbc/index.html
3. how to it as flexible as i want ?you can save the connection string and the jdbc driver class name and the username and password to a file and then you application should read this data from that file. when you need to move form access to mysql just change the data in the file

Similar Messages

  • How to move the JSP report  in local Tomcat server to test instance-reg

    Dear All:
    I have developed a self service report using JSP for Leave details of an employee.
    Right now the report is in my local system tomcat server how can i register/move it into the test instance (ie.DEV) of Oracle apps .
    can any of you let me know this plsssssssssss.........
    with warm regards
    Geetha

    Geetha,
    I don't want to seem unhelpful, but I don't see the relevance to Apex in your question, this forums is specifically for Apex related questions therefore you would have more chance of a useful answer if you posted your question in a JSP/Tomcat related forum.

  • Jsp-tomcat

    Dear members;
    I am a new web jsp developper using Eclipse and tomcat
    I have created a new project in Eclipse named �personne� and under which I created my first jsp file called �formulaire.jsp�
    when I try to access my jsp file in tomcat(http://localhost:8080/personne/formulaire.jsp), it looks like the jsp file becomes a .java file and I get the following error message:
    type Rapport d'exception
    message
    description Le serveur a rencontr� une erreur interne () qui l'a emp�ch� de satisfaire la requ�te.
    exception
    org.apache.jasper.JasperException: Impossible de compiler la classe pour la JSP
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:97)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:346)
         org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:414)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    cause m�re
    Unable to find a javac compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK
         org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:106)
         org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:935)
         org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:764)
         org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:382)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note La trace compl�te de la cause m�re de cette erreur est disponible dans les fichiers journaux de Apache Tomcat/5.0.28.
    Apache Tomcat/5.0.28
    Can you please help

    Isnt it very evident from the stack trace ?
    Unable to find a javac compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDKcheers,
    ram.

  • How to combinate JSP+Tomcat+mysql??

    Hi,guys. My question is as the above subject.
    I have installed JDK, Tomcat, mysql, and my OS is WinXP, I am trying to develop a JSP site in my computer.
    For JDK, the commands javac, java, ...... work OK;
    For Tomcat, http://localhost:8080 works OK, meaning the cat page appears.
    For mysql, I can login, and sql statements work OK;
    And I download mysql-connector-java-3.1.8a.
    What I should do further to combinate JSP+Tomcat+mysql, so my JSP site can work? Any advice?
    I need help.
    Thanks in advance!

    Thanks,duffymo!
    As you said, I am learning more about those things.
    Actually I am trying to open a JSP webpage to show the connection JSP+Tomcat+mysql works OK.
    I copied the mysql-connector-java-3.1.8-bin.jar to ...Tomcat 5.0\common\lib,
    created a datebase, named test in MySQL, and wrote a JSP as the below:
    <%@ page contentType="text/html; charset=gb2312" %>
    <%@ page language="java" %>
    <%@ page import="com.mysql.jdbc.Driver" %>
    <%@ page import="java.sql.*" %>
    <%
    //driver
    String driverName="com.mysql.jdbc.Driver";
    //username
    String userName="test";
    //code
    String userPasswd="123";
    //database
    String dbName="test";
    //table name
    String tableName="mytab";
    //connection string
    String url="jdbc:mysql://localhost/"+dbName+"?user="+userName+"&password="+userPasswd;
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    Connection connection=DriverManager.getConnection(url);
    Statement statement = connection.createStatement();
    String sql="SELECT * FROM "+tableName;
    ResultSet rs = statement.executeQuery(sql);
    ResultSetMetaData rmeta = rs.getMetaData();
    int numColumns=rmeta.getColumnCount();
    // output
    out.print("id");
    out.print("|");
    out.print("num");
    out.print("<br>");
    while(rs.next()) {
    out.print(rs.getString(1)+" ");
    out.print("|");
    out.print(rs.getString(2));
    out.print("<br>");
    out.print("<br>");
    out.print("successful!");
    rs.close();
    statement.close();
    connection.close();
    %>
    How can I test the connection JSP+Tomcat+mysql works OK?
    Thanks again!

  • Catching jsp/tomcat/java SQL error

    I have been trying to get the sample code to work from an old book. I was finally able to get it to run under tomcat 4.1.31 but there is one bug I just cannot figure out how to handle. I am a beginner to Java/JSP/Tomcat and have about 16+ hours invested in this problem so far.
    The delFruit.jsp calls methods from FruitConnect.java.
    I found that if the fruit chosen for deletion was not involved in a referential integrity link to a FruitMonth file the code works fine. But if it is linked the delFruit.jsp just displays a blank screen and nothing is deleted. It is fine for it not to be deleted but I cannot find anyway to handle it. I tried to add the checkFruitForSale bandaid below but it causes me a blank screen as well.
    Any help would be appreciated.
    It would be great if I could just see what is happening when FruitConnect is processing code. I get no errors, just a blank screen. I'm going to try using NetBeans and their debugger next.
    Here is delFruit:
    <%@ page import="java.sql.*" %>
    <jsp:include page="adminHeader.html" flush="true" />
    <jsp:useBean id="fruitConnect" class="fruit1.FruitConnect" />
    <%
    String msg = "The following fruits have been deleted:<br> ";
    //Build the list of fruits to delete
    String delFruit[] = request.getParameterValues("delFruit");
    //WE WILL ONLY GET CHECKBOXES THAT WERE CHECKED
       String fruitList = "";
       if (delFruit != null){
         int len = delFruit.length;
         fruitConnect.dbConnect();
         for (int i = 0; i < len; i++) {
              String passfruit = delFruit;
              if (fruitConnect.checkFruitForSale(passfruit)) {}
              else{
              fruitList = fruitList + "'" + delFruit[i] + "',";
              msg = msg + delFruit[i] + "<br>";
              out.print(msg);
              out.print(msg);
         fruitList = fruitList + "'nonsense'";
         if (fruitConnect.deleteFruit(fruitList) < 1) {
              msg = "There was an error deleting the fruits from the database.";
         else{
         msg = "Deletion was successful";
         fruitConnect.dbDisconnect();
    else {
         msg = "You must select some fruit to delete.";
    %>
    HERE IS FruitConnect.java
    package fruit1;
    import java.sql.*;
    public class FruitConnect {
       private Driver drv = null;
       private Connection conn = null;
       private ResultSet rs = null;
       private Statement stmt = null;
       public FruitConnect(){}
       public void dbConnect() throws Exception{
    //      drv = (Driver) Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    //      conn = DriverManager.getConnection("jdbc:odbc:Fruit");
    try{
          drv = (Driver) Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
          conn = DriverManager.getConnection("jdbc:odbc:Fruit");
    catch ( SQLException sqlException)
    sqlException.printStackTrace();
    finally
    try{
    catch (Exception exception)
       public boolean getNextItem() throws Exception{
          boolean ret = rs.next();
          return(ret);
       public String getItemNameString(String columnName) throws Exception{
          String name = rs.getString(columnName);
          return(name);
       public float getItemNameFloat(String columnName) throws Exception{
          float name = rs.getFloat(columnName);
          return(name);
       public boolean selectFruits() throws Exception{
          String query = "SELECT Id, Name FROM Fruit";
          stmt = conn.createStatement();
          rs = stmt.executeQuery(query);
          boolean ret = false;
          if (rs != null)
             ret = true;
          return(ret);
       public boolean selectMonths() throws Exception{
          String query = "SELECT Id, Name FROM Month";
          stmt = conn.createStatement();
          rs = stmt.executeQuery(query);
          boolean ret = false;
          if (rs != null)
             ret = true;
          return(ret);
       public boolean selectFruitForSale() throws Exception{
          String query = "SELECT F.Name AS Fruit, M.Name AS Month, Price, Weight, (Price * Weight) AS TotalPrice FROM FruitMonth AS FM, Fruit AS F, Month AS M WHERE FM.FruitId = F.Id AND FM.MonthId = M.Id ORDER BY M.Id";
          stmt = conn.createStatement();
          rs = stmt.executeQuery(query);
          boolean ret = false;
          if (rs != null)
             ret = true;
          return(ret);
       public int insertFruit(String name) throws Exception{
          String query = "INSERT INTO Fruit (Name) VALUES ('" + name + "')";
          stmt = conn.createStatement();
          int ret = stmt.executeUpdate(query);
          return(ret);
       public int insertFruitForSale(String insertValues) throws Exception{
          String query = "INSERT INTO FruitMonth (FruitId, MonthId, Price, Weight) VALUES (" + insertValues + ")";
          stmt = conn.createStatement();
          int ret = stmt.executeUpdate(query);
          return(ret);     
       public int deleteFruit(String fruitList) throws Exception{
          String query = "DELETE FROM Fruit WHERE Name IN (" + fruitList + ")";
          stmt = conn.createStatement();
          int ret = stmt.executeUpdate(query);
          return(ret);
       public void dbDisconnect() throws Exception{
          stmt.close();
          conn.close();
       public boolean checkFruitForSale(String thisfruit) throws Exception{
          String query = "SELECT F.Name AS Fruit, M.Name AS Month, Price, Weight, (Price * Weight) AS TotalPrice FROM FruitMonth AS FM, Fruit AS F, Month AS M WHERE FM.FruitId = F.Id AND FM.MonthId = M.Id AND F.Name IN (" + thisfruit + ") ORDER BY M.Id";
    try{
          stmt = conn.createStatement();
          rs = stmt.executeQuery(query);
    catch ( SQLException sqlException)
    sqlException.printStackTrace();
          boolean ret = false;
          if (rs != null)
             ret = true;
          return(ret);
    finally
    try{
    catch (Exception exception)
          boolean ret = false;
          if (rs != null)
             ret = true;
          return(ret);
       public String Check1(String columnName) throws Exception{
          String name = rs.getString(columnName);
          return(name);

    First thing to check would be the Tomcat log file. Most likely there is an error message printed there:
    Look in [TOMCAT]/logs for any files modified recently. Open it, and you should find some hints as to your error.
    It would be great if I could just see what is happening when
    FruitConnect is processing code.For that sort of thing, you want to use a logger. Either Log4J or the standard Java1.4 logger would help. Basically configure it to log statements to file as your program runs.
    I get no errors, just a blank screenThat could indicate that the page ran enough to fill up the page buffer, and then failed. When you view source, do you see anything on the page at all?

  • Head  first jsp

    hello
    i need this book as a soft copy :
    head first jsp & servlet.
    thanx

    To avoid having to use the classpath over and over add it to your system environment variables:
    Right click 'My Computer' > Properties > Advanced > Environment Variables
    Under 'System Variables' if you don't already have have a 'CLASSPATH', create one. If you do, append the path to your servlet-api.jar ( e.g. c:\Tomcat\common\lib\servlet-api.jar ). Remember, different entries into the classpath must be separated by semi-colons (;).
    Save and open a fresh console window ( the changes don't reflect in consoles that were already open ).
    Of course, you should still learn how to work with the classpath variable: http://java.sun.com/j2se/1.4.2/docs/tooldocs/solaris/classpath.html
    This is what your command should be:
    javac -classpath c:\Tomcat\common\lib\servlet-api.jar -d classes src/Ch1Servlet.java

  • Upon refreshing the page, why always first.jsp  is displayed ?

    Hi all,
    In case of multipage portlet (jpdk example), why always the first.jsp is displayed upon clicking the refresh button of the page containing the multipage portlet even when we are viewing the second.jsp. Can we avoid this?
    Best regards,
    Omer

    Hi,
    As it's visible here Struts 1 doesn't have this component. Although this is 1.3.8 struts version but I doubt if in 1.3.10 TabbedPanel is already implemented. So nothing unusual that it's not working.
    To use this component (class) You've to download the latest Struts version (it would be Struts 2 of course) and migrate Your project from Struts 1 to Struts 2. I don't know Struts 1 very well but I read several articles about migration to the latest version and this migration was worth it. Is see this article as very helpful in this case.
    And 'struts-tags' is not a class. This a tag library directive that names the library which contains the tags. This uri is declared in a tld file (tag library descriptor) which is special descriptor for the whole library.

  • JSP, Tomcat 5, Oracle9i

    Hi everyone,
    My Tomcat 5 runs OK with JSP files that don't need access to any database. However, I got error message when running any JSP files that need access to Oracle9i. Below is my "test.jsp" that will get error when running http://localhost/test.jsp.
    <%@ page import="java.awt.*, java.awt.event.*, java.sql.* , java.text.*, java.io.*" %>
    <!------------------------------------------------------------------
    * This is a test page to Oracle9i database.
    --------------------------------------------------------------------!>
    <HTML>
         <HEAD>
              <TITLE>Test</title>
         </head>
         <BODY BGCOLOR=EOFFFO>
              <B>I'm using connection and querying EMP names and
                   salaries from the EMP table in the schema SCOTT.
              </b>
              <P>
                   <%
                        try
                             Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:ORCL","scott","tiger");
                                  Statement stmt = conn.createStatement();
                                  String query = "SELECT empno, ename, sal FROM scott.emp ORDER BY ename";
                                  ResultSet rset = stmt.executeQuery(query);
                                  while(rset.next())
                                       out.println( "\n"
                             + "Employee No: " + rset.getInt("empno") + "\n"
                             + "Employee Name: " + rset.getString(2) + "\n"
                             + "Salary ($): " + rset.getFloat(3) + "\n"
                             stmt.close();
                        catch (SQLException e)
                             out.println("<P>" + "There was an error doing the query:");
                             out.println ("<PRE>" + e + "</pre> \n <P>");
                   %>
              </p>
         </body>
    </html>
    I got the error below:
    I'm using connection and querying EMP names and salaries from the EMP table in the schema SCOTT.
    There was an error doing the query:
    java.sql.SQLException: No suitable driver
    What is the driver? Where can I go to get it? How can I install it?
    Please help. Thank you.

    Hi
    First of all classess12.jar or ojdbc.jar must be in classpath of your web app (WEB-INF/lib) or server's extensions dir (usually SERVER_INST/lib/ext).
    MOST IMPORTANT:
    To use driver you must register it within DriverManager. Specification requires drievers to register within static initializer so to register driver you need to do:
    Class.forName("oracle.jdbc.driver.OracleDriver");
    before calling DriverManager.getConnection(...)
    should help
    cheers
    Kula

  • Import packageless classes in a jsp : tomcat 5.0.16

    Hi all,
    I am trying to import a class, say one.class, which is stored in the /WEB-INF/classes folder of the webapplication into a jsp page. Like,
    <%@page import="one"%>
    I get the following error,
    C:\jakarta-tomcat-5.0.16\work\Catalina\localhost\test\org\apache\jsp\testing_jsp.java:7: '.' expected
    import one;
    what could the problem be? I suppose, the problem is in accessing a class which is not inside a jar.
    take care,
    Siddharth.

    Hi,
    If you are using jdk 1.4 and above, you need to have package name for classes .
    You could just give a try after removing the import statement . Perhaps the server could find the classes in your WEB-INF/classes directory. I doubt though.
    -Amol

  • JSP + Tomcat start problems

    Hi all ,sorry fot desturbing with question that was descused befoure but I have problem to start JSP application on Tomcat server
    1.I have created folder named my_folder and set my application here
    2.I have created subfolder WEB-INF (but its empty because I want only to test deployment on Tomcat and I have only one file my_application.jsp)
    3. I have restarted the server
    4.I have typed in browser http://localhost:8080/my_folder/my_application.jsp
    And it doesnt work show me error 404
    Please somebody who can help with solving of this problem to write here
    10x.

    Try putting a basic web.xml file into the web-inf folder
    Tomcat 4
    <?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>
      <display-name>Welcome to Tomcat</display-name>
    </web-app>Tomcat 5
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
        version="2.4">
      <display-name>Welcome to Tomcat</display-name>
    </web-app>

  • Head First book & Tomcat setup

    I am currently reading Head First Servlets & JSP. In the first chapter it gives you a sample servlet to run(Ch1Servlet.java). It tells you to setup a directory OUTSIDE of /tomcat.
    /Project1
    /Project1/src
    /Project1/classes
    /Project1/etc
    On my computer it is setup as C:/Java/Project1
    Then it tells you to compile it from the command line like this:
    javac -classpath /your path/tomcat/common/lib/servlet-api.jar -d classes src/Ch1Servlet.java
    Here is what I used
    javac -classpath /Program Files/Apache Software Foundation/Tomcat 5.5/common/lib/servlet-api.jar -d classes src/Ch1Servlet.java
    This causes an error
    javac usage invalid: Files/Apache
    I am guessing this is because there are spaces in the classpath name. I copied the servlet-api.jar to the C:/Java folder and it compiled successfully. Without having to copy files to other folders how can I get around this error?
    Once you get it compiled it tells you to add the class files to the WEB-INF/classes directory and add the web.xml to the WEB-INF/etc directory. The book didn't explain where this directory is. I only imagined it being on its own in the Tomcat5.5 directory but it wasn't there. I looked under webapps and there is not a WEB-INF directory. What is the book trying to tell me?
    It also tells me once Tomcat is started to type in http://localhost:8080/ch1/Serv1. Under the web.xml file the mapping url is set to /Serv1 but the other description in servlet mapping is Chapter 1 Servlet. I don't see where the ch1 directory is. Can anyone help me with this?
    My system OS: Windows XP
    It also didn't explain why you would setup a directory outside of tomcat and then have to deploy your compiled classes back into tomcat. I am fairly new to Java and brand new to JSP. This part of the book seems to assume I know all this. Can anyone put me in the right direction?

    I am currently reading Head First Servlets & JSP. In
    the first chapter it gives you a sample servlet to
    run(Ch1Servlet.java). It tells you to setup a
    directory OUTSIDE of /tomcat.
    /Project1
    /Project1/src
    /Project1/classes
    /Project1/etc
    On my computer it is setup as C:/Java/Project1
    Then it tells you to compile it from the command line
    like this:
    javac -classpath /your
    path/tomcat/common/lib/servlet-api.jar -d classes
    src/Ch1Servlet.java
    Here is what I used
    javac -classpath /Program Files/Apache Software
    Foundation/Tomcat 5.5/common/lib/servlet-api.jar -d
    classes src/Ch1Servlet.java
    This causes an error
    javac usage invalid: Files/Apache
    I am guessing this is because there are spaces in the
    classpath name. I copied the servlet-api.jar to the
    C:/Java folder and it compiled successfully. Without
    having to copy files to other folders how can I get
    around this error?
    Add double quotes around your class path (e.g. javac -classpath "c: /Program Files/Apache Software Foundation/Tomcat 5.5/common/lib/servlet-api.jar ")
    Foundation/Tomcat 5.5/common/lib/servlet-api.jar -d
    classes src/Ch1Servlet.java
    Once you get it compiled it tells you to add the
    class files to the WEB-INF/classes directory and add
    the web.xml to the WEB-INF/etc directory. The book
    didn't explain where this directory is. I only
    imagined it being on its own in the Tomcat5.5
    directory but it wasn't there. I looked under webapps
    and there is not a WEB-INF directory. What is the
    book trying to tell me?
    You want to create a directory called ch1 under tomcat's webapps directory.
    Under the ch1 directory create a WEB-INF directory. And under WEB-INF create a
    classes directory.
    It also tells me once Tomcat is started to type in
    http://localhost:8080/ch1/Serv1. Under the web.xml
    file the mapping url is set to /Serv1 but the other
    description in servlet mapping is Chapter 1 Servlet.
    I don't see where the ch1 directory is. Can anyone
    help me with this?
    The url-pattern in the web.xml is what is used to access your servlet.
    Chapter1 Servlet is just a way to map from the servlet-class to the url-pattern.
    If you read further in the book all this will be explained.
    My system OS: Windows XP
    It also didn't explain why you would setup a
    directory outside of tomcat and then have to deploy
    your compiled classes back into tomcat. I am fairly
    new to Java and brand new to JSP. This part of the
    book seems to assume I know all this. Can anyone put
    me in the right direction?You want your source to be outside of tomcat. Once you have compiled everything,
    you then deploy to your container. Hope this helps

  • Is it possible for jsp(tomcat container)  access ejb deployed in sun app se

    if it's possible ,how to implement

    Hi,
    Yes it is possible for a JSP in tomcat container to lookup EJB in sun app server.
    Please refer following article for guidelines. If you need further help please revert back.
    http://www.onjava.com/pub/a/onjava/2003/02/12/ejb_tomcat.html?page=2
    HTH
    VJ

  • How can I pass a variable  value from first jsp page to thired jsp page

    In my program ,threr are three jsp pages . I want the first pages's variable value in to thired page .How can I acess.
    I used the request.getparameter() ,but when I print the value , null value is getting .

    request parameters only last for one request.
    To save them longer than that you need to save them somewhere.
    Couple of alternatives
    1 - store them to session
    session.setAttribute("username", request.getParameter("username");
    2 - create a hidden field on page 2 and store the value from page 1 there. When you submit page2, you can get it on page3 with request.getParameter again.
    <input type="hidden" name="username" value="<%= request.getParameter("username") %>">

  • JSP/Tomcat/MySQL

    Hello JSP developers!
    I have a problem trying to connect to MySQL database when I am doing a JSP or a servlet. I think the problem has to be with Tomcat, because when I do a java application with a database connection works perfectly, so there must be Tomcat.
    I am working with Java j2sdk1.4.0 and Netbean as my IDE. When I compile the JSP under the IDE does not give me any errors but when I try to see the result with Tomcat 4.0 does not seem to recognize the mm.mysql driver and gives me the following errors:
    Generated servlet error:
    D:\Apache Tomcat 4.0\work\localhost\_\JspMySQL$jsp.java:75: Class org.apache.jsp.Connection not found.
    Generated servlet error:
    D:\Apache Tomcat 4.0\work\localhost\_\JspMySQL$jsp.java:76: Class org.apache.jsp.ResultSet not found.
         ResultSet results;
    It gives me more errors, related to the connection. If you are willing to help me I can send you the exception report that Tomcat generates.
    I would really appreciate if you help me about this issue, because I am beginnig to get frustated.
    Thanks!!!!

    It appears that your JspMySQL.jsp does not import the java.sql package. Try adding the following line at the top of the JSP:
    <%@ page import="java.sql.*" %>

  • BEAN ITERATION IS THIS A BUG in JSP /TOMCAT?

    Hi,
    I am new to JSP but I cant understand why I am getting this problem. I am trying simply to loop thro' an array of beans and print out their value.
    A code sample is below:
    <%@ page import="subscription.*" %>
    <jsp:useBean id="event" class="subscription.EventBean"/>
    <%
    EventBean[] events = (EventBean[]) request.getAttribute("events");
    <%for (int i=0;i< events.length;i++) {
    event= events;
    %>
    <b>bean is</b><jsp:getProperty name="event" property="id" /> </b>
    <%}%>
    All I get is a list of event ids at 0 as opposed the the id values. It seems to not be referencing the new bean.
    If I change the jsp;getProperty to <%=event.getId()%> the correct ids are retrieved. I am using Tomcat 4.1.
    I can only think this is user error, as I have not found any similar listings
    Help would be welcomed!
    Emma.

    Hi,
    Thankyou for trying to help. Unfortuanately you solution does not work as
    you are assiging an object (EventBean) to an array of objects (EventBean).
    I can help thinking problem I am getting is because somehow when you do a
    <jsp:useBean> to instantiate a bean you can reassign it later on in a scriplet, which is what I am doing. Why you cant is not something I understand.
    Maybe it would help if I explained what I want to do. I am trying to get an array of beans from one jsp page and print them out in another.
    so my thoughts were (and ironically the text book I am using does exactly this)
    //instantiate an EventBean using
    <jsp:useBean id="event" class="subscription.EventBean"/>
    //get the attributes (they are attributs cos I am dispatching servlet to //jsp page)
    <% EventBean[] events = (EventBean[]) request.getAttribute("events"); %>
    //This now gives me the array of eventbeans I want to pring out and //rather than do it all in a scriplet try to use jsp tags which is what //all the bks say you should do.
    //so I iterate thro' array and assign my EventBean object that I //instantiated using the jsp:useBean
    <%
    for (int i=0;i< events.length;i++) {
    event= events;
    %>
    //now I try to print out a property (id in this instance)...
    <jsp:getProperty name="event" property="id" />
    <% } %>
    but IT DOES NOT WORK!! I have to go <%=event.getId() %>
    my bean is dead simple and works if I am doing simple stuff like setting and getting attributes on a single bean.
    Maybe I a not getting scoping in JSP , it is not that clear,like normal
    java code and any docs to look at would be welcomed.
    Emmma.

Maybe you are looking for

  • Maintenance view program for a table

    Hi All, How can i create a maintenance view program for a table. i did maintenance view in sm30 for that table. now it needs a transaction code for maintenance. can somebody help me with this. Thanks, Kiran

  • Event monitoring / notification - AQ, Alerts, or what ?

    I need to know whether Oracle Advanced Queuing, or some other Oracle database facility is able to support the event notification requirements for our event driven user interface. I am working on moving an application to Oracle (Oracle database is my

  • Problems with downloading Presenter

    I cannot download my trial of Adobe Presenter, this error has occured mulitple times. I have tried to delete all file and start over with no success. Exit Code: 7 Please see specific errors below for troubleshooting. For example,  ERROR: DS010 ... --

  • Accounts Planning

    Hello Experts, Is there anyways you can do planning for accounts and account groups in SAP ? if so, could any of you give me the procedure in details. I heard about the cost center planning but never any planning in FI. Also any reports in SAP to com

  • 11.1.5 upgrade - file location

    The instructions ask me to run psa.bat. Two problems - 1. I am on Linux. So what is this file called? 2. Also, where is this file on a Linux box? I have looked under $ORACLE_HOME/bin and it is not there. Any Help? Edited by: BIP Noob on Jul 10, 2011