• Post Reply Bookmark Topic Watch Topic
  • New Topic

apache-tomcat  RSS feed

 
manoj r patil
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm running jsp on tomcat 4.0. My jsp form is being submitted twice even if I clicked on the submit link once! This is happening on more than one pages...
can anybody help me to remove this problem?
...is it a bug of tomcat?
Thanks and Regards,
mrP
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
man_of_instance
Welcome to the Java Ranch, we hope you�ll enjoy visiting as a regular however,
your name is not in keeping with our naming policy here at the ranch. Please change your display name to an appropriate name as shown in the policy.
Thanks again and we hope to see you around the ranch!!

Your problem is not a bug of Tomcat that I've heard of. How do you submit them, the form itself? Javascript?
How do you know they are being submitted twice? Maybe it is some other peice of code that is being run twice.
Post some code or some more details on the process.
 
Sandeep. Oza
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have also came across same problem. code is right. Are you using any pageContext.forward()method or html's meta tag for refreshing the page?
post your codes...
Sandeep Oza
 
manoj r patil
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Dave Vick:
man_of_instance
Welcome to the Java Ranch, we hope you�ll enjoy visiting as a regular however,
your name is not in keeping with our naming policy here at the ranch. Please change your display name to an appropriate name as shown in the policy.
Thanks again and we hope to see you around the ranch!!

Your problem is not a bug of Tomcat that I've heard of. How do you submit them, the form itself? Javascript?
How do you know they are being submitted twice? Maybe it is some other peice of code that is being run twice.
Post some code or some more details on the process.

Thanks for the reply, Dave!
I liked the policy of name. I have changed it!
Well, 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,
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!