Using a JavaBean in JSP

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

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

Similar Messages

  • Scope when using a JavaBean with JSP

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

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

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

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

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

  • Using additional jars in portal (jregex1.2_01.jar ) and use of javabeans

    Hi
    I want to use code that parses regular expressions with java and to that end I would like to use jregex1.2_01.jar (if there is a native jar file in oracle that does the same, that woule be good, but I could not find anything that refers to regex or jregex).
    I tried to put that new jar file in two locations in the portal area under WEB-INF\lib, namely in:
    C:\oracle\ora9ias\j2ee\OC4J_Portal\applications\portal\portal\WEB-INF\lib
    where there are a lot of other jar files and also in:
    C:\oracle\ora9ias\j2ee\OC4J_Portal\applications\jpdk\jpdk\WEB-INF\lib
    However, when I try to compile my code, it fails on the import line:
    import jregex.util.io.*;
    (the line itself is correct)
    Obviously the jregex1.2_01.jar file is not in my classpath, but when oracle was installed, it did not create a CLASSPATH environment variable, so I would not like to make one that may exclude others oracle jars that then are not listed in CLASSPATH.
    I have two questions:
    1. How does import additional jars into Oracle, so that they can be used by java programs, and are there any inherent dangers in doing that?
    2. Where do I place my class file, if I want to use that class file as a javabean. The bean will be referred to by a jsp file which has been imported as a portlet. I assumed I would place my beans under
    C:\oracle\ora9ias\j2ee\OC4J_Portal\applications\jpdk\jpdk\WEB-INF\lib
    as my jsp files are residing close to that, namely in:
    C:\oracle\ora9ias\j2ee\OC4J_Portal\applications\jpdk\jpdk\htdocs\myjsps
    but I am not sure.
    Can anyone help me with setting up additional jars so they can be used by java files (to be used as javabeans) and with the location and use of javabeans in Oracle Portal?
    Any help will be greatly appreciated.
    Thanks very much
    Hugo

    Hi Hugo,
    When developing server-side applications, forget about the CLASSPATH environment variable. You must instead become familiar with how the server's classloading scheme operates.
    From your post, it looks as though you already are familiar to some degree, because you have correctly identified one of the places to put extra jar files, namely WEB-INF/lib.
    At first glance, I would have expected your import to work with the jar file located in WEB-INF/lib - have you made sure you bounced the server?
    Also, make sure that any dependencies of jregex are also included in WEB-INF/lib.
    Another thing to try is add an entry into ${OH}/j2ee/OC4J_Portal/config/application.xml which explicitly references the jregex jar file.
    Regards,
    Gareth
    (PDK team)

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

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

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

  • The use of javabean in a servlet

    I used a javabean in (scope=application) a jsp, but now I want to use that bean in my servlet, can anybody show me how?

    why not share with others ??
    please write out

  • Why JavaBeans with JSP

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

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

  • How to use a javaBean in a servlet without FORMS...

    Hi,
    I would like to use a javaBean in a Servlet.
    I know how you can do this with the code
    HttpSession session = request.getSession();
    in your servlet.
    However, by using this code you have to call the servlet by a FORM. Is it possible to call the servlet (which calls the javaBean) in your JSP file without a FORM?
    Greetings
    Tigi

    Thanks Anthony,
    I'm working with Tigi on the same project and now I can tell you that the problem is solved.
    request.getRequestDisptacher("/myServlet");hehe, you switched the 't' and the 'a'
    <%@ include file="/myServlet" %>this is the one we use :)
    But what is the difference between the first one and the last one? Now We are using the last one because that's the shortest :) not a pretty good reason huh :)
    cheers,
    Soep

  • Calling JavaBean From JSP

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

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

  • Javabeans in JSP

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

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

  • When toe use a JavaBean versus a taglib?

    From my knowledge so far (probably basic knowledge) it appears that custom taglibs for an application could easily be used as java Beans.
    I was just reading a book which gave examples of how to use tags and create your own taglib for an application. It seems that all the taglib just is used to call functions, and a bean can be used in the same way.
    For example,
    <%@ taglib prefix = "myQuery" uri = "..." %>
    <%@ taglib prefix = "c" uri = " ... " %>
    ${myQuery.setId(1)} // Here to set any value really
    <c:set var = "items" value="${myQuery:getItems()}" scope="application" />
    My question is is this method OK to use the call to setId or should I use a Bean?
    <jsp:useBean id="myQuery" class="..." >
    <jsp:setProperty name="id" property="1">
    <c:set var = "items" value="${myQuery.getItems()}" scope="application" />

    Perhaps the Java Bean is not the proper way to
    connect with databases? I read about the sql tag,
    but I don't want all that stuff in my JSP page - I'd
    like it in the background.Good call. The JavaBean is the best place to put the DB stuff, not a taglib...
    If I have a Bean, that has a void function in it...The key is to call the void function from some other setter or getter funtion in the bean that JSTL will call:
    >
    For example, I have a class which is going to connect
    to a database and run queries. So, I would first
    set the properties needed by the query (<c: set
    target="...")Use the setter methods to store the values locally in the bean...
    run the queryNot yet....
    get the properties back (${someBean.someValue})This calls a Object getSomeValue() method. The first part of the getSomeValue method would be to call the 'run the query' function that connects to the database, does the SQL, etc, and returns a representation of the data. This method would then read that representation and convert it such that the web page can handle it.
    <general idea in code>
    private java.util.Map runQuery() {
        //get values needed for the connection
        makeDBConnection();
        ResultSet rs = getResultsOfQuery(/*whatever params*/);
        java.util.Map results = fillMapFromResultSet(rs);
        return results;
    public String getSomeValue() {
      java.util.Map results = runQuery();
      return (String) results.get("SomeValue");
    }>
    But how can I run the query without using a scriplet?
    I read about using a taglib for that, but if I create
    a separate tag and call the query function, wouldn't
    the Java Bean not have access to that?

  • How to use mxml in a jsp file?

    I'm trying to use flex in a .jsp file. I followed the
    suggestion that I use the Flex 2 Tag library as suggested by this
    link:
    http://labs.adobe.com/wiki/index.php/Flex_2_Tag_Library_for_JSP#Download_and_Installation
    but I couldn't find it. I also downloaded LiveCycle Data Services
    ES but couldn't find the flex-bootstrap.jar.
    I have a simple example:
    <!--<%@ taglib uri="FlexTagLib" prefix="mm" %>-->
    Use the <mxml> tag to insert a Flex application in an
    existing JSP page. The following example shows the <mxml> tag
    with the source attribute to include an external MXML file:
    <mm:mxml source="CustomerServiceChat.mxml"/>
    Alternatively, you can use the <mxml> tag with inline
    MXML source code, as the following example shows:
    <mm:mxml>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    xmlns="*">
    <mx:Text label="Hello World">
    </mx:Application>
    </mm:mxml>
    I also added the following code in my web.xml:
    <taglib>
    <taglib-uri>FlexTagLib</taglib-uri>
    <taglib-location>/WEB-INF/lib/flex-bootstrap.jar</taglib-location>
    </taglib>
    and obviously I get an error because I don't have the
    flex-bootstrap.jar file. Please let me know how this can be
    corrected. Thanks in advance!

    Adobe Newsbot hopes that the following resources helps you.
    NewsBot is experimental and any feedback (reply to this post) on
    its utility will be appreciated:
    Adobe - Developer Center : Flex quick start guide for PHP
    developers:
    Apr 30, 2007 ... In this example, I changed the result data
    type to XML with E4X support by setting .... In Flex you would
    download a file using this code:
    Link:
    http://www.adobe.com/devnet/flex/articles/php_getstarted.html
    2d. Tutorial - Flex 3 Getting Started - Adobe Learning
    Resources:
    See Calling XML Web Services over the Web Using the Web
    Service References ... For information on integrating PHP and Flex
    using AMF to encode the data,
    Link:
    http://learn.adobe.com/wiki/display/Flex/2d.+Tutorial
    Mike Potter: Flex and PHP - A simple sample:
    I have other example with PHP and MySql and give the same
    error, and a example .... Flex Data Services... I choose None (???)
    because I work with php and
    Link:
    http://blogs.adobe.com/mikepotter/2006/02/flex_and_php_a_1.html
    Adobe - Developer Center : Transmitting data between Flex and
    PHP:
    Sep 4, 2007 ... Now that the user interface is set up and
    ready to go you can add the HTTP services to go ask for the data
    from the PHP code. In Flex you
    Link:
    http://www.adobe.com/devnet/flex/articles/flex_php_json.html
    Integrating Adobe Flex and PHP:
    Mar 1, 2006 ... The first step is to download Flex Builder
    2.0 from the Adobe labs ... For example, you could use this same
    PHP script to pass data to a
    Link:
    http://devzone.zend.com/article/11-Integrating-Adobe-Flex-and-PHP
    Disclaimer: This response is generated automatically by the
    Adobe NewsBot based on Adobe
    Community
    Engine.

  • How to use switch statement in JSP?

    Hi,
    I am using switch satement in jsp.
    the code as follows:
    switch(flag)
         case 1: query="select * from cust";
                        break;
         case 2: query="select * from cust where minp="+mini+"and maxp="+maxi;
                        break;
        default: query="";
    out.println(query);but, i am getting some number format exception. I don't know where i am going wrong.
    Please help
    Regards,
    Ashvini

    I got the solution
    Thanks anyways
    Regards,
    AShvini

  • Using return statement in jsp

    Hi all,
    I am using return statement in JSP page after a redirect to stop executing that page. If the data bean is not present then it must go to previous page. When this return statement is executed the previous page is displayed but url in browser remains same. Why it is so ?. Is there any other way to tell a JSP page to stop executing and redirect to another page.
    rgds
    Antony Paul

    Hi Antony,
    do you use the "forward()" method or the "redirect()" method???
    rgds
    Howy

  • How to use connection pooling in jsp?

    I'm new to world of JSP. I'm developing web application using Oracle 8i and JSP to implement it. I'm using jakarta-tomcat server for this purpose.
    I'll frequently access the database. so I want to use the connection pooling.
    Can anybody explain the simple procedure to use it
    thanx

    Hello syyuen,
    Please help me, here iam sending u my server.xml , web.xml and servlet
    application. I put classes12.jar in tomcat/common/lib. and above servlet
    class application under tomcat/webapps/root/web-inf/classes
    and this is a simple servlet program for getting connection from the
    connection pool of tomcat using tyrex..
    my oracle database name is "myuser" and password is "mypass"
    either u check my server.xml or tell me where under which tag should i
    place <Resource...> tag in server.xml and should i need to modify any
    other places..??
    server.xml
    <Server port="8005" shutdown="SHUTDOWN" debug="0">
              <!-- Tomcat Stand-Alone Service -->
    <Service name="Tomcat-Standalone">
         <!-- Non-SSL HTTP/1.1 Connector on port 8080 -->
    <Connector className="org.apache.catalina.connector.http.HttpConnector"
    port="8080" minProcessors="5" maxProcessors="75"
    enableLookups="true" redirectPort="8443"
    acceptCount="10" debug="0" connectionTimeout="60000"/>
              <!-- AJP 1.3 Connector on port 8009 -->
    <Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
    port="8009" minProcessors="5" maxProcessors="75"
    acceptCount="10" debug="0"/>
              <!-- Top level container in our container hierarchy -->
    <Engine name="Standalone" defaultHost="localhost" debug="0">
         <!-- Global logger unless overridden at lower levels -->
    <Logger className="org.apache.catalina.logger.FileLogger"
    prefix="catalina_log." suffix=".txt"
    timestamp="true"/>
         <!-- Because this Realm is here, an instance will be shared globally
              <Realm className="org.apache.catalina.realm.MemoryRealm" /> -->
                   <!-- Replace the above Realm with one of the following to get a Realm
                   stored in a database and accessed via JDBC -->
                   <!-- <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
                        driverName="org.gjt.mm.mysql.Driver"
                        connectionURL="jdbc:mysql://localhost/authority?user=test;password=test"
                        userTable="users" userNameCol="user_name" userCredCol="user_pass"
                        userRoleTable="user_roles" roleNameCol="role_name" />
                   -->
    <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
              driverName="oracle.jdbc.driver.OracleDriver"
                   connectionURL="jdbc:oracle:thin:@oracle:1521:ORCL"
    connectionName = "mail"
    connectionPassword = "mail"
              userTable="users" userNameCol="user_name" userCredCol="user_pass"
                   userRoleTable="user_roles" roleNameCol="role_name" />
                        <!-- <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
                        driverName="sun.jdbc.odbc.JdbcOdbcDriver"
                        connectionURL="jdbc:odbc:CATALINA"
                        userTable="users" userNameCol="user_name" userCredCol="user_pass"
                        userRoleTable="user_roles" roleNameCol="role_name" />
                        -->
                   <!-- Define the default virtual host -->
    <Host name="localhost" debug="1" appBase="webapps" unpackWARs="true">
         <Valve className="org.apache.catalina.valves.AccessLogValve"
         directory="logs" prefix="localhost_access_log." suffix=".txt"
         pattern="common"/>
    <Logger className="org.apache.catalina.logger.FileLogger"
    directory="logs" prefix="localhost_log." suffix=".txt"
         timestamp="true"/>
                   <!-- Tomcat Root Context -->
                   <!-- <Context path="" docBase="ROOT" debug="0"/> -->
                   <!-- Tomcat Manager Context -->
    <Context path="/manager" docBase="manager" debug="0" privileged="true"/>
    <!-- MY CONTEXT HERE -->
         <Context path="/localhost" docBase="localhost" debug="0" reloadable="false" override="true">
              <Resource name="jdbc/myConnection" auth="SERVLET" type="javax.sql.DataSource"/>
              <ResourceParams name="jdbc/myConnection">
                   <parameter><name>user</name><value>myuser</value></parameter>
                   <parameter><name>password</name><value>mypass</value></parameter>
                   <parameter><name>driverClassName</name><value>oracle.jdbc.driver.OracleDriver</value></parameter>
                   <parameter>
                        <name>url</name>
                        <value>jdbc:oracle:thin:@oracle:1521:ORCL</value>
                   </parameter>
                   <parameter>
                        <name>maxActive</name>
                        <value>32</value>
                   </parameter>
                   <parameter>
                        <name>maxIdle</name>
                        <value>10</value>
                   </parameter>
              </ResourceParams>
    <!-- END OF MY Context, Oracle username=myuser,password=mypass -->
    <!-- i pasted this context from somebody . should i need whole context or resource name in that...???? -->
    <!-- Tomcat Examples Context
    <Context path="/examples" docBase="examples" debug="0" reloadable="true" crossContext="true">
    -->
    <!--
    <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_examples_log." suffix=".txt" timestamp="true"/>
         <Ejb name="ejb/EmplRecord" type="Entity" home="com.wombat.empl.EmployeeRecordHome" remote="com.wombat.empl.EmployeeRecord"/>
    <Environment name="maxExemptions" type="java.lang.Integer" value="15"/>
    <Parameter name="context.param.name" value="context.param.value" override="false"/>
    <Resource name="jdbc/EmployeeAppDb" auth="SERVLET" type="javax.sql.DataSource"/>
    <ResourceParams name="jdbc/EmployeeAppDb">
    <parameter><name>user</name><value>sa</value></parameter>
    <parameter><name>password</name><value></value></parameter>
    <parameter><name>driverClassName</name><value>org.hsql.jdbcDriver</value></parameter>
    <parameter><name>driverName</name><value>jdbc:HypersonicSQL:database</value></parameter>
    </ResourceParams>
    <Resource name="mail/Session" auth="Container" type="javax.mail.Session"/>
    <ResourceParams name="mail/Session">
    <parameter>
    <name>mail.smtp.host</name>
    <value>localhost</value>
    </parameter>
    </ResourceParams>
    -->
    </Context>
    </Host>
    </Engine>
    </Service>
         <!-- Define an Apache-Connector Service -->
    <Service name="Tomcat-Apache">
    <Connector className="org.apache.catalina.connector.warp.WarpConnector"
    port="8008" minProcessors="5" maxProcessors="75"
    enableLookups="true" appBase="webapps"
    acceptCount="10" debug="0"/>
                   <!-- Replace "localhost" with what your Apache "ServerName" is set to -->
    <Engine className="org.apache.catalina.connector.warp.WarpEngine"
    name="Apache" debug="0">
                   <!-- Global logger unless overridden at lower levels -->
    <Logger className="org.apache.catalina.logger.FileLogger"
    prefix="apache_log." suffix=".txt"
    timestamp="true"/>
                   <!-- Because this Realm is here, an instance will be shared globally -->
    <Realm className="org.apache.catalina.realm.MemoryRealm" />
    </Engine>
    </Service>
    </Server>
    web.xml
    <web-app>
    <servlet>
    <servlet-name>conServlet</servlet-name>
    <servlet-class>conServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>conServlet</servlet-name>
    <url-pattern> /conServlet </url-pattern>
    </servlet-mapping>
    <resource-ref>
    <description> Resource reference to java.sql.Connection
    factory defined in server.xml
    </description>
    <res-ref-name>jdbc/myConnection</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    </web-app>
    servlet application
    DataSource ds = (DataSource) new InitialContext().lookup("java:comp/env/jdbc/myConnection");
    conn = ds.getConnection();
    out.println("conn : " + conn);

Maybe you are looking for

  • Can't open SharePoint site in SharePoint Designer 2013 32Bit but can open Office 365.

    Hello.  I am running Windows 8.1 SharePoint Designer 2013 32Bit (15.0.4615.1000). I am unable to open any sites from our SharePoint 2013 OnPremise farm. I can however open sites from our Office 365 environment. I get the following error. "An error oc

  • Daily Backup for Boot Camp partition

    I'm looking for a Windows software to perform daily incremental backups from my Boot Camp partition to an external USB drive. It should also be possible to restore the COMPLETE Boot Camp partition from that backup in case of a hard drive failure. (It

  • Asset master search help

    Hi Hope someone could enlighten me on this. In the asset master display transaction (AS03), when I select F4 in the asset field, no value is generated when the company code and asset class field is entered with a value. However when only the asset cl

  • Why won't my Time capsule power on after shutting itself down?

    Why won't my Time capsule power on after shutting itself down?

  • Hardwear problem?

    Today when I went to repair disk permissions I noticed the top line in the drives was in red and says the the disk has a hardware problem that cannot be repaired! I repaired the disk permissions and all seems OK. The second line  "macintosh HD is OK?