aspose file tools
The moose likes JSP and the fly likes apache-tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "apache-tomcat" Watch "apache-tomcat" New topic
Author

apache-tomcat

manoj r patil
Ranch Hand

Joined: Jun 06, 2002
Posts: 180
My request from client is getting duplicated on server...
I'm submitting form by javascript submit. And I've put some SOP (System.out.println) statement in my java classes. So when I invoke java method from jsp on submit, that method is being called twice. Again it happens 80% of the time. But not always!
I'm posting one code for reference. In this code I'm initializing my connection pool and I want it to be done only once. But it gets initialized twice which I can see from the messages on tomcat console:
/*** here goes the code ***********/
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Pool Initializing ...</TITLE>
<META NAME="Author" CONTENT="Manoj Patil">
</HEAD>
<%@ page import="com.tattva.pms.database.*, java.sql.*, java.util.*"%>
<%
ConnectionPool lvPool = new ConnectionPool();
try {
lvPool.setDriver("oracle.jdbc.driver.OracleDriver");
lvPool.setUrl( "jdbc racle:thin:@pe2500:1521 msdb");
lvPool.setSize(4);
lvPool.setUserName("cvdpl");
lvPool.setPassword("cvdpl");
lvPool.initializePool();
}
catch(Exception e) {
out.println("Exception in connecting...: "+e);
}
try {
application.setAttribute("ConnectionPool", lvPool);
}
catch(Exception e) {
out.println(e);
}
%>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#FF0000" VLINK="#800000" ALINK="#FF00FF">
<%
out.println("<FONT color=\"#800000\"><H3>ConnectionPool: <b>"+application.getAttribute("ConnectionPool"));
out.println("</b><br><blockquote>Connection Pool initialized! Now you can use the database with the optimum speed!</blockquote></H3></FONT>");
%>
</BODY>
</HTML>
/******************************************/
Thanks and Regards,


love your job and not your company;
...because you never know when your company will stop loving you!
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14456
    
    7

Are you sure that the user isn't double-clicking?
They have a bad habit of doing that, alas.


Customer surveys are for companies who didn't pay proper attention to begin with.
manoj r patil
Ranch Hand

Joined: Jun 06, 2002
Posts: 180
Here I am the user! So this problem is eliminated! But It has happened with me before also. Still searching for the reason......
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: apache-tomcat
 
Similar Threads
failure to activate a Web application with database
Connection Pooling
apache-tomcat
selecting multiple rows to update value
A simple insert....