Continuing with html and jsp

I have another problem, I am trying to print an image from my database into the img src areas...can someone please help me on this...I have hardcoded the image into the areas where i want them...so GK would be in the first row, the defenders in the next row, etc.
<table border=1>
<tr><td valign=top>
<table cellspacing=23 bgcolor="olivedrab">
     <tr>
     <td></td>
     <td></td>
     <td><img src="Z:\destination\web\images\AFC.gif" width="75" height="86"></td>
     <td></td>
     <td></td>
     </tr>
     <tr>
     <td><img src="Z:\destination\web\images\AFC.gif" width="75" height="86"></td>
     <td><img src="Z:\destination\web\images\AFC.gif" width="75" height="86"></td>
     <td></td>
     <td><img src="Z:\destination\web\images\AFC.gif" width="75" height="86"></td>
     <td><img src="Z:\destination\web\images\AFC.gif" width="75" height="86"></td>
     </tr>
     <tr>
     <td><img src="Z:\destination\web\images\AFC.gif" width="75" height="86"></td>
     <td><img src="Z:\destination\web\images\AFC.gif" width="75" height="86"></td>
     <td></td>
     <td><img src="Z:\destination\web\images\AFC.gif" width="75" height="86"></td>
     <td><img src="Z:\destination\web\images\AFC.gif" width="75" height="86"></td>
     </tr>
     <tr>
     <td></td>
     <td><img src="Z:\destination\web\images\AFC.gif" width="75" height="86"></td>
     <td></td>
     <td><img src="Z:\destination\web\images\AFC.gif" width="75" height="86"></td>
     <td></td>
     </tr>
</TABLE>
<TD align = right width = 200 valign=top>
<TABLE border=1><TR><TD align=center bgcolor=ffffc6>YOUR SQUAD</TD></TR>
<TR><TD valign=top>
     <TABLE cellspacing=5><TR><TD colspan=3><I>STARTING XI:</I></TD></TR>
                    <TR>
                    <TD width=40 align=center></TD>
                    <TD width=40 align=center></TD>
                    <TD width=40 align=center></TD>
                    </TR>
<BR>
<%
String email = (String)session.getAttribute("email");
Class.forName("org.postgresql.Driver");
// create connection url
String URL = "jdbc:postgresql://dbhost/ug59sxn";
// pass database parameters to JDBC driver
Connection Conn = DriverManager.getConnection(URL, "ug59sxn", "hupeswop");
// query statement
Statement SQLStatement = Conn.createStatement();
// generate query
String Query = "SELECT playertable.position, playertable.pname, playertable.cost, images.image FROM userteam, playertable, images " +
                         "WHERE userteam.email ='"+email+"' AND playertable.pid IN(p1id, p2id, p3id, p4id, p5id, p6id, p7id, p8id, p9id, p10id, p11id) AND playertable.club=images.club ";
// get result code
ResultSet SQLResult = SQLStatement.executeQuery(Query);
while(SQLResult.next())
          String pos = SQLResult.getString("position");
          String PId = SQLResult.getString("pname");
          String cost = SQLResult.getString("cost");
String im = SQLResult.getString("image");
          if (pos.equals("GK"))
               out.println("<tr><td bgcolor ='lightcoral'>" + pos + "</td><td bgcolor ='lightcoral'>" + PId + "</td><td bgcolor ='lightcoral'>" + cost + "m" + "</td></tr>");
          else if (pos.equals("DF"))
               out.println("<tr><td bgcolor ='khaki'>" + pos + "</td><td bgcolor ='khaki'>" + PId + "</td><td bgcolor ='khaki'>" + cost + "m" + "</td></tr>");
          else if (pos.equals("MF"))
               out.println("<tr><td bgcolor ='lightgreen'>" + pos + "</td><td bgcolor ='lightgreen'>" + PId + "</td><td bgcolor ='lightgreen'>" + cost + "m" + "</td></tr>");
          else
               out.println("<tr><td bgcolor ='darkturquoise'>" + pos + "</td><td bgcolor ='darkturquoise'>" + PId + "</td><td bgcolor ='darkturquoise'>" + cost + "m" + "</td></tr>");
// close connection
SQLResult.close();
SQLStatement.close();
Conn.close();
%>
</TABLE>
</BODY>
</HTML>

Since the HTML is interpreted on the client side the browser would be looking for the image on the user's local hard drive Z:/ (although probably not because the correct syntax would be file:// etc). You need to make the image paths relative to the root of your web server (eg: src="/images/myimage.gif"). If the images are not already available in a folder under your web server root you will need to make them so.
Ben

Similar Messages

  • I just updated my Firefox browser to Firefox 8. I am a college student and practice with HTML and CSS for class assignments. The fonts in all my html documents are being overwritten online by your script typeface. How do I resolve this issue?

    I just updated my Firefox browser to Firefox 8. I am a college student and practice with HTML and CSS for class assignments. The fonts in all my html documents are being overwritten online by your script typeface. I did not have this issue in the older version. I use an iMAC running OS10.6.8. How do I resolve this issue?

    Starting with this, you have errors in your CSS code.
    body {
      margin-top: 0px;
      margin-right: 0px;
      margin-bottom: 0px;
      margin-left: 0px;
      color: 151515;
      font-family: "Gill Sans", "Gill Sans MT", "Myriad Pro", "DejaVu Sans Condensed", Helvetica, Arial, sans-serif;
      background-color: EFF5F8;
    body {
      margin:0;
      color: #151515;
      font-family: "Gill Sans", "Gill Sans MT", "Myriad Pro", "DejaVu Sans Condensed", Helvetica, Arial, sans-serif;
      background-color: #EFF5F8;
      font-size: 100%;
    Related links:
    Windows Chrome, why do my fonts look so bad? - Lee Green
    css3 - Bad font rendering Chrome - Stack Overflow
    Nancy O.

  • How to master good design with EJB and JSP?

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

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

  • Where do I get started with OAS and JSP ?

    Where do I get started with OAS and JSP ?
    Resources?
    Please point me in the right direction!
    Post and/or email me at [email protected]

    The simplest way is to read OAS4082 Documentation:
    Developer's Guide: JServlet and JSP Applications.

  • Downloaded LR5 yesterday then installed LRCC today, get to 29 days left on trial panel, press "continue with trial" and get nothing ?

    Downloaded LR5 yesterday via installed Creative Cloud Ap. worked fine edited a few photos.
    Today I installed PSCC today and it worked fine.  Then installed LRCC , get to 29 days left on trial panel, press "continue with trial" and get nothing ?   Uninstalled then reinstalled no change, rebooted PC  still nothing. 
    Only a small (11.6" screen 4gb pentium)  netbook for backup and some editing while travelling but PSCC works fine.
    Not willing to purchase LRCC until I can get trial working.

    Hi Everyone,
    I found this on another forum. I tried it and it worked for me. Hope it works for you too:
    Same problem but solved :
    Go to MacHD/Library/Application support/Adobe/SLStore
    Delete the last licence file (will have a .lic extension with probably one ziffer). Be sure to delete the last one !
    Launch Lightroom again and connect with your Adobe ID

  • How WML and JSP can be configured in Tomcat 4.0 just as HTML and JSP

    hello all of my friends!
    Currently i am working on wap development but i cant find any thing to run my application, i am using Tomcat 4.0 can u plx help me and tell me how can i run Wml in tomcat( what configurations are required?) the application will work just as html-------JSP-Webserver.......ThankYou.

    You can work just like you did with html, but replace your content with wml-tags. I usually check for the accept-header in the http-reqest, to separate wap-users from web-useres:
    if(request.getHeader("accept").indexOf("text/vnd.wap.wml")>=0){
       response.setContentType("text/vnd.wap.wml");
    <xml version=1.0 DOCTYPE .........>
    <wml>
       <card ..>
    </wml>Also, your webserver must support this mimetype. Tomcat 4 has that, but to be sure, check in server.xml, it holds a long list of mime-associations.
    good luck

  • Pagination with orcale and jsp

    hi, i m new to java can any one tell me how to do pagination with my this codes
    String sqlCount = null;
    String sql = null;
    sql = "select * from HOME_LEASE_ ";
    sqlCount = "select count(*)from HOME_LEASE_ ";
    Enumeration e = request.getParameterNames();
    int i = 0;
    while(e.hasMoreElements()){
    String name = (String)e.nextElement();
    String search = new String(request.getParameter(name)).toUpperCase();
    if(i != 0 && (!search.isEmpty())){
    sql = sql +" and " + name +" like'" + search + "%'" ;
    sqlCount = sqlCount + " and " name" like '" + search + "%'" ;
    }else if((!search.isEmpty()) && (i == 0) ){
    sql = sql + " where " + name +" like '" + search + "%'" ;
    sqlCount = sqlCount + " where " + name+" like '" + search + "%'" ;
    ++i;
    if((sql != null) && (sqlCount != null)){
    DataAccess dB = new DataAccess();
    Connection conn = dB.getConnection();
    Statement stmtCount = dB.createStmt(conn);
    ResultSet rsCount = dB.executeQuery(sqlCount,stmtCount);
    rsCount.next();
    Statement stmt = dB.createStmt(conn);
    ResultSet rs = dB.executeQuery(sql,stmt);
    <% if(rs == null)
    out.println("<h3>No data found</h3>");
    else
    //out.println(rs.next());
    while(rs.next()) {
    //out.println("inside the result set");
    out.println("<tr>");
    out.println( "<td><a href=survey.jsp?phase="+ rs.getString("phase")+"&file_no="+rs.getString("FILE_NO")+">"+ rs.getInt("phase") + "</a></td>");
    out.println( "<td><a href=survey.jsp?phase="+ rs.getString("phase")+"&file_no="+rs.getString("FILE_NO")+">"+ rs.getInt("file_no") + "</a></td>");
    out.println( "<td><a href=survey.jsp?phase="+ rs.getString("phase")+"&file_no="+rs.getString("FILE_NO")+">"+ rs.getString("se") + "</a></td>");
    out.println( "<td><a href=survey.jsp?phase="+ rs.getString("phase")+"&file_no="+rs.getString("FILE_NO")+">"+ rs.getString("str") + "</a></td>");
    out.println( "<td><a href=survey.jsp?phase="+ rs.getString("phase")+"&file_no="+rs.getString("FILE_NO")+">"+ rs.getString("qrno") + "</a></td>");
    out.println( "<td><a href=survey.jsp?phase="+ rs.getString("phase")+"&file_no="+rs.getString("FILE_NO")+">"+ rs.getString("typ") + "</a></td>");
    out.println( "<td><a href=survey.jsp?phase="+ rs.getString("phase")+"&file_no="+rs.getString("FILE_NO")+">"+ rs.getInt("perno") + "</a></td>");
    out.println( "<td><a href=survey.jsp?phase="+ rs.getString("phase")+"&file_no="+rs.getString("FILE_NO")+">"+ rs.getString("name") + "</a></td>");
    out.println( "<td><a href=survey.jsp?phase="+ rs.getString("phase")+"&file_no="+rs.getString("FILE_NO")+">"+ rs.getInt("total_plot_area_ocp") + "</a></td>");
    out.println( "<td><a href=survey.jsp?phase="+ rs.getString("phase")+"&file_no="+rs.getString("FILE_NO")+">"+ rs.getInt("TOT_PREM_AREA") + "</a></td>");
    out.println( "<td><a href=survey.jsp?phase="+ rs.getString("phase")+"&file_no="+rs.getString("FILE_NO")+">"+ rs.getInt("total_construction") + "</a></td>");
    out.println( "<td><a href=survey.jsp?phase="+ rs.getString("phase")+"&file_no="+rs.getString("FILE_NO")+">"+ rs.getLong("chargbl_construction") + "</a></td>");
    out.println( "<td><a href=survey.jsp?phase="+ rs.getString("phase")+"&file_no="+rs.getString("FILE_NO")+">"+ rs.getLong("add_open_construction") + "</a></td>");
    out.println( "<td><a href=survey.jsp?phase="+ rs.getString("phase")+"&file_no="+rs.getString("FILE_NO")+">"+ rs.getLong("TOT_PREM_AREA") + "</a></td>");
    out.println( "<td><a href=survey.jsp?phase="+ rs.getString("phase")+"&file_no="+rs.getString("FILE_NO")+">"+ rs.getLong("plinth") + "</a></td>");
    out.println( "<td><a href=survey.jsp?phase="+ rs.getString("phase")+"&file_no="+rs.getString("FILE_NO")+">"+ rs.getLong("std_plot_area") + "</a></td>");
    out.println("</tr>");
    dB.close(rsCount);
    dB.close(stmtCount);
    dB.close(rs);
    dB.close(stmt);
    dB.close(conn);
    }else{
    out.println("<center style=\"background-color:red\">Please enter values in text fields<h1></h1></center>");
    %>

    After examining your code, I think:
    You are not using JSP/HTML properly (using java to write out HTML). You can spend a tremendous amount of time with trial and error approaches in learning a technology and still not get much real understanding for your effort. I suggest a better use of those hours would be spent in reading a book on Java first, then a book on JSP. For a book on JSP, go to amazon.com and search for 'Javaserver pages'. Find a book that isn't too old and that has good reviews. Here is one (although its a bit dated):
    http://www.amazon.com/JavaServer-Pages-Edition-Hans-Bergsten/dp/0596005636/ref=sr_1_1?s=books&ie=UTF8&qid=1338821741&sr=1-1
    As far your database code goes, I suggest you read on-line articles on JDBC on how to get/use/close a database connection in a try/catch/finally block. The article will probably also help you write better SQL too. I don't think your question on pagination should be tackled until you learn JSP.

  • Help with HTML and JAVA

    Hi.
    I'll have this question, and can't find the right answer...
    Suppose is this site called xyz.com and you need to register to be a member
    For simplicity member log-in page is simple...contains only login and password fields(Submit too) in HTML code:
    <html>
    <body>
    <form name="input" action="html_form_action.asp" method="get">
    User ID: <input type="text" name="ID" /><br />
    Password: <input type="password" name="pwd" /><br />
    <input type="submit" value="Submit" />
    </form>
    </body>
    </html>Will I be able to build a Java application witch will:
    1-Send me to this web-page
    2-Place my chosen id and password in the right place
    3-"Press" Submit button.
    So I open this Java Swing application , and Go button will send me to the members page of my xyz.com page.
    Thank you for the help.

    altisw5 wrote:
    Go button will send me to the members page of my xyz.com page.It depends on what you mean by "send me".
    If you mean access data on the members page through your program, yes.
    If you mean open a browser window to that page, I guess doable but might be tricky (with Robot and stuff).
    If you mean physically send you on the internet, no.

  • Send email with html and images over Sockets

    Hi! I'm sending email messages through sockets with html. So far is working great. But now, I need to include images in the html code, like a web page. I don't have any idea on how to do this. Sending image apart from the html code is not big deal, but how to put it in the code. I mean how to make this html code, work:
    <table border="0">
         <tr>
              <td>Image in code</td>
         </tr>
         <tr>
              <img src="what to put here"/>
         </tr>
    </table>This is the code that I'm using to send the html mail:
    StringBuffer retBuff = new StringBuffer();
              //BufferedReader msg;
              //msg = new BufferedReader(msgFileReader);
              smtpPipe = new Socket(mailHost, SMTP_PORT);
              smtpPipe.setSoTimeout(120000);
              if (smtpPipe == null) {
                   return retBuff;
              inn = smtpPipe.getInputStream();
              outt = smtpPipe.getOutputStream();
              in = new BufferedReader(new InputStreamReader(inn));
              out = new PrintWriter(new OutputStreamWriter(outt), true);
              if (inn == null || outt == null) {
                   retBuff.append("Failed to open streams to socket.");
                   return retBuff;
              String initialID = in.readLine();
              retBuff.append(initialID);
              retBuff.append("HELO " + localhost.getHostName());
              out.println("HELO " + localhost.getHostName());
              String welcome = in.readLine();
              retBuff.append(welcome);
              retBuff.append("MAIL From:<" + from + ">");
              out.println("MAIL From:<" + from + ">");
              String senderOK = in.readLine();
              retBuff.append(senderOK);
              for (int i = 0; i < to.length; i++) {
                   retBuff.append("RCPT TO:<" + to[i] + ">");
                   out.println("RCPT TO:<" + to[i] + ">");
                   String recipientOK = in.readLine();
                   retBuff.append(recipientOK);
              retBuff.append("DATA");
              out.println("DATA");
              out.println("From: Steren <" + from + ">");
              out.println("Subject: " + subject);
              out.println("Mime-Version: 1.0;");
              out.println("Content-Type: text/html; charset=\"ISO-8859-1\";");
              //out.println("Content-Type: multipart/mixed; charset=\"ISO-8859-1\";");
              //out.println("Content-Transfer-Encoding: 7bit;");
              //String line;
              //while ((line = msg.readLine()) != null) {
              //     out.println(line);
              out.println(msg);
              retBuff.append(".");
              out.println(".");
              String acceptedOK = in.readLine();
              retBuff.append(acceptedOK);
              retBuff.append("QUIT");
              out.println("QUIT");
              return retBuff;

    Throw all this away and use one of the numerous existing Java mail packages, such as javax.mail for a start.

  • Creating FOrums with Servlet and JSP

    Hi everyone,
    Is there a good resource that explains how to build a forum using servlets and JSP technology?
    Regards,
    Basil Mahdi

    please let me know here if you find any useful resources...I am in the process of writing my own searchable threaded forum for my company with JSP's/servlets. It's a very slow process at the moment though...if I ever finish it, I'll gladly share it.

  • Connecting databeses with WML and JSP pages..!

    I need information about how to connect databases with wap technologies using wml and jsp , I am waiting your resources, codes and helps.. And I would like to remind you , I am beginner about this topic , Only things that I know are Jsp and WML , I have no experience about wap and how to combine wml and jsp , So please be helper while you send your messages , If all your messages contains much detailed and supported complete sources and files , it will more helpfull for me ..
    Thanks in Advance.
    P.S : 1- ) if you want to contact direclty , mail address : [email protected]
    2-) Don't post me complex references' URL , I have already made search on google,yahoo and etc

    Additionally , I would like to learn what I have to need for this project .. Now , I already have winwap wap emulator and Websphere Studio.. Do I need special wap server or something else to test my applications..
    Please , hurry up .. I really need your helps..
    Ergin

  • I'm new with HTML and CSS, need help

    I'm creating a static html webpage for an assignment. Someone suggested to me that I could manually create my webpage using dreamweaver instead of creating it from scratch, which has turned out much easier. However one of the tasks require me to Create a CSS stylesheet to work with my structural HTML. So my question is where is the CSS code inspector (if there is one). Is it possible for me to somehow add this and link it to my HTML?
    Sorry if my question isn't clear, I'm quite new to this and have only a general idea of what I am doing.

    Because the assignment requires me to submit the css and html separately. It means both have to be done is separate  Notepad files (this is where I will paste the code from dreamweaker to submit).
    I'll save the html as hompage.html and the CSS as homepage.css
    So I don't know if I can use option 2.
    My teacher wants to be able to open my css and amend it so that all her amendments actually work with my html.
    So lets say this is my html that I copy from dreaweavers inspector:
    <html>
    <head>
    <title>Search Engine Title Goes Here</title>
    <link rel="stylesheet" type="text/css" href="hompage.css">
    </head>
    <body>
    <div id="container"> </div>
    <div id="header"> Header Goes Here</div>
    <div id="sidebar"> Left Navigation Goes Here</div>
    <div id="content"> <p>Content Goes Here</p></div>
    <div id="footer"> Footer Goes Here </div>
    </body>
    </html>
    How would I write my css, would it be like this? (assume this is my homepage.css file):
    body {background: #ffffff; margin: 0; padding: 0;}
    a {color: #2b2bf6;}          
    #container {width: 900px; margin: 0; padding: 0; background: #dddddd;}          
    #header {width: 900px; height: 150px; margin: 0; padding: 0; border: 0; background: #f346e1;}          
    #sidebar {width: 200px; height: 400px; margin: 0; padding: 0; border: 0; float: left; background: #f0e811;}          
    #content {width: 700px; height: 400px; margin: 0; padding: 0; border: 0; float: left; background: #8be0ef;}          
    #footer {width: 900px; height: 70px; margin: 0; padding: 0; border: 0; float: left; background: #000000; clear:both;}                           
    I saw this example on the internet, would this work?

  • Flash embed tag does not obey percentage size, even with html and body at 100%

    For some reason i cannot get this swf file to show at 90% width and height. i have tried adding a style sheet in the header to explicity set the html and body to 100% but this still does not help. can anyone see if there is a problem in the code?
    <pre><nowiki><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title></title>
    <style type="text/css">
    html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    </style>
    </head>
    <body>
    <center>
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="90%" height="90%" ID="Captivate1">
    <param name="movie" value="tutorial.swf">
    <param name="quality" value="high">
    <param name="menu" value="false">
    <param name="loop" value="0">
    <embed src='tutorial.swf' width='90%' height='90%' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash'/>
    </object>
    <BR>
    <p>
    <align=center><a Href="javascript:window.close();">Close Window</a>
    </p>
    </center>
    </body>
    </html></nowiki></pre>

    That may happen because of the &lt;center&gt; element that doesn't have a height and width specified. Remember to specify dimensions for all containers if you use percentages, otherwise you may end up with 90% of 0 or a default value.

  • How best to store 10KB file with html and javascript

    Hello,
    I am using Oracle 11g and pl/sql.
    I want to store a 10KB of text into a table. The text has many html and javascript characters.
    What type of table column should be used for text of this size and type?
    What is the best or easiest way to get the text into the table on a regular basis?
    Should I read it from a file? Or, ideally, I would like to paste the text into a textbox in the same way it is done here when submitting questions to this forum.
    Any suggestions are greatly appreciated.

    CLOB

  • Problem with JNDI and JSP in Tomcat

    Hi,
    Basically, what I've done is to use the Tomcat administration web
    application to create the DataSource, which looks like it populated the
    server.xml (see below). I then try to access the testconn.jsp, and am
    getting that "Name java:comp is not bound in this Context" error.
    I was wondering if anyone could tell me what I'm doing wrong?
    Thanks,
    Feri
    My Configuration:
    - Tomcat 5.0.19
    - MySQL 4.0.18-nt
    - mysql-connector-java-3.0.15-ga-bin.jar
    server.xml:
    <GlobalNamingResources>
    <!-- Test entry for demonstration purposes -->
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
    <!-- Editable user database that can also be used by
    UserDatabaseRealm to authenticate users -->
    <Resource name="UserDatabase" auth="Container"
    type="org.apache.catalina.UserDatabase"
    description="User database that can be updated and saved">
    </Resource>
    <ResourceParams name="UserDatabase">
    <parameter>
    <name>factory</name>
    <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
    </parameter>
    <parameter>
    <name>pathname</name>
    <value>conf/tomcat-users.xml</value>
    </parameter>
    </ResourceParams>
    <!--Feri test JNDI-->
         <Context crossContext="true" debug="5" docBase="injury" path="/injury" reloadable="true">
         <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_injury_log." suffix=".txt" timestamp="true"/>
              <Resource name="jdbc/injury" auth="Container"
    type="javax.sql.DataSource">
    </Resource>
    <ResourceParams name="jdbc/injury">
         <parameter>
              <name>factory</name>
              <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
         </parameter>
    <parameter>
    <name>username</name>
    <value>root</value>
    </parameter>
    <parameter>
    <name>password</name>
    <value>root</value>
    </parameter>
         <parameter>
    <name>driverClassName</name>
    <value>com.mysql.jdbc.Driver</value>
    </parameter>
         <parameter>
    <name>url</name>
    <value>jdbc:mysql://localhost:3306/injury</value>
    </parameter>
         <parameter>
              <name>maxIdle</name>
              <value>30</value>
         </parameter>
         <parameter>
              <name>maxActive</name>
              <value>10</value>
         </parameter>
         <parameter>
              <name>maxWait</name>
              <value>10000</value>
         </parameter>
    </ResourceParams>
         </Context>
    <!--Feri test JNDI end-->
    </GlobalNamingResources>
    \webapps\injury\WEB-INF\web.xml:
    <resource-ref>
    <description>Resource reference to a factory for java.sql.Connection instances that may be used for talking to a particular database that is configured in the server.xml file.</description>
    <res-ref-name>jdbc/injury</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    \webapps\injury\testconn.jsp
    <%@ page import="java.sql.*" %>
    <%@ page import="javax.sql.*" %>
    <%@ taglib prefix="ct" uri="/injury" %>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
    <h1>Connection test</h1>
    <ct:connection name="jdbc/injury">
    <%
    Statement stmt= conn.createStatement();
    ResultSet rs;
    rs = stmt.executeQuery("select * from user");
    while (rs.next()){
    %><%=rs.getString(1)%><%=rs.getInt(2) %><br><%
    rs.close();
    stmt.close();
    %>
    </ct:connection>
    ConnectionTag.java
    import java.io.*;
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;
    import javax.naming.*;
    import javax.sql.*;
    import javax.sql.DataSource;
    public class ConnectionTag extends TagSupport implements TryCatchFinally {
    private Connection conn;
    // JNDI name of the connection
    private String name;
    public void setName(String name)
         this.name = name;
    public int doStartTag()
         throws JspException
         try {
         Context env = (Context) new InitialContext().lookup("java:comp/env");
         DataSource ds = (DataSource) env.lookup(name);
         if (ds != null)
              conn = ds.getConnection();
         } catch (Exception e) {
         throw new JspException(e);
         if (conn == null)
         throw new JspException("can't open connection " + name);
         pageContext.setAttribute("conn", conn);
         return EVAL_BODY_INCLUDE;
    public void doCatch(Throwable t)
         throws Throwable
         throw t;
    public void doFinally()
         try {
         Connection conn = this.conn;
         this.conn = null;
         pageContext.removeAttribute("conn");
         conn.close();
         } catch (Exception e) {
    Tomcat 5.0\conf\Catalina\localhost\injury.xml
    <?xml version='1.0' encoding='utf-8'?>
    <Context displayName="Injury" docBase="E:\Tomcat 5.0\webapps\injury" path="/injury" className="org.apache.catalina.core.StandardContext"
    cachingAllowed="true" charsetMapperClass="org.apache.catalina .util.CharsetMapper" cookies="true" crossContext="false" debug="0"
    mapperClass="org.apache.catalina.core.StandardContextMapper" useNaming="true" wrapperClass="org.apache.catalina.core.StandardWrapper" >
    <Resource auth="Container" description="Resource reference to a factory for java.sql.Connection instances that may be used for talking to a particular database that is configured in the server.xml file." name="jdbc/injury" type="javax.sql.DataSource"/>
    <ResourceLink global="jdbc/injury" name="injury" type="javax.sql.DataSource"/>
    </Context>

    Hi,
    First of all, you can find alot of information about this in the forum about jsp's.
    I think a good thing to do is not to put your context tag directly into the server.xml file.
    What you should do is create a context.xml file with the context-tag in it, and put it in the META-INF directory of your .war file. Upon deployment to tomcat5 this file will be extracted from the war, copied to the conf\enginename\hostname directory, and it will be renamed to contextName.xml.
    I think you are developing directly into the webapps directory, and I believe you should avoid that and use the deployment feature of the manager web-app or you should use the deployertool from you ide or standalone ant.
    anyway, for starters try to remove the context tag from the server.xml file as described above, and check out the jsp / jdbc forums for simular problems and answers.
    good luck

Maybe you are looking for

  • Error while creating new entity object.

    Hi all I'm using Jdev 11.1.1.3. I want to create an entity object and Jdev issues an information error saying "Either this is not a valid name or an object with that name already exists." I found that if the package I'm targeting for the new entity i

  • Is there a Version 4 soon or is it OK to buy now?

    I want to buy the unlimited version and am not familiar with the upgrade history. I see in the past you have to pay full price for next version even if you buy within the same month Thanks

  • Need to override CSS style for link

    I've set up a page with an external style sheet. I have a link within a heading that I want to look different from my CSS link style (I want it to match the heading). Is there a way to override the basic style? I tried setting up a class and that did

  • Send me link to learn about LSMW - Direct input

    hi Pls send me link to learn about LSMW - Direct input

  • Is it mandatory to IMPORT a transport into TEST,after RELEASING it fromDEV?

    Hi Experts, I made a mistake that, Actually, I want to DELETE a TRansport, so, first, i wanna to delete the child , so, I highlighted the child but, by mistake I pressed the red truck button....its RELEASED!!!! So, Wht I hv to do now? my intention is