Database Access through JSP
Hi im trying to access my ORACLE database through a jsp program. The page loads up in the browser, no errors or anything like that, but i get no output.
I am running things on localhost with TomCat 3.2.3
Here is the code, any help gratefully appreciated.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Testing Database Access</TITLE>
</HEAD>
<BODY BGCOLOR="#FDF5E6" TEXT="#000000" LINK="#0000EE"
VLINK="#551A8B" ALINK="#FF0000">
<CENTER>
<TABLE BORDER=5 BGCOLOR="#EF8429">
<TR><TH CLASS="TITLE">
Testing Database Access</TABLE>
</CENTER>
<P>
<P>
Here Is what Might be in the Database
<P>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="oracle.jdbc.driver.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%
try
%>
<%
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
String username = "Donnchadh", password = "zcbu5mya";
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@kiwi.isg.computing.dcu.ie:1521:kiwi",username,password);
java.sql.Statement stmt = conn.createStatement();
String query = "SELECT * FROM PERSONALS";
ResultSet rs = stmt.executeQuery(query);
while(rs.next())
int ccount = rs.getMetaData().getColumnCount();
for( int i = 1; i <= ccount; i++ )
System.out.print(rs.getString(i)+"\t");
System.out.println();
%>
<%
rs.close();
stmt.close();
if(conn != null)
try
conn.close();
catch(Exception e)
return;
catch(Exception e)
return;
%>
<P>
</BODY>
</HTML>
I have also tried to access columns directly with this code in the while loop
while(rs.next())
String Title = rs.getString("title");
String FName = rs.getString("fname");
String LName = rs.getString("lname");
String Phone = rs.getString("phone1");
String Phone2 = rs.getString("phone2");
String Addr = rs.getString("addr");
String County = rs.getString("county");
String Country = rs.getString("country");
out.println("<tr><td>" + Title + "</td><td>" + FName + "</td><td>" + LName
+ "</td><td>" + Phone + "</td><td>" + Phone2 + "</td></tr>" + "</td></tr>" + Addr
+ "</td></tr>" + County + "</td></tr>" + Country + "</td></tr>" );
i give a servlet access to oracle ,that have test ok!
import java.sql.*;
import javax.servlet.*;
import javax.sql.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class TestServlet1 extends HttpServlet {
private static final String CONTENT_TYPE = "image/jpeg; charset=GBK";
//Initialize global variables
String strRno =null;
ResultSet rs=null;
byte [] buf=null;
InputStream in;
int IntNo;
public void init() throws ServletException {
//Process the HTTP Get request
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType(CONTENT_TYPE);
// PrintWriter out = response.getWriter();
// System.out.println("TEst database prepaired ok��");
strRno = request.getParameter( "PictNo" );
IntNo = 0;
if( strRno != null ) {
try { IntNo = Integer.parseInt( strRno ); }
catch( NumberFormatException e ) {
strRno = null;
System.out.println("��������������������"); }
else
System.out.println("��������������������");
if( strRno == null ) {
// response.sendError( HttpServletResponse.SC_NOT_FOUND );
return;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
catch (ClassNotFoundException ex2) {
// out.println("TEst2��");
// System.out.println("TEst2�� ex2��");
String url="jdbc:oracle:thin:@erdos00:1521:erdos";
Connection con = null;
try {
con = DriverManager.getConnection(url, "system", "manager");
catch (SQLException ex1) {
//out.println("TEst�� ex1");
System.out.println("TEst�� ex1��");
// PreparedStatement sql=con.PrepareStatement("select photo from blob_test WHERE rno = IntNo" );
PreparedStatement sql = null;
try {
sql = con.prepareStatement("select photo from blob_test WHERE rno = 14 ");
// sql = con.prepareStatement("select photo from blob_test WHERE rno = " +"+ IntNo +" );
catch (SQLException ex) {
//out.println("TEst�� ex");
System.out.println("TEst�� ex��");
//method prepareStatement(sting) not found in interface java.sql.connection
// sql.setInt( 1, rno );
try {
rs = sql.executeQuery();
catch (SQLException ex3) {
//out.println("TEst�� ex3");
System.out.println("TEst�� ex3");
System.out.println("TEst database operate ok��");
// out.println("TEst database operate ok��");
//��������������������
try {
if (rs.next()) {
buf = rs.getBytes(1);
in = rs.getBinaryStream("photo");
else {
buf = new byte[0];
}catch (Exception e){
//throw e;
response.reset();
//������image/jpeg������������������������
response.setContentType("image/bmp");
// ��bmp��jpeg
byte[] b = new byte[1024*1024];
int len;
while((len=in.read(b)) >0)
response.getOutputStream().write(b,0,len);
OutputStream out1 = response.getOutputStream();
out1.flush();
out1.write(buf);
in.close();
try {
rs.close();
catch (SQLException ex4) {
// out.println("<html>");
// out.println("<img src='http://192.168.0.1/examples/servlet/TestServlet1?PictNo="+IntNo+"'>");
// out.println("</html>");
out.println("<html>");
out.println("<head><title>TestServlet</title></head>");
out.println("<body bgcolor=\"#ffffff\">");
out.println("<p>The servlet has received a GET111111111. This is the reply.</p>");
out.println("</body></html>");
//Process the HTTP Post request
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head><title>TestServlet</title></head>");
out.println("<body bgcolor=\"#ffffff\">");
out.println("<p>The servlet has received a POST. This is the reply.</p>");
out.println("</body></html>");
//Process the HTTP Put request
public void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//Process the HTTP Delete request
public void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//Clean up resources
public void destroy() {
hope u can get some thing from that
Similar Messages
-
Can I easily access MS access using JSP? If it is, what kind of drive should be used to access the MS Access database?
Thank you so much!<%!
// define database parameters
String host="localhost";
String user="";
String pass="";
String db="";
String conn;
%>
<%
Class.forName("org.gjt.mm.mysql.Driver");
// create connection string
conn = "jdbc:mysql://" + host + "/" + db + "?user=" + user + "&password=" +
pass;
// pass database parameters to JDBC driver
Connection Conn = DriverManager.getConnection(conn);
// query statement
Statement SQLStatement = Conn.createStatement();
This is when accessing a database in a JSP, not a javabean... Try searching this forum, there are LOTS of topics about this. -
Portal 3 Profile access through JSP on iws6
Hi,
I have portal 3 sp4 and iws6 installed on the same server. The portal basically has URL scrappers of the web server. I want to access the user profile from the JSP sitting on the iws6.
For this i have added the following lines in the JSP
<%@ page import="java.io.*"%>
<%@ page import="java.util.*"%>
<%@ page import="com.iplanet.portalserver.naming.*"%>
<%@ page import="com.iplanet.portalserver.session.*"%>
<%@ page import="com.iplanet.portalserver.profile.*"%>
<%
try{
SessionID sid = null;
Session sess = null;
sid = new SessionID(request);
sess = Session.getSession(sid);
Profile profile = sess.getUserProfile();
catch(Exception e)
%>
Exception Occured
<%
out.println(" Error Message "+e);
When i try to access the JSP it is throwing the following exception.
com.iplanet.portalserver.session.SessionException: Invalid service host name .
What do i have to do to access the profile info of the user from the JSP.
Any suggestion is welcome.
Regards
Girirajyou need to allow cookies through to your web server; the client component on the web server
and try to determine your portal and its not
being passed thru. -
Database access with JSP custom tags
i have created one file in which i am making the connection with mysql data base with con.mysql.jdbc.Driver.and usking J connector and that i'm doing with custom tag.this is the error which i'm getting in tomcat.
and the tag handler class and TLD file and jsp file is below
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: javax.servlet.jsp.JspException: null
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl .java:841)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.j ava:778)
org.apache.jsp.DbTry_jsp._jspService(org.apache.jsp.DbTry_jsp:72)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NullPointerException
Try.Connect.<init>(Connect.java:26)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
java.lang.reflect.Constructor.newInstance(Unknown Source)
java.lang.Class.newInstance0(Unknown Source)
java.lang.Class.newInstance(Unknown Source)
org.apache.jasper.runtime.TagHandlerPool.get(TagHandlerPool.java:116)
org.apache.jsp.DbTry_jsp._jspx_meth_db_connect_0(org.apache.jsp.DbTry_jsp:84)
org.apache.jsp.DbTry_jsp._jspService(org.apache.jsp.DbTry_jsp:62)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.4 logs.
Apache Tomcat/5.5.4
Tag handler class
package Try;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.TagSupport;
import java.sql.*;
public class Connect extends TagSupport {
private String driver = "com.mysql.jdbc.Driver";
private String dbtype = "mysql";
private String host = "localhost";
private String username = "root";
private String password = "203131";
private String database = "compose";
private String scope = "page";
private String id = "";
JspWriter out = pageContext.getOut();
public void setDriver(String str) {
driver = str;
public void setDbtype(String str) {
dbtype = str;
public void setHost(String str) {
host = str;
public void setUsername(String str) {
username = str;
public void setPassword(String str) {
password = str;
public void setDatabase(String str) {
database = str;
public void setScope(String str) {
scope = str;
public void setId(String str) {
id = str;
public int doStartTag() throws JspException {
try {
Class.forName("com.mysql.jdbc.Driver");
String url= "jdbc:" + dbtype + "://" + host + "/" + database;
Connection connection = DriverManager.getConnection(url,username,password);
out.println("right ;;one");
catch (SQLException e1) {
System.out.println("Error in HeadingTagv: " + e1);
catch (Exception e) {
System.out.println("Error in HeadingTag: " + e);
return SKIP_BODY;
TLD is lib.tld
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_2.dtd">
<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>db</short-name>
<display-name>Database Tags</display-name>
<description>
A set of tags for working with SQL database access
</description>
<tag>
<name>connect</name>
<tag-class>Try.Connect</tag-class>
<body-content>empty</body-content>
<description>
</description>
<attribute>
<name>driver</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description>
</description>
</attribute>
<attribute>
<name>dbtype</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description>
</description>
</attribute>
<attribute>
<name>host</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description>
Can be given by a run-time expression.
Host name of the computer where database is located.
Default is "localhost".
</description>
</attribute>
<attribute>
<name>username</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description>
Can be given by a run-time expression.
Username for logging onto the database.
Default is "root".
</description>
</attribute>
<attribute>
<name>password</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description>
Can be given by a run-time expression.
Password for logging onto the database.
Default is the empty string.
</description>
</attribute>
<attribute>
<name>database</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description>
Can be given by a run-time expression.
The name of the database that will be used for
the SQL commands. Default is no database specified.
</description>
</attribute>
<attribute>
<name>id</name>
<required>false</required>
<description>
</description>
</attribute>
<attribute>
<name>scope</name>
<required>false</required>
<description>
</description>
</attribute>
</tag>
</taglib>
JSP file is
<%@ taglib uri="/WEB-INF/lib.tld" prefix="db" %>
<html>
<body>
<db:connect username="root" password="203131" database="compose" />
</body>
</html>Answered in your other post:
http://forum.java.sun.com/thread.jspa?threadID=608780&tstart=0 -
My question is about high level design. I've written some JSP pages and some very simple JavaBeans that work on Tomcat.
Now I'm trying to design a Database access layer
I want to have a connection pool class and some other business logic classes communicating with each other.
How can I start a bean and keep it running and how do I access its methods from other beans?
Is this even feasible?
if I declare the scope of the bean as the application would I have to put it in all the pages of the web site or not?
Also, should I just forget about JavaBeans and do Servlets? Maybe EJB is better for this?
Please provide some examples in your answer if possible.
Thanks,
David AMy question is about high level design. I've written
some JSP pages and some very simple JavaBeans that
work on Tomcat.
Now I'm trying to design a Database access layerThe design and implementation of a persistence layer has nothing at to do with how the data is eventually displayed. Persistence is the same whether you use a Web or a Swing interface, so the question about Tomcat is moot.
I'd look at Martin Fowler's "Patterns of Enterprise Application Architecture" for its chapter on persistence or the Hibernate object/relational mapping tool.
I want to have a connection pool class and some other
business logic classes communicating with each other.Personally, I prefer to let Tomcat handle the database connection pool. I use the Commons DBCP class and configure my connections that way. Then I have my Java code do a JNDI lookup to access them, do the required database operation, and then close the connection to return it to the pool.
How can I start a bean and keep it running and how do I access its methods from other beans?
Is this even feasible? I'm not sure I know what you mean by "start a bean and keep it running". HTTP is a request/response, stateless protocol. You should think about operations as being initiated by a request and then going out of scope once the response is generated, much like the protocol itself. You don't keep a bean running in that case.
if I declare the scope of the bean as the application would I have to put it in all the pages of the web
site or not?You have to <jsp:useBean> in every page that needs it. Whether or not application scope is really appropriate or necessary is another matter.
Also, should I just forget about JavaBeans and do Servlets? You can and should use JSP for View, a servlet as your front controller, and JavaBeans to do the work in the back. It's not an either/or question. You really should be using all three.
Maybe EJB is better for this?You use EJBs if you have a highly transactional, distributed, clustered application. If none of those things apply to you, there's no reason why you must use EJBs.
Have a look at the Struts and Spring frameworks. -
Frequent Database Access through Java Mapping ?
I have to implement a Java Mapping Program which will require frequent database Access to compare and read table data from some other data base .
What is the most optimum procedure to implement it ?
Should i make a jdbc call every time from the code or should i use EJB(Session beans + Entity beans)...
or any other process besides these 2 to acheive maximum performance
Please Suggest
regards
Nilesh Taunk.Hi Nilesh,
I would suggest you to use XI DB Lookup API's for accessing Database. Eventhough it will not give you maximum performance, it will be very easy to change the configuration parameters in JDBC Adapter (No need for hardcoding user id/password/Driver details etc.) and you can refer the same in your Lookup API's.
Please refer the link: <a href="/people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler Weblog</a>
Regards,
Ananth -
Database Access from JSP - Is it correct?
From a JSP Page, we need to retreive data from the database. We have our own application specific API commands to retreive data from database. We have doubts in using this API commands.
Approach 1:
From the jsp, send the query details to a Java file (BO). From the java file (BO), call the database and retreive the data
Approach 2:
Use the API command directly from the jsp page to retreive details from the database.
In both approaches, the same API command is going to be used. We just want to know is there any advantage in calling the database through the java file (BO) instead of directly from the jsp?
Regards,
R.AravinthThanks Ram. But we are not going to have any complex
codes written for data retreival. We just epxect a
single line of code which will call database and that
API command will return us a storage variable which
we will use for displaying purpose.
ok take a look at this
//code to display lot of other stuff
<%
try {
//code to access db and get data;
catch(SomeException e){
//oh-oh you are already on the display logic and have output a lot of stuff
//how do you handle this
%>versus this
//code in some handler or bean
try{
//code to get data
//set an attribute to enable a redirect to jsp page
catch(Exception e){
//handle exception, log ?
//set an attribute to enable a redirect to error page
Anyways, i wanted to know will the performance of the
page improve if we call the database from a separate
java rather than directly from jsp?As evnafets said, the answer is no. It may even be faster :)
cheers,
ram. -
I'm trying to access a SQL Server database through an ODBC connection on a JSP page and having difficulties. This is the code that I'm using:
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:odbc:ODBCConnection", "username", "password");
Statement stmt = conn.createStatement();
ResultSet results = stmt.executeQuery(
"SELECT numUserID, txtUsername, txtPassword FROM tblUsers");
while (results.next()) {
int DBuserid = results.getInt("numUserID");
String DBusername = results.getString("txtUsername");
String DBpassword = results.getString("txtPassword");
conn.close();
} catch (Exception exc) {
out.println ("Exception \"" + exc + "\" occured....<br>");
exc.printStackTrace();
I've got two servers I'm testing it on. One is the IBM WebSphere 3.5 on Windows NT 4 and the other one is the Oracle 9i Server (Apache) with java support on Windows 2000. The code works fine on the Oracle server, but does not work on the WebSphere. I am getting a "java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Client unable to establish connection" exception. The problem is that I need to run this thing on the WebSphere server.
I guess this might have something to do with the Java server differences or OS differences, but I don't know what that could be. I'm sure there's something that I'm not doing right, I just need some help figuring out what that is. I'd appreciate any help anyone can provide. Thanks.ODBC connection is set up the same on both servers and works with Access. In fact, I have tried to put the same code that I'm trying to use in a regular text java file, it compiled and ran on that same server. I've got a feeling I have the Websphere server setup wrong, but I don't know exactly what and how to fix it.
Thanks. -
PJC and database access through JDBC
Hello,
I'm trying to access to the database through a PJC via JDBC.
conn = DriverManager.getConnection ("jdbc:oracle:thin:@machine:1521:XE", "user", "pwd");It works fine on a XE database, but fails on another XE one:
Oracle JInitiator: Version 1.3.1.22
java.lang.NullPointerException
at oracle.jdbc.ttc7.O3log.marshal(O3log.java:606)
at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:255)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:377)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:515)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:345)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at oracle.forms.fd.AsyncJob.connect(AsyncJob.java:68)
at oracle.forms.fd.AsyncJob.run(AsyncJob.java:121)
at java.lang.Thread.run(Unknown Source)It also fails on a remote Unix database:
java.security.AccessControlException: access denied (java.net.SocketPermission monadev resolve)
at java.security.AccessControlContext.checkPermission(Unknown Source)
...so I edit the java.policy file of the Jinitiator directory:
permission java.net.SocketPermission "machine:port-", "accept,connect,listen,resolve"; and then get the same execption:
java.lang.NullPointerException
at oracle.jdbc.ttc7.O3log.marshal(O3log.java:606)
at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:255)
...Finally, it work on only one machine and only a local database.
I'm probably missing something somewhere.
Is anyone could give me some light on this ?
Thanks in advance,
FrancoisI'm just learning to work with PJC's, so I'm unsure whether I can help, but here goes. I found the following archived on Google Groups (http://groups.google.com):
Hi. The basic applet security model is that it can only make connections
back to the machine from which it was downloaded. If you want to do
JDBC from an applet to a DBMS not on the applet-server machine,
you need a type-3 JDBC driver. A type-3 JDBC driver has an all-Java
client driver piece which an applet can download and use. This driver
piece connects to a proxy piece which is running on the webserver
machine. This proxy piece then connects to any DBMS anywhere on the
net, and is the middleman between the JDBC client and DBMS.
For security, management and performance reasons it's usually better to
constrain JDBC to a middle tier such as in a servlet, and use HTML to and
from the client, rather than the space and time involved in downloading a
full general query engine (a JDBC driver) to a client which typically uses
.1% of the capability or classes of the JDBC driver.
Joe Weinstein at BEA HTH,
Eric Adamson
Lansing, Michigan -
JSP hanging when 9i database invoked through JSP
Hi
I have just installed Oracle 9i DB on Win 2000 server. When I try to invoke a SQL from a jsp on the application server on the same machine, it hangs.
The jsp is able to connect to the Oracle 8i database on a different machine. We are having classes13.zip in the classpath.
Has somebody faced this problem before? Pl. help me out
Its urgent.
Thanks in advance
Ashish.hi Vipul
Following is the file that we are using to connect to the database. The following file is invoked from the command prompt and it takes very long (8 minutes on the same machine) to connect to Oracle 9i. With JSP (tested on JRun and Oracle9iAS), we are never able to connect. The JSP and java file from command prompt both give instantaneous results even from a remote database if the DB is Oracle 8i.
Thanks
import java.io.*;
import java.sql.*;
public class DBInserter {
Connection connection = null;
CallableStatement callableStatement = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
java.sql.Date date1 = new java.sql.Date(System.currentTimeMillis());
public DBInserter(String custCode , String itemCode , String uomCode , String itemQty , String itemRate , String discPerc , String docNo) {
getDBConnection();
// insertValues(custCode , itemCode , uomCode , itemQty , itemRate , discPerc , docNo);
getValues();
public DBInserter() {
getDBConnection();
getValues();
public void getDBConnection() {
try {
Class.forName("oracle.jdbc.OracleDriver");
System.out.println("Abt to get the connection " + System.currentTimeMillis());
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
connection = DriverManager.getConnection("jdbc:oracle:thin:@129.1.2.116:1521:ORCL","SCOTT","TIGER");
System.out.println("After getting the connection " + System.currentTimeMillis());
catch(Exception ex) {
System.out.println("Connection refused : " + ex.getMessage());
public void getValues() {
try {
preparedStatement = connection.prepareStatement("SELECT * FROM DEPT");
resultSet = preparedStatement.executeQuery();
while(resultSet.next()) {
System.out.println(resultSet.getString("DEPTNO"));
catch(Exception ex) {
public void insertValues(String custCode , String itemCode , String uomCode , String itemQty , String itemRate , String discPerc , String docNo) {
try {
callableStatement = connection.prepareCall("{ CALL SO_INSERT_XML(?,?,?,?,?,?,?,?,?,?) }");
callableStatement.setString(1,custCode);
callableStatement.setString(2,itemCode); // ItemCode
callableStatement.setString(3,uomCode); // ItemUomCode
callableStatement.setInt(4,Integer.parseInt(itemQty)); // Item Qty
callableStatement.setInt(5,Integer.parseInt("0")); // Item Ls Qty
callableStatement.setInt(6,Integer.parseInt(itemRate)); // Item Rate
callableStatement.setInt(7,Integer.parseInt(discPerc)); // Item Disc Perc
callableStatement.setDate(8,date1);
callableStatement.setInt(9,Integer.parseInt(docNo));
callableStatement.registerOutParameter(10,Types.INTEGER);
System.out.println("Abt to insert the values");
callableStatement.executeUpdate();
System.out.println("After inserting the values");
System.out.println("The Value inserted is : " + callableStatement.getInt(10));
catch(Exception ex) {
System.out.println("Exception while inserting the values : " + ex.getMessage());
public static void main(String args[]) {
//DBInserter dbi = new DBInserter(args[0],args[1],args[2],args[3],args[4],args[5],args[6]);
DBInserter dbi = new DBInserter();
null -
Database connection through JSP
I am trying to connect JSP to MySql database.
<body>
<div id="container">
<div id="containerleft">
<!-- <img src="wildfern.jpg" width=200 height=1000> -->
</div>
<div id="containerright"><center><h1>List Of Deliverables</h1></center><br><br>
<table cellpadding="10">
<tr>
<td><h3> Number of Deliverables</h3></td>
<td><input type="text" name="deliverableSize" size="20" onchange="DynamicBox(deliverableSize.value)"></td>
<td></td>
</tr>
<tr></tr>
<tr></tr>
</table>
<table>
<tr>
<td><h3><center> Week</center></h3></td>
<td><center><h3> Deliverable name </h3></center></td>
<td></td>
<td><center><h3>Weightage </h3></center></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<%
try
Class.forName("com.mysql.jdbc.Driver");
catch(ClassNotFoundException e)
out.println("Class nai milli bhai");
Connection dbh=null;
try
dbh=DriverManager.getConnection("jdbc:mysql://172.20.200.21/B2","B2","ignite#1234");
Statement stmt = dbh.createStatement();
String query = "select * from Parameters_Details;";
ResultSet rs = stmt.executeQuery(query);
while(!rs.next())
%>
<td><%=rs.getString(2)%> </td>
<%
}catch (SQLException sqle)
System.out.println("SQL Error : " + sqle);
catch(Exception e)
System.out.println("HELLLO"+e);
finally
// dbh.closeConnection();
%>
<%--<td></td>
<td></td>
<td><center><h3> Core</h3></center></td>
<td><center><h3> SE</h3></center></td>
<td><center><h3> PE</h3></center></td>--%>
</tr>
</table>
<div id="bottom">
</div>
<center> <input type="submit" value="Create" name="Submit">
<input type="reset" value="Reset" name="Cancel"></center>
</div>
</div>
</form>
</body>
It is showing following Exception.
1>> org.apache.jasper.JasperException: org.apache.jasper.JasperException: Unable to load class for JSP
2>> java.lang.ClassNotFoundException: org.apache.jsp.DeliverablesList_jsp1)<%--<td></td>
<td></td>
<td><center><h3>Core</h3></center></td>
<td><center><h3>SE</h3></center></td>
<td><center><h3>PE</h3></center></td>--%>
:- Jasper exception indicates that it seems syntax error . You need to check out your code carefully. Give comments like this
<% // %> OR <% /* */ %>.
Or if you wanna comment only html code use <!-- <td> --> like this.
Second thing why did you write while( !rs.next()) ? it should be while(rs.next())
Best luck. -
Import XML document in MS Access through Jsp
Hai,
Can any one please tell how to import/store XML document into database, I have tried a lot, but failed to get the result. So please can anyone send me the related code for storing the XML document into database.
Thanking you in advance,
Praveen Vinnakota.You can store the XML Document as a String Data In the database and thus no need to use XML Parsers
Bye for now
CSJakharia -
Regarding database access through jndi
Hi All,
Plz tell me the steps.
I want to access data from MS Access, and i want to do it using JNDI .
what should be added in struts-config.xml, web.xml .
if any one have example code that will be better to understand.Nothing necessary added to struts-config.xml
What server are you using? The JNDI configuration for each server is slightly different.
The page for Tomcat is here: http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html
I would follow that apart from instead of editing server.xml, put the JNDI configuration in a "mycontext.xml" file as defined here:
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/host.html#Automatic%20Application%20Deployment
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/context.html
Cheers,
evnafets -
Hello,
i have a Java Server Page where i fill in some data in a formular. I want to put these data (only two strings) in a database. I already use a servlet to give this data to a (already existing) stateless session bean. I also created and deployed an sda, so that the table exists in the database.
But i do not understand, what to do next - how to use an entity bean to fill the table.
Can anyone give me some hints?
Thanks,
AndréHi Andre,
you need to retrieve the Home Object of your entity bean and use it to create, the same way you create your session bean.
Example:
InitialContext initialContext = new InitialContext();
EjbObject myEjb = null;
try {
java.lang.Object objRef = initialContext.lookup(EjbHome.JNDI_NAME);
EjbHome home = (EjbHome)PortableRemoteObject.narrow(objRef, EjbHome.class);
myEjb = home.create();
} catch (Exception) {
initialContext.close();
The lookup to the home object can vary, you might also have helper classes for that, it depends on your application server, API and architecture.
But however the call or whichever the server, you basically need to retrieve the home object of your entity bean and use the method create() - with any required parameters. Pretty much the same way you create a session bean.
Hope this helps.
regards,
Dionisios -
Problem while access database by JSTL through JSP.
I am trying to connect database by using JSTL through jsp.I am getting an exception.Please advise.
Error:
org.apache.jasper.JasperException: XML parsing error on file /WEB-INF/jsp/c.tld: (line 2, col 8): Document is invalid: no grammar found.
at org.apache.jasper.xmlparser.ParserUtils.parseXMLDocument(ParserUtils.java:140)
at org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:200)
at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:140)
at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:309)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:336)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:750)
at org.apache.jasper.compiler.Parser.parse(Parser.java:77)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:157)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:111)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:183)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:427)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:142)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:445)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)
JSP:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<sql:setDataSource scope="application"
driver="sun.jdbc.odbc.JdbcOdbcDriver"
url="jdbc:oracle:thin:@3.173.130.12:1521:cup"
user="sUerName"
password="sPassword"
/>
<sql:query var="Result">
select * from imtinv.imi_error_message
</sql:query>
<html>
<head>
<title>
Error Message Details
</title>
</head>
<body bgcolor="white">
This is the information stored in the Error Message Table in Depot Automation Systems
<table>
<c:forEach items="$(Result.rows)" var="row">
<c:forEach items="$(rows)" var="column">
<tr>
<td align=right>
<b><c:out value="$(column.key)" />:</b>
</td>
<td>
<c:out value="$(column.value)" />:</b>
</td>
</tr>
</c:forEach>
</c:forEach>
</table>
</body>
</html>
Web.xml:
<taglib>
<taglib-uri>
http://java.sun.com/jstl/xml
</taglib-uri>
<taglib-location>
/WEB-INF/jsp/x.tld
</taglib-location>
</taglib>
<taglib>
<taglib-uri>
http://java.sun.com/jstl/fmt
</taglib-uri>
<taglib-location>
/WEB-INF/jsp/fmt.tld
</taglib-location>
</taglib>
<taglib>
<taglib-uri>
http://java.sun.com/jstl/sql
</taglib-uri>
<taglib-location>
/WEB-INF/jsp/sql.tld
</taglib-location>
</taglib>
c.tld:
<?xml version="1.0" encoding="UTF-8" ?>
<taglib 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 web-jsptaglibrary_2_0.xsd"
version="2.0">
<description>JSTL 1.1 core library</description>
<display-name>JSTL core</display-name>
<tlib-version>1.1</tlib-version>
<short-name>c</short-name>
<uri>http://java.sun.com/jsp/jstl/core</uri>
<validator>
<description>
Provides core validation features for JSTL tags.
</description>
<validator-class>
org.apache.taglibs.standard.tlv.JstlCoreTLV
</validator-class>
</validator>
<tag>
<description>
Catches any Throwable that occurs in its body and optionally
exposes it.
</description>
<name>catch</name>
<tag-class>org.apache.taglibs.standard.tag.common.core.CatchTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
Name of the exported scoped variable for the
exception thrown from a nested action. The type of the
scoped variable is the type of the exception thrown.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Simple conditional tag that establishes a context for
mutually exclusive conditional operations, marked by
<when> and <otherwise>
</description>
<name>choose</name>
<tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class>
<body-content>JSP</body-content>
</tag>
<tag>
<description>
Simple conditional tag, which evalutes its body if the
supplied condition is true and optionally exposes a Boolean
scripting variable representing the evaluation of this condition
</description>
<name>if</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.IfTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
The test condition that determines whether or
not the body content should be processed.
</description>
<name>test</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>boolean</type>
</attribute>
<attribute>
<description>
Name of the exported scoped variable for the
resulting value of the test condition. The type
of the scoped variable is Boolean.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Scope for var.
</description>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Retrieves an absolute or relative URL and exposes its contents
to either the page, a String in 'var', or a Reader in 'varReader'.
</description>
<name>import</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.ImportTag</tag-class>
<tei-class>org.apache.taglibs.standard.tei.ImportTEI</tei-class>
<body-content>JSP</body-content>
<attribute>
<description>
The URL of the resource to import.
</description>
<name>url</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the exported scoped variable for the
resource's content. The type of the scoped
variable is String.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Scope for var.
</description>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the exported scoped variable for the
resource's content. The type of the scoped
variable is Reader.
</description>
<name>varReader</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the context when accessing a relative
URL resource that belongs to a foreign
context.
</description>
<name>context</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Character encoding of the content at the input
resource.
</description>
<name>charEncoding</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
The basic iteration tag, accepting many different
collection types and supporting subsetting and other
functionality
</description>
<name>forEach</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.ForEachTag</tag-class>
<tei-class>org.apache.taglibs.standard.tei.ForEachTEI</tei-class>
<body-content>JSP</body-content>
<attribute>
<description>
Collection of items to iterate over.
</description>
<name>items</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.Object</type>
</attribute>
<attribute>
<description>
If items specified:
Iteration begins at the item located at the
specified index. First item of the collection has
index 0.
If items not specified:
Iteration begins with index set at the value
specified.
</description>
<name>begin</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>int</type>
</attribute>
<attribute>
<description>
If items specified:
Iteration ends at the item located at the
specified index (inclusive).
If items not specified:
Iteration ends when index reaches the value
specified.
</description>
<name>end</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>int</type>
</attribute>
<attribute>
<description>
Iteration will only process every step items of
the collection, starting with the first one.
</description>
<name>step</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>int</type>
</attribute>
<attribute>
<description>
Name of the exported scoped variable for the
current item of the iteration. This scoped
variable has nested visibility. Its type depends
on the object of the underlying collection.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the exported scoped variable for the
status of the iteration. Object exported is of type
javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested
visibility.
</description>
<name>varStatus</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Iterates over tokens, separated by the supplied delimeters
</description>
<name>forTokens</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.ForTokensTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
String of tokens to iterate over.
</description>
<name>items</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.String</type>
</attribute>
<attribute>
<description>
The set of delimiters (the characters that
separate the tokens in the string).
</description>
<name>delims</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.String</type>
</attribute>
<attribute>
<description>
Iteration begins at the token located at the
specified index. First token has index 0.
</description>
<name>begin</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>int</type>
</attribute>
<attribute>
<description>
Iteration ends at the token located at the
specified index (inclusive).
</description>
<name>end</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>int</type>
</attribute>
<attribute>
<description>
Iteration will only process every step tokens
of the string, starting with the first one.
</description>
<name>step</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>int</type>
</attribute>
<attribute>
<description>
Name of the exported scoped variable for the
current item of the iteration. This scoped
variable has nested visibility.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the exported scoped variable for the
status of the iteration. Object exported is of
type
javax.servlet.jsp.jstl.core.LoopTag
Status. This scoped variable has nested
visibility.
</description>
<name>varStatus</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Like <%= ... >, but for expressions.
</description>
<name>out</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.OutTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
Expression to be evaluated.
</description>
<name>value</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Default value if the resulting value is null.
</description>
<name>default</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Determines whether characters <,>,&,'," in the
resulting string should be converted to their
corresponding character entity codes. Default value is
true.
</description>
<name>escapeXml</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Subtag of <choose> that follows <when> tags
and runs only if all of the prior conditions evaluated to
'false'
</description>
<name>otherwise</name>
<tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class>
<body-content>JSP</body-content>
</tag>
<tag>
<description>
Adds a parameter to a containing 'import' tag's URL.
</description>
<name>param</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.ParamTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
Name of the query string parameter.
</description>
<name>name</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Value of the parameter.
</description>
<name>value</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Redirects to a new URL.
</description>
<name>redirect</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.RedirectTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
The URL of the resource to redirect to.
</description>
<name>url</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the context when redirecting to a relative URL
resource that belongs to a foreign context.
</description>
<name>context</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Removes a scoped variable (from a particular scope, if specified).
</description>
<name>remove</name>
<tag-class>org.apache.taglibs.standard.tag.common.core.RemoveTag</tag-class>
<body-content>empty</body-content>
<attribute>
<description>
Name of the scoped variable to be removed.
</description>
<name>var</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Scope for var.
</description>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Sets the result of an expression evaluation in a 'scope'
</description>
<name>set</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.SetTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
Name of the exported scoped variable to hold the value
specified in the action. The type of the scoped variable is
whatever type the value expression evaluates to.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Expression to be evaluated.
</description>
<name>value</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Target object whose property will be set. Must evaluate to
a JavaBeans object with setter property property, or to a
java.util.Map object.
</description>
<name>target</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the property to be set in the target object.
</description>
<name>property</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Scope for var.
</description>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Creates a URL with optional query parameters.
</description>
<name>url</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.UrlTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
Name of the exported scoped variable for the
processed url. The type of the scoped variable is
String.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
Scope for var.
</description>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<description>
URL to be processed.
</description>
<name>value</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<description>
Name of the context when specifying a relative URL
resource that belongs to a foreign context.
</description>
<name>context</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<description>
Subtag of <choose> that includes its body if its
condition evalutes to 'true'
</description>
<name>when</name>
<tag-class>org.apache.taglibs.standard.tag.rt.core.WhenTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
The test condition that determines whether or not the
body content should be processed.
</description>
<name>test</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>boolean</type>
</attribute>
</tag>
</taglib>
Thanks and Regards,
Velrajan T.For installing JSTL, all you need are the jar files in the web-inf/lib directory.
- No entries in web.xml
- no tld files lying around
- no problems!
I think you may have a versioning problem here.
What version of Tomcat are you using?
With JSP1.2 (eg Tomcat 4), you should be using JSTL1.0. <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
With JSP2.0 (eg Tomcat 5), you should use JSTL1.1. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
Note the difference in the URIs. - the second one includes a /jsp
Currently you are using the URI for JSTL1.0, but you look to have the tld from JSTL1.1. If you are using a JSP1.2 container, I don't think it could read this tld file, hence the error.
Try installing the correct version of JSTL, properly (ie as they tell you in the readme file) and it should all work.
Cheers,
evnafets
Maybe you are looking for
-
App not showing up for everyone in App Store. Why?
My app (Region Brazil, Language Portuguese) has been approved and is in the App Store. But only some people can search and find it. Can someone explain why? I've tried changing all region and language settings on my phone, but the app still doesn't a
-
SocketException thrown when reading from socket.
I got a thread that listen on a socket for data with: while (LISTENING) new AAAcknowledgeThread(serverSocket.accept()).start(); When the thread mentioned executes and tries to read from the socket with: BufferedReader in = new BufferedReader( new Inp
-
Many Tabs & Windows Lost during Freeze & Force Power Down
Sorry for the long post, you can stop reading at whatever point my question seems clear Where is the data located of previous tabs and windows from a previous Safari session - during a New Safari session - but PRIOR to slecting "Reopen All Windows
-
Problem using in Stacked sequence.
I am using sstacked sequence structure, Where in each sequence I am having a sub VI which will pop up the Front Panel during the sequence, but the sub VI present in the next sequence is also poping the Front Panel. How to avoid this . I want the sub
-
Hi all, i have created delivery against one order and while doing packing through VL06O system is giving warning message "Item without storage location exist" where as the storage location is maintained for the item. what can be the posibility. Thank