Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 35261 invoked from network); 2 Jan 2002 19:08:36 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 2 Jan 2002 19:08:36 -0000 Received: (qmail 26829 invoked by uid 97); 2 Jan 2002 19:08:12 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@jakarta.apache.org Received: (qmail 26796 invoked by uid 97); 2 Jan 2002 19:08:11 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 26785 invoked from network); 2 Jan 2002 19:08:11 -0000 Message-ID: <001901c193c1$66420b20$1900000a@techsupport> From: "Robin Lee" To: "Tomcat Users List" References: <5.1.0.14.0.20020102104923.00a03410@mail.harbornet.com> Subject: Re: Servlet running twice at the same moment. Date: Wed, 2 Jan 2002 12:12:19 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Well, that depends on which code you would like to see? The login code is pretty basic... Here's is my validateLoginServlet... I am using a type4 jdbc driver (thinweb.tds driver). import Common.dbfiles.*; import java.io.*; import java.util.*; import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; public class ValidateLoginServlet extends HttpServlet { public void service(HttpServletRequest req, HttpServletResponse res) throws IOException { String errorCode = ""; try { // get a connection Class c = Class.forName("com.thinweb.tds.Driver"); Connection dbConn = DriverManager.getConnection("jdbc:twtds:sqlserver://[removed];user=[removed] ;password=[removed];TDS=7.0"); // instantiate data objects DBCustomersSet customersSet = new DBCustomersSet(dbConn,"Customers"); //DBCustomers customers = new DBCustomers(); // Now set the where clause to get the member (using setFilter) customersSet.setFilter("LoginID='" + req.getParameter("LoginID") + "'"); Vector customersQuery = customersSet.query(); //Create a session. HttpSession session = req.getSession(true); //Now let's see if any records were returned. if (customersQuery != null && !customersQuery.isEmpty()) { customersSet.firstRecord(); //DBCustomers cust = (DBCustomers) custSet.record(); DBCustomers theCustomer = (DBCustomers) customersSet.record(); //DBCustomers theCustomer = (DBCustomers)customersQuery.elementAt(0); //Now we want to check the password. if (theCustomer.getPassword().equals(req.getParameter("Password"))) { session.setAttribute("theCustomer",theCustomer); errorCode = "0"; System.out.println("UserID: " + theCustomer.getLoginID() + " has logged in."); customersSet.userLoggedIn(); } else { //Wrong password, set the errorCode to 1. errorCode = "1"; } } else { //Not found, set the errorCode to 2. errorCode = "2"; } session.setAttribute("errorCode",errorCode); //System.out.println("ValidateLoginServlet errorCode: " + errorCode); dbConn.close(); } catch (SQLException sqle) { System.out.println("Sql Exception: " + sqle); } catch (ClassNotFoundException cnfe) { System.out.println(cnfe); } catch (ArrayIndexOutOfBoundsException aioobe) { System.out.println(aioobe); } } } In this case, it shows "userid has logged in". At times it will do it just once, but other times it will do it twice... Did i add something in here that shouldn't be? Thanks. ----- Original Message ----- From: "Micael Padraig Og mac Grene" To: "Tomcat Users List" Sent: Wednesday, January 02, 2002 11:50 AM Subject: Re: Servlet running twice at the same moment. > At 12:00 PM 1/2/02 -0700, you wrote: > >Hello, > > > >I don't know why this is happening, but... It seems like whenever I run a > >single servlet, there are times it will run twice. As in, this... > >...Robin > > Robin, there is no way to have any clue why this is happening without > seeing the code. Micael > > > -- > To unsubscribe: > For additional commands: > Troubles with the list: -- To unsubscribe: For additional commands: Troubles with the list: