RE: RES: Problems downloading files. How to identify the CANCEL b utto n?

2009-07-11 Thread siomara
Sure:

package servlets.comum;

import java.io.*;

import javax.servlet.*;
import javax.servlet.http.*;

import comum.ArquivoGestor;

/**
 * Definition of class DownloadFile.
 */
public class DownloadFile extends HttpServlet
{
private String original_filename = MYFILE.txt;
private String filename=C:\\ABC.txt;

ArquivoGestor arquivoGestor;

/**
 * Processes requests for both HTTP GET and POST methods.
 * @param request servlet request
 * @param response servlet response
 */
protected void processRequest(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
Filef= new File(filename);
int length   = 0;
ServletOutputStream op   = response.getOutputStream();
ServletContext  context  =
getServletConfig().getServletContext();
String  mimetype = context.getMimeType( filename );
   
//
//  Set the response and go!
//
response.setContentType( (mimetype != null) ? mimetype :
application/octet-stream );
response.setContentLength( (int)f.length() );
response.setHeader( Content-Disposition, attachment; filename=\
+ original_filename + \ );
   
//
//  Stream to the requester.
//
byte[] bbuf = new byte[filename.length()];
DataInputStream in = new DataInputStream(new FileInputStream(f));
while ((in != null)  ((length = in.read(bbuf)) != -1))
{
op.write(bbuf,0,length);
}
 
in.close();
op.flush();
op.close();

// The lines bellow will retrieve information from request and
// register them into the database (interested user ID/file ID/ and
// licitation ID). The problem, as I said, is that by the time the
// download manager window (that this code displays) shows up the
// entire code has been already executed.
int interessadoID = Integer.parseInt(request.getParameter(int));
int arquivoID = Integer.parseInt(request.getParameter(arq));
int licitacaoID = Integer.parseInt(request.getParameter(lic));

arquivoGestor = new ArquivoGestor();

arquivoGestor.registerLicitacaoDownoad(interessadoID, arquivoID,
licitacaoID);
}

/**
 * Handles the HTTP GET method.
 * @param request servlet request
 * @param response servlet response
 */
protected void doGet(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
processRequest(request, response);
}

/**
 * Handles the HTTP POST method.
 * @param request servlet request
 * @param response servlet response
 */
protected void doPost(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
processRequest(request, response);
}
}

-Mensagem original-
De: Martin Gainty
Para: Tomcat Users List
Enviada em: 10/07/2009 22:45
Assunto: RE: RES: Problems downloading files. How to identify the CANCEL
butto n?


yes
Op: could you display the jsp
?
Martin Gainty 


RE: Problems downloading files. How to identify the CANCEL butto n?

2009-07-11 Thread siomara
Andre came up with a good reason and here is mine:

I work for the brazilian government that wants to keep track of people who
download certain specific files. It also wants to send emails to the ones
that at least started the download procces of these files. So, for this
reason, there is no interest at all to send emails for those that canceled
the download process.

I am looking forward for a solution because the way my code is now is wrong.
It is logging everybody no matter which button they pressed (open, save or
cancel).

Once more, any suggestion is more than welcome.

Siomara

-Mensagem original-
De: André Warnier
Para: Tomcat Users List
Enviada em: 11/07/2009 06:24
Assunto: Re: Problems downloading files. How to identify the CANCEL butto n?

Konstantin Kolinko wrote:
 What is the business requirement that forces you to log such
information?
 What is the cost of a false positive?
 
A usual example is when the customer is paying for some downloaded 
document.  At the server side, you would want an absolute, 
no-complaints-possible, trace that the download did occur succesfully.

Something you can wiggle under the customer's nose when they complain 
about the bill.

All the more reason to have some active component at the client side, 
acknowledging the download back to the server, with some unique 
timestamp, id, etc..

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


RES: Problems downloading files. How to identify the CANCEL butto n?

2009-07-08 Thread siomara
The buttons I see [OPEN], [SAVE] and [CANCEL] are not created and controlled
by me. They belong to the download manager window that comes automatically
with a certain command.

The problem I noticed is that by the time this download manager window
shows up the entire code on the servlet has been already executed.

The messages bellow that I included are displayed before any click on any of
those buttons.
 here 1
 here 2
 here 3
 here 4
 here 5
 here 6

Any help is welcome. I am looking so hard for a solution but I am not
finding anything on the web.

Siomara

-Mensagem original-
De: Martin Gainty [mailto:mgai...@hotmail.com] 
Enviada em: terça-feira, 7 de julho de 2009 19:51
Para: Tomcat Users List
Assunto: RE: Problems downloading files. How to identify the CANCEL button?


at least 2 ways to determine the button selected
1)set a boolean property which is enabled on or off based on executed button
class MyAction extends ActionSupport {
   private boolean submit;
   private boolean clear;
   public void setSubmit(boolean submit) {
  this.submit = submit;
   }
   public void setClear(boolean clear) {
  this.clear = clear;
   }
   public String execute() {
  if (submit) {
 doSubmit();
 return submitResult;
  }
  if (clear) {
 doClear();
 return clearResult;
  }
  return super.execute();
   }
}2)check the name of the button as indicated here
class MyAction extends ActionSupport {
   private String buttonName;
   public void setButtonName(String buttonName) {
  this.buttonName = buttonName;
   }
   public String execute() {
  if (Submit.equals(buttonName)) {
 doSubmit();
 return submitResult;
  }
  if (Clear.equals(buttonName)) {
 doClear();
 return clearResult;
  }
  return super.execute();
   }
}http://cwiki.apache.org/WW/multiple-submit-buttons.html

many other solutions are available from devs
Martin 
__ 
Verzicht und Vertraulichkeitanmerkung
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.






 From: siom...@portosdobrasil.gov.br
 To: users@tomcat.apache.org
 Subject: Problems downloading files. How to identify the CANCEL button?
 Date: Tue, 7 Jul 2009 15:09:05 -0300
 
 Dear all,
 
 I need to log some information only after a user downloads or opens a
file.
 
 I am using a servlet for that and the download part works fine.
 
 However I need to identify which button was clicked because in case the
user
 clicks [CANCEL] I am not supposed to register any information.
 
 I put lots of messages on the code to understand how it works and even if
I
 click [CANCEL] the messages will be printed showing that all commands will
 be executed no matter which button was clicked. 
 
 Can someone help me to identify which button was clicked?
 
 Thanks
 
 Siomara 
 
 ===
 package servlets.comum;
 
 import java.io.*;
 import javax.servlet.*;
 import javax.servlet.http.*;
 
 
 /**
 * Definition of class DownloadFile.
 */
 
 public class DownloadFile extends HttpServlet
 
 {
 
 private String original_filename = MYFILE.txt;
 
 private String filename=C:\\ABC.txt;
 
 /**
  * Processes requests for both HTTP GET and POST methods.
  * @param request servlet request
  * @param response servlet response
  */
 
 protected void processRequest(HttpServletRequest request,
 HttpServletResponse response)
 
 throws ServletException, IOException
 
 {
 
 Filef= new File(filename);
 
 int length   = 0;
 
 ServletOutputStream op   = response.getOutputStream();
 
 ServletContext  context  =
 getServletConfig().getServletContext();
 
 String  mimetype = context.getMimeType( filename );
 
 System.out.println(here 1);
 
 //  Set the response and go!
 
 response.setContentType( (mimetype != null) ? mimetype :
 application/octet-stream );
 
 response.setContentLength( (int)f.length() );
 
 response.setHeader( Content-Disposition, attachment;
filename=\
 + original_filename + \ );
 
 System.out.println(here 2);
 
 //  Stream to the requester.
 
 byte[] bbuf = new byte[filename.length()];
 
 DataInputStream in = new DataInputStream(new FileInputStream(f));
 
 while ((in != null)  ((length = in.read(bbuf)) != -1))
 
 {
 op.write(bbuf,0,length);
 }
 
 System.out.println(here 3);
 
 in.close();
 
 System.out.println(here 4);
 
 op.flush

Problems downloading files. How to identify the CANCEL button?

2009-07-07 Thread siomara
Dear all,

I need to log some information only after a user downloads or opens a file.

I am using a servlet for that and the download part works fine.

However I need to identify which button was clicked because in case the user
clicks [CANCEL] I am not supposed to register any information.

I put lots of messages on the code to understand how it works and even if I
click [CANCEL] the messages will be printed showing that all commands will
be executed no matter which button was clicked. 

Can someone help me to identify which button was clicked?

Thanks

Siomara 

===
package servlets.comum;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;


/**
* Definition of class DownloadFile.
*/

public class DownloadFile extends HttpServlet

{

private String original_filename = MYFILE.txt;

private String filename=C:\\ABC.txt;

/**
 * Processes requests for both HTTP GET and POST methods.
 * @param request servlet request
 * @param response servlet response
 */

protected void processRequest(HttpServletRequest request,
HttpServletResponse response)

throws ServletException, IOException

{

Filef= new File(filename);

int length   = 0;

ServletOutputStream op   = response.getOutputStream();

ServletContext  context  =
getServletConfig().getServletContext();

String  mimetype = context.getMimeType( filename );

System.out.println(here 1);

//  Set the response and go!

response.setContentType( (mimetype != null) ? mimetype :
application/octet-stream );

response.setContentLength( (int)f.length() );

response.setHeader( Content-Disposition, attachment; filename=\
+ original_filename + \ );

System.out.println(here 2);

//  Stream to the requester.

byte[] bbuf = new byte[filename.length()];

DataInputStream in = new DataInputStream(new FileInputStream(f));

while ((in != null)  ((length = in.read(bbuf)) != -1))

{
op.write(bbuf,0,length);
}

System.out.println(here 3);

in.close();

System.out.println(here 4);

op.flush();

System.out.println(here 5);

op.close();

System.out.println(here 6);

}

/**
 * Handles the HTTP GET method.
 * @param request servlet request
 * @param response servlet response
 */

protected void doGet(HttpServletRequest request, HttpServletResponse
response)

throws ServletException, IOException {

processRequest(request, response);

}

/**
 * Handles the HTTP POST method.
 * @param request servlet request
 * @param response servlet response
 */

protected void doPost(HttpServletRequest request, HttpServletResponse
response)

throws ServletException, IOException {

processRequest(request, response);

}

/**
 * Returns a short description of the servlet.
 */

public String getServletInfo() {

return Short description;

}

}

==
Results:

[Tue Jul 07 10:39:43 BRT 2009]  info: postgres: Opened a new connection
[Tue Jul 07 10:39:43 BRT 2009]  info: postgres: Delivered connection from
pool
select arquivolicitacao.licitacaoid, arquivolicitacao.arquivoid,
arquivo.tipoarquivoid, arquivo.tituloapresentacao, arquivo.nomeinterno,
arquivo.localizacaofisica, arquivo.datapublicacaodou, tipoarquivo.descricao
from arquivolicitacao, arquivo, tipoarquivo where
arquivolicitacao.licitacaoid = 5 and arquivolicitacao.arquivoid =
arquivo.arquivoid and arquivo.tipoarquivoid = tipoarquivo.tipoarquivoid
order by datapublicacaodou desc
here 1
here 2
here 3
here 4
here 5
here 6


Simple DownloadFile sample

2009-06-12 Thread siomara
Hello all,

Does anyone know a link to a simple sample for downloading files? I found
some but very confusing.

The code is welcome too.

Thanks

Siomara


Testando entrada no grupo

2009-03-13 Thread siomara
Olá pessoal,

Estou tentando entrar no grupo. Alguém pode por favor responder para eu ver
se consegui.

Obrigada

Siomara


Download Tracking

2008-11-13 Thread siomara
Hi Everybody,

 

I have a java application under Tomcat that is supposed to track people'
downloads.

 

The user clicks on a link (to download a file) and a new record has to be
inserted into a postgreSQL table informing which file was downloaded.

 

However, I need to insert into postgreSQL only after the user hits the save
button of the second window that windows shows. The one that the user
selects the physical place to store the file.

 

I don't know how can I get which button the user clicked since the download
manager window is provided by Windows and not one of mine.

 

Can some one help me with that?

 

Thanks

 

Siomara 



RES: Download Tracking

2008-11-13 Thread siomara
Thanks for your reply David,

Actually, I need to know that the user pressed the SAVE Button in the first
window (OPEN/SAVE/CANCEL) and the SAVE button again in the second window
SAVE/CANCEL).

Remember that he can hit the SAVE button on the first window, select which
directory he wants to store the file on the second window but CANCEL the
download (on the second window).

I've been searching for a solution on the WEB but had no success.

Any help is welcome.

Siomara

-Mensagem original-
De: David Wall [mailto:[EMAIL PROTECTED] 
Enviada em: quinta-feira, 13 de novembro de 2008 16:50
Para: Tomcat Users List
Assunto: Re: Download Tracking


 I have a java application under Tomcat that is supposed to track people'
 downloads.

  

 The user clicks on a link (to download a file) and a new record has to be
 inserted into a postgreSQL table informing which file was downloaded.

  

 However, I need to insert into postgreSQL only after the user hits the
save
 button of the second window that windows shows. The one that the user
 selects the physical place to store the file.

  

 I don't know how can I get which button the user clicked since the
download
 manager window is provided by Windows and not one of mine.
   
I don't think it's possible to know if they click Open/Save/Cancel, at 
least not if using a standard web browser function and not a plug-in of 
some sort.

David

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RES: Download Tracking

2008-11-13 Thread siomara
Hi Mike,

Let me see if I understood.

Your suggestion suggests that I develop my own download file manager? So I
can manipulate the buttons that are pressed by the user?

Sio

-Mensagem original-
De: Mike Duncan [mailto:[EMAIL PROTECTED] 
Enviada em: quinta-feira, 13 de novembro de 2008 16:52
Para: Tomcat Users List
Assunto: Re: Download Tracking

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


It may not be worth the resources, but you can develop/use a download
manager could do this for you. Especially if these are large files, the
users may be happy to use something like that.

The manager would basically tell the service to start the download and
if you do something like resume functionality, it would probably need to
enter other records to show the progress.

Mike Duncan
ISSO, Application Security Specialist
Government Contractor with STG, Inc.
NOAA :: National Climatic Data Center
151 Patton Ave.
Asheville, NC 28801-5001
[EMAIL PROTECTED]
828.271.4289


[EMAIL PROTECTED] wrote:
 Hi Everybody,
 
  
 
 I have a java application under Tomcat that is supposed to track people'
 downloads.
 
  
 
 The user clicks on a link (to download a file) and a new record has to be
 inserted into a postgreSQL table informing which file was downloaded.
 
  
 
 However, I need to insert into postgreSQL only after the user hits the
save
 button of the second window that windows shows. The one that the user
 selects the physical place to store the file.
 
  
 
 I don't know how can I get which button the user clicked since the
download
 manager window is provided by Windows and not one of mine.
 
  
 
 Can some one help me with that?
 
  
 
 Thanks
 
  
 
 Siomara 
 
 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJHHdBnvIkv6fg9hYRAgZXAJ4p2PGqycwyDNMpMVgrq9noSLy+MACdGTJ+
67O6ejem4Ur/TOwIhiJgDKI=
=nDYE
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RES: how to get rid of the path after the URL

2007-12-28 Thread siomara
Let me see if I understood:

'jiveforums' is the name of the folder where ur application is inside
webapps folder, right?

Tomcat is a webapplication designed to run LOTS of applications. Each one
must be inside of a folder inside webapps. So far you did it correct because
you created your application inside of its own folder inside webapps folder.

In order to do what you want you would have to drag and drop all the files
inside 'jiveforums' to the folder on top of it, wich is 'webapps' ( which is
NOT recommended).

However if you are just playing with tomcat, you can put all your files
directly on 'webapps' folder and make your index.jsp the main one by
deleting the index.jsp (or index.whatever) that comes with tomcat.

This is ok for testing but not for deploying real application.

kisses

sio


-Mensagem original-
De: Pavel Pragin [mailto:[EMAIL PROTECTED]
Enviada em: sexta-feira, 28 de dezembro de 2007 16:35
Para: users@tomcat.apache.org
Assunto: how to get rid of the path after the URL


Hello,

 

I am running a Jive application using Tomcat. The application resides in
/tomcat/webapps/jiveforums on the server. When I access the site I
have to use http://www.example.com/jiveforums; .

What changes do I have to make in Tomcat  so I can omit /jiveforums
from the URL and just use http://www.example.com:/jiveforums . Right now
if I go this URL I get the default Tomcat page.

 

Please help

Thank You

 

 

.

PAVEL PRAGIN 
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]  

T   650.328.3900
M  650.521.4377 
F   650.328.3901 

SolutionSet 
The Brand Technology Company 
http://www.SolutionSet.com http://www.solutionset.com/  

PA  131 Lytton Ave., Palo Alto, CA 94301 
SF  85 Second St., San Francisco, CA 94105 

 

 



http://localhost:8080/jiveforums

2007-12-28 Thread siomara
TRY accessING YOUR APPLICATION by TYPING:

http://localhost:8080/jiveforums 

8080 is the port you set for tomcat. change if IT is another one.

remember...tomcat has its main page located inside webapps. that's the
reason you get it when you access http://LOCALHOST:8080

KISSES

SIO


RES: how to get rid of the path after the URL

2007-12-28 Thread siomara
Pavel,

the default.jsp is either a index.html or index.jsp file.

sio

-Mensagem original-
De: Pavel Pragin [mailto:[EMAIL PROTECTED]
Enviada em: sexta-feira, 28 de dezembro de 2007 17:08
Para: Tomcat Users List
Assunto: RE: how to get rid of the path after the URL


Hello,

I wasn't able to find default.jsp anywhere under /tomcat/webapps do I just
need to create one there with the
redirect?

Thanks

.
PAVEL PRAGIN 
[EMAIL PROTECTED] 

T   650.328.3900
M  650.521.4377 
F   650.328.3901 

SolutionSet 
The Brand Technology Company 
http://www.SolutionSet.com 

PA  131 Lytton Ave., Palo Alto, CA 94301 
SF  85 Second St., San Francisco, CA 94105 



-Original Message-
From: David kerber [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 28, 2007 11:00 AM
To: Tomcat Users List
Subject: Re: how to get rid of the path after the URL

Pavel Pragin wrote:
 Hello,

 Thank you for your response. Can you please give me an example of how I
can do these two:
 1. Make jiveforums the root.  
   
Copy all the stuff from your jiveforums folder to the root folder under 
webapps.

 2. Redirect in the root webapp to point it to jiveforums
   
replace the default.jsp file in root with one that has a redirect 
command in it (do a google search for that).

 Thank You 

 .
 PAVEL PRAGIN 
 [EMAIL PROTECTED] 

 T   650.328.3900
 M  650.521.4377 
 F   650.328.3901 

 SolutionSet 
 The Brand Technology Company 
 http://www.SolutionSet.com 

 PA  131 Lytton Ave., Palo Alto, CA 94301 
 SF  85 Second St., San Francisco, CA 94105 



 -Original Message-
 From: David kerber [mailto:[EMAIL PROTECTED] 
 Sent: Friday, December 28, 2007 10:40 AM
 To: Tomcat Users List
 Subject: Re: how to get rid of the path after the URL

 Pavel Pragin wrote:
   
 Hello,

  

 I am running a Jive application using Tomcat. The application resides in
 /tomcat/webapps/jiveforums on the server. When I access the site I
 have to use http://www.example.com/jiveforums; .

 What changes do I have to make in Tomcat  so I can omit /jiveforums
 from the URL and just use http://www.example.com:/jiveforums . Right now
 if I go this URL I get the default Tomcat page.
   
 
 Make jiveforums the root.  Or at least put a redirect in the root webapp 
 to point it to jiveforums.


   
  

 Please help

 Thank You

  

  

 .

 PAVEL PRAGIN 
 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]  

 T   650.328.3900
 M  650.521.4377 
 F   650.328.3901 

 SolutionSet 
 The Brand Technology Company 
 http://www.SolutionSet.com http://www.solutionset.com/  

 PA  131 Lytton Ave., Palo Alto, CA 94301 
 SF  85 Second St., San Francisco, CA 94105 

 



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RES: RES: how to get rid of the path after the URL

2007-12-28 Thread siomara
That's right Pavel.

Mark is correct. It's been a while that I am being forced to develop in this
crap php language that I forgot that tomcat main application is not under
webapps. It's under a ROOT folder.

So rename ROOT to ROOTSomething

create a ROOT folder. Place your application on it.

Let me know if it worked.

sio

-Mensagem original-
De: Pavel Pragin [mailto:[EMAIL PROTECTED]
Enviada em: sexta-feira, 28 de dezembro de 2007 17:17
Para: Tomcat Users List
Assunto: RE: RES: how to get rid of the path after the URL


Hello,

Do you meet ROOT literaly?

thanks

-Original Message-
From: Mark Thomas [EMAIL PROTECTED]
To: Tomcat Users List users@tomcat.apache.org
Sent: 12/28/07 11:09 AM
Subject: Re: RES: how to get rid of the path after the URL

[EMAIL PROTECTED] wrote:
 In order to do what you want you would have to drag and drop all the files
 inside 'jiveforums' to the folder on top of it, wich is 'webapps' ( which
is
 NOT recommended).

No, no, no. This is completely, totally and utterly wrong. It isn't just
not recommended, it won't work.

The correct way to do what the OP wants to do is:
- if deployed directory, rename the jiveforums directory to ROOT
- if deployed as a WAR file, rename jiveforums.war to ROOT.war

Mark

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RES: My webapp is oddly asking for user and password

2006-12-18 Thread Siomara
don´t you have to include the port tomcat is listening?

http://localhost:8080/rms or any other port like: http://localhost:8899/rms

-Mensagem original-
De: Dani [mailto:[EMAIL PROTECTED]
Enviada em: domingo, 17 de dezembro de 2006 17:43
Para: users@tomcat.apache.org
Assunto: My webapp is oddly asking for user and password


Hi.

I have my webapp in c:\tomcat\webapps\rms\ and when I access
http://localhost/rms/ Tomcat asks me for a user and a password.  Even
if I try a hello world HTML file.  Why?

I guess it's something I have to fix in web.xml or server.xml.  What
should I modify?

TIA.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RES: My webapp is oddly asking for user and password

2006-12-18 Thread Siomara
I thought the default port was 8080. Am I wrong?

I had this problem once. It was because of a port conflict with Oracle that
was using port 8080. The solution was to set tomcat to listen to any other
port but 8080 or 80. My tomcat listen to 8899 and the conflict (and the
login screen ) is gone.

-Mensagem original-
De: Dani [mailto:[EMAIL PROTECTED]
Enviada em: segunda-feira, 18 de dezembro de 2006 10:20
Para: users@tomcat.apache.org
Assunto: Re: My webapp is oddly asking for user and password


On 12/18/06, Siomara-at-planalto.gov.br |tomcat|
dxtijagy310t... wrote:
 don´t you have to include the port tomcat is listening?

 http://localhost:8080/rms or any other port like:
http://localhost:8899/rms

No, because I changed it to the default HTTP port 80.  But thanks.

 -Mensagem original-
 De: Dani [mailto:gka4cj702...]
 Enviada em: domingo, 17 de dezembro de 2006 17:43
 Para: users@tomcat.apache.org
 Assunto: My webapp is oddly asking for user and password


 Hi.

 I have my webapp in c:\tomcat\webapps\rms\ and when I access
 http://localhost/rms/ Tomcat asks me for a user and a password.  Even
 if I try a hello world HTML file.  Why?

 I guess it's something I have to fix in web.xml or server.xml.  What
 should I modify?

 TIA.

 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]





-- 
..
Email / Google Talk (Jabber) / MSN: 

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RES: Out Of Memory - String Operation

2006-07-28 Thread Siomara
I faced the same problem once and solved it by closing resultsets,
statments, setting them to null and forcing garbage colletor from inside my
application.

try speading out System.gc(); in estrategic points of your application.


-Mensagem original-
De: Viks [mailto:[EMAIL PROTECTED]
Enviada em: sexta-feira, 28 de julho de 2006 08:33
Para: users@tomcat.apache.org
Assunto: Out Of Memory - String Operation


Hi,
   
  My app is running out of app.
   
  Code does a lot of string opeartion.It involves fetching records from DB
   
  Initially i was using string objects- Program used to finish in about
40-45 min with ~95 cpu usage 
   
  We did some optimization on the code like changing the query from String
to StringBuffer.
   
  This has improved the execution time and cpu usage.
   
  For 60k records the prog ran fine execution time improved from 30 mins
to around 4 min and cpu usage from 95 % to 15%.
   
  For around 100k records my apps goes down on memory.
   
  Wondering if the app is able to sustain on String Obj why it is going down
with StringBuffer Objects.
   
   


Viks

-
 Here's a new way to find what you're looking for - Yahoo! Answers 

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Back to 404 problem: The requested resource (/Sisc/servlet/servle ts/PesquisaTabPeriferica) is not available

2006-07-27 Thread Siomara
Dear All,

I implemented the suggestions from the list but the 404 problem still
persists.
I have an application called Sisc
Under Sisc there are package1 package2 package3... and a new package called
servlets with all my servlets (note that the name has a S at the end).
I included 'package servlets;' as first line of all servlets
The web.xml file looks like this:
?xml version=1.0 encoding=ISO-8859-1?

!DOCTYPE web-app
PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
http://java.sun.com/dtd/web-app_2_3.dtd;
web-app
  display-namePresidencia da Republica/display-name
  descriptionSISC by Siomara Pantarotto/description
  servlet
  servlet-nameincluiMarcaPropriedade/servlet-name
  servlet-classservlets.IncluiMarcaPropriedade/servlet-class

  servlet-namepesquisaTabPeriferica/servlet-name
  servlet-classservlets.PesquisaTabPeriferica/servlet-class
  
  servlet-nameregistraMarcaPropriedade/servlet-name
  servlet-classservlets.RegistraMarcaPropriedade/servlet-class
  /servlet
  servlet-mapping
  servlet-nameincluiMarcaPropriedade/servlet-name
  url-pattern/servlet/servlets/IncluiMarcaPropriedade/url-pattern
 
  servlet-namepesquisaTabPeriferica/servlet-name
  url-pattern/servlet/servlets/PesquisaTabPeriferica/url-pattern
  
  servlet-nameregistraMarcaPropriedade/servlet-name
  url-pattern/servlet/servlets/RegistraMarcaPropriedade/url-pattern
  /servlet-mapping
/web-app

Am I missing something
The weird thing I noticed is that sometimes the servlet
'PesquisaTabPeriferica' works fine, sometimes it does not and I get 404
message (specially when I clean browser history, delete files and off line
files). When the servlet 'PesquisaTabPeriferica' works the other one
'RegistraMarcaPropriedade' does not.
I have no clue of what is going on. This never happened to me before. I am
losing confidence regarding TOMCAT and don't know what to do. 
Can someone help me please. I do appreciate your feed back.
These are my calls from the application:

from index.htm:
...
td width=50% height=20a
href=servlet/servlets/PesquisaTabPeriferica?idTabela=1
Consultar/Manutenção Marca de Propriedade/a/td
...


from incluiMarcaPropriedade.htm:
...

///
// Validate fields and submit form elements to servlet
RegistraMarcaPropriedade
//
function doFormSubmit()
{
objfrm=document.incluiAlteraMarcaPropriedade;
//Store the file path of the next servlet/jsp to be called
strFilePath = servlet/servlets/RegistraMarcaPropriedade
  
strDescricao=objfrm.txtDescricao.value;
if(isSpecialChar(strDescricao) || !isChar(strDescricao))
{
alert(Favor entrar com uma descrição válida.);
objfrm.txtDescricao.focus();
return false;
}

if(isEmpty(strDescricao))
{
alert(Campo obrigatório);
objfrm.TxtNumber.focus();
return false;
}

objfrm.method=post;
objfrm.action=strFilePath;
return true;
objfrm.submit();

}
...
Thanks a lot


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RES: The requested resource (/servlet/RegistraMarcaPropriedade) i s not available

2006-07-07 Thread Siomara
All my classes are into packages.

I used the same structure of servlets-examples sample in my application.

C:\Software\Apache Software Foundation\Tomcat
5.5\webapps\servlets-examples\WEB-INF\classes

The servlets in this sample are under the classes folder just like in my
application.

Are you suggesting that I should package my servlets too?

Sio

-Mensagem original-
De: Mark Thomas [mailto:[EMAIL PROTECTED]
Enviada em: quinta-feira, 6 de julho de 2006 19:49
Para: Tomcat Users List
Assunto: Re: The requested resource (/servlet/RegistraMarcaPropriedade)
is not available


[EMAIL PROTECTED] wrote:
 Dear all,
 
 My servlet RegistraMarcaPropriedade that was working fine suddenly
stopped
 working. I am not sure if the problem is because of my navigation or if
it's
 related to Tomcat.
 
 Can someone give me a hint?

Don't use packageless classes.

http://tomcat.apache.org/faq/classnotfound.html


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



404 persists for one servlet while another works fine

2006-07-07 Thread Siomara
Hi all again,

I am facing a weird problem. I got 2 servlets. One of them works pretty fine
while the other one is not found. Both are in the same place. I think the
problem has to do with path. 

The first servlet I call directly from index.htm, it preforms a search in a
database table and displays results in a jsp form. This works fine. I see
the rows of the table.

This jsp page has a link to a registerWhatever.htm form, and this
registerWhatever.htm form has a button that calls the other servlet. This is
where I get the error. The 404 message.

type Status report
message /Sisc/servlet/RegistraMarcaPropriedade
description The requested resource (/Sisc/servlet/RegistraMarcaPropriedade)
is not available
The address I see is perfect just like the other one:
http://localhost:8899/Sisc/servlet/RegistraMarcaPropriedade
This is driving me crazy. It was working fine before and the only thing I
did was:
turned a htm form to a jsp form to display the results of the search. Before
I had a static htm form with a link to registerWhatever.htm form (with
fields and a button to include data into the database). 
How can I always start my redirection from the application root folder?
Any help is welcome

Siomara


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RES: problem with doPost method - executed twice

2006-07-03 Thread Siomara
Thanks to you Michael,

I solved the problem including return true before submitting the form

Siomara


html

head

titleInclui/Altera Marca Propriedade/title

script language=javascript

/
// Set focus to the first form element
//
function focusFirst()
{
document.all(txtDescricao).focus();
}


///
// Validate fields and submit form elements to servlet
RegistraMarcaPropriedade
//
function doFormSubmit()
{
objfrm=document.incluiAlteraMarcaPropriedade;
//Store the file path of the next servlet/jsp to be called
strFilePath = /Sisc/servlet/RegistraMarcaPropriedade
  
strDescricao=objfrm.txtDescricao.value;
if(isSpecialChar(strDescricao) || !isChar(strDescricao))
{
alert(Favor entrar com uma descrição válida.);
objfrm.txtDescricao.focus();
return false;
}

if(isEmpty(strDescricao))
{
alert(Campo obrigatório);
objfrm.TxtNumber.focus();
return false;
}

objfrm.method=post;
objfrm.action=strFilePath;
return true;( I JUST INCLUDED THIS LINE TO MY CODE)
objfrm.submit();

}


///
// Clean all the fields
//
function doClearForm()
{
  for(i=0;idocument.inputFormSearch.elements.length-1;i++)
  {
if(document.inputFormSearch.elements[i].type==text)
document.inputFormSearch.elements[i].value=;
}
document.all(txtDescricao).focus();
return false;
}


///
// Checks whether the form input element is empty
//
function isEmpty(formelem)
{
  expisEmpty=/[^ ]/
  return ! expisEmpty.test(formelem);
}


///
// Checks whether the form input element is numeric
//
function isNumeric(formelem)
{
var expisNumeric=/[a-zA-Z\*\~|@\$\%\^\\*\(\)\#\!\`\-\+\=\.\,\?]/
return ! expisNumeric.test(formelem)
}


///
// Checks whether the form input element is a String
//
function isChar(formelem)
{
var expisChar=/[0-9]/;
return ! expisChar.test(formelem);
}


///
//Checks whether the form input element contains any Special Characters or
not.
//
function isSpecialChar(formelem)
{
var expisSpecialChar=/[\\;\\*\~\|[EMAIL PROTECTED]+\=\?]/
return expisSpecialChar.test(formelem)
}
/script

/head

body onload=javascript:focusfirst()

table border=0 cellpadding=0 cellspacing=0 style=border-collapse:
collapse bordercolor=#11 width=100%
  tr
td width=100% colspan=3
img border=0 src=images/bannerPR.jpg width=763 height=21/td
  /tr
  tr
td width=18%
b
font color=#008080 size=5SISNAC/fontfont color=#008000
size=5 /font
/b/td
td width=59%
p align=centerfont size=4bCadastramento de Nova Marca de 
Propriedade/b/font/td
td width=23%
nbsp;/td
  /tr
  tr
td width=18%
nbsp;/td
td width=82% colspan=2 align=right
nbsp;/td
  /tr
  tr
td width=100% colspan=3
p align=centernbsp;/p
form name=incluiAlteraMarcaPropriedade
  p align=left Marca de Propriedade: 
input type=text name=txtDescricao size=66/p
  p align=center
input type=submit value=Enviar name=btnSubmit onclick=
javascript:return
doFormSubmit()nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
input type=reset value=Apagar name=btnApagar/p
/form
p align=centernbsp;/p
p align=centernbsp;/p
/td
  /tr
  tr
td width=100% colspan=3nbsp;/td
  /tr
/table

/body

/html


THis is my database now:

SQL select * from marcapropriedade;

IDMARCAPROPRIEDADE DESCRICAO
-- --
 1 Acordos Internacionais
 2 Adm Pública Federal
 3 Defesa
 4 Mercosul
 5 just a test
 6 one more test

6 linhas selecionadas.








-Mensagem original-
De: Michael Jouravlev [mailto:[EMAIL PROTECTED]
Enviada em: sexta-feira, 30 de junho de 2006 18:52
Para: Tomcat Users List
Assunto: Re: problem with doPost method - executed twice


If you submit the form from form.onsubmit, return false to tell
browser that the form has already been submitted. This is Javascript,
not a Tomcat issue.

On 6/30/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hi all,

 I have not received any reply regarding the issue bellow. Please, any help
 is MORE THAN WELCOME.

 I also can´t see if my messages are reaching everybody correctly since I
get
 no copy of it when I post

problem with doPost method - executed twice

2006-06-30 Thread Siomara
Dear all,

I have developed a web application that is running under tomcat 5.5.17 that
is under windows XP.

I have a servlet that retrieves data from a html form, creates an object and
passes this object to a manager class that inserts the data into Oracle.

Everything works fine except that I noticed that my doPost method executes
twice each command. It is incrementing twice the Oracle sequence and
inserting twice the same record. 

Does anyone have a clue on what is going on?

When I look into the table this is what I get:

SQL select * from marcapropriedade;

IDMARCAPROPRIEDADE DESCRICAO
-- --
 1 Acordos Internacionais
 2 Adm Pública Federal
 3 Defesa
 4 Mercosul
45 lalalala
46 lalalala
47 papapapapapa
48 papapapapapa
49 another test
50 another test   

10 linhas selecionadas.



This is my servlet:

//package servlets;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

import objeto.MarcaPropriedade;
import objeto.MarcaPropriedadeGestor;

public class RegistraMarcaPropriedade extends HttpServlet {

  /**
   * Process the HTTP Post request
   */
  public void doPost(HttpServletRequest request, HttpServletResponse
response)
  throws ServletException, IOException {

System.out.println(I am here 1);

// Create object to store information from previous form
MarcaPropriedade marcaPropriedade = new MarcaPropriedade();
marcaPropriedade.setDescricao(request.getParameter(txtDescricao));
System.out.println(marcaPropriedade.getDescricao());

System.out.println(I am here 2);
 
// Create a MarcaPropriedadeGestor to add marcaPropriedade to the
database
MarcaPropriedadeGestor marcaPropriedadeGestor = new
MarcaPropriedadeGestor();
marcaPropriedadeGestor.add(marcaPropriedade);

System.out.println(I am here 3);

// Release resources
marcaPropriedadeGestor.releaseResources();  
   
// Here the registration is complete.
// Now send the user to the 'Relação de Marcas de Propriedades' page
RequestDispatcher dispatcher =
 
this.getServletContext().getRequestDispatcher(//Sisc/exibeMarcaPropriedade.
htm);
dispatcher.forward(request, response);
  }
}



this is what I get from LOG:

I am here 1
I am here 1
papapapapapa
papapapapapa
I am here 2
I am here 2
[Fri Jun 30 11:21:12 BRT 2006]  info: PoolManager: registered JDBC driver
oracle.jdbc.driver.OracleDriver
10
[Fri Jun 30 11:21:12 BRT 2006]  info: oracle: New pool created
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Opened a new connection
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Delivered connection from pool
dentro do add -inicio
Select MarcaPropriedadeIdSeq.NEXTVAL from DUAL
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Opened a new connection
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Delivered connection from pool
dentro do add -inicio
Select MarcaPropriedadeIdSeq.NEXTVAL from DUAL
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Opened a new connection
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Delivered connection from pool
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Opened a new connection
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Delivered connection from pool
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Returned connection to pool
47
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Returned connection to pool
48
insert into MARCAPROPRIEDADE values (?, ?)
insert into MARCAPROPRIEDADE values (?, ?)
I am here 3
I am here 3
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Returned connection to pool
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Returned connection to pool
I am here 1
another test
I am here 2
[Fri Jun 30 11:22:19 BRT 2006]  info: oracle: Delivered connection from pool
dentro do add -inicio
Select MarcaPropriedadeIdSeq.NEXTVAL from DUAL
[Fri Jun 30 11:22:19 BRT 2006]  info: oracle: Delivered connection from pool
[Fri Jun 30 11:22:19 BRT 2006]  info: oracle: Returned connection to pool
49
insert into MARCAPROPRIEDADE values (?, ?)
I am here 1
another test
I am here 2
[Fri Jun 30 11:22:19 BRT 2006]  info: oracle: Delivered connection from pool
dentro do add -inicio
Select MarcaPropriedadeIdSeq.NEXTVAL from DUAL
[Fri Jun 30 11:22:19 BRT 2006]  info: oracle: Delivered connection from pool
I am here 3
[Fri Jun 30 11:22:19 BRT 2006]  info: oracle: Returned connection to pool
[Fri Jun 30 11:22:19 BRT 2006]  info: oracle: Returned connection to pool
50
insert into MARCAPROPRIEDADE values (?, ?)
I am here 3
[Fri Jun 30 11:22:19 BRT 2006]  info: oracle: Returned connection to pool 



problem with doPost method - executed twice

2006-06-30 Thread Siomara
Dear all,

I have developed a web application that is running under tomcat 5.5.17 that
is under windows XP.

I have a servlet that retrieves data from a html form, creates an object and
passes this object to a manager class that inserts the data into Oracle.

Everything works fine except that I noticed that my doPost method executes
twice each command. It is incrementing twice the Oracle sequence and
inserting twice the same record. 

Does anyone have a clue on what is going on?

When I look into the table this is what I get:

SQL select * from marcapropriedade;

IDMARCAPROPRIEDADE DESCRICAO
-- --
 1 Acordos Internacionais
 2 Adm Pública Federal
 3 Defesa
 4 Mercosul
45 lalalala
46 lalalala
47 papapapapapa
48 papapapapapa
49 another test
50 another test   

10 linhas selecionadas.



This is my servlet:

//package servlets;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

import objeto.MarcaPropriedade;
import objeto.MarcaPropriedadeGestor;

public class RegistraMarcaPropriedade extends HttpServlet {

  /**
   * Process the HTTP Post request
   */
  public void doPost(HttpServletRequest request, HttpServletResponse
response)
  throws ServletException, IOException {

System.out.println(I am here 1);

// Create object to store information from previous form
MarcaPropriedade marcaPropriedade = new MarcaPropriedade();
marcaPropriedade.setDescricao(request.getParameter(txtDescricao));
System.out.println(marcaPropriedade.getDescricao());

System.out.println(I am here 2);
 
// Create a MarcaPropriedadeGestor to add marcaPropriedade to the
database
MarcaPropriedadeGestor marcaPropriedadeGestor = new
MarcaPropriedadeGestor();
marcaPropriedadeGestor.add(marcaPropriedade);

System.out.println(I am here 3);

// Release resources
marcaPropriedadeGestor.releaseResources();  
   
// Here the registration is complete.
// Now send the user to the 'Relação de Marcas de Propriedades' page
RequestDispatcher dispatcher =
 
this.getServletContext().getRequestDispatcher(//Sisc/exibeMarcaPropriedade.
htm);
dispatcher.forward(request, response);
  }
}



this is what I get from LOG:

I am here 1
I am here 1
papapapapapa
papapapapapa
I am here 2
I am here 2
[Fri Jun 30 11:21:12 BRT 2006]  info: PoolManager: registered JDBC driver
oracle.jdbc.driver.OracleDriver
10
[Fri Jun 30 11:21:12 BRT 2006]  info: oracle: New pool created
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Opened a new connection
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Delivered connection from pool
dentro do add -inicio
Select MarcaPropriedadeIdSeq.NEXTVAL from DUAL
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Opened a new connection
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Delivered connection from pool
dentro do add -inicio
Select MarcaPropriedadeIdSeq.NEXTVAL from DUAL
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Opened a new connection
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Delivered connection from pool
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Opened a new connection
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Delivered connection from pool
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Returned connection to pool
47
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Returned connection to pool
48
insert into MARCAPROPRIEDADE values (?, ?)
insert into MARCAPROPRIEDADE values (?, ?)
I am here 3
I am here 3
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Returned connection to pool
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Returned connection to pool
I am here 1
another test
I am here 2
[Fri Jun 30 11:22:19 BRT 2006]  info: oracle: Delivered connection from pool
dentro do add -inicio
Select MarcaPropriedadeIdSeq.NEXTVAL from DUAL
[Fri Jun 30 11:22:19 BRT 2006]  info: oracle: Delivered connection from pool
[Fri Jun 30 11:22:19 BRT 2006]  info: oracle: Returned connection to pool
49
insert into MARCAPROPRIEDADE values (?, ?)
I am here 1
another test
I am here 2
[Fri Jun 30 11:22:19 BRT 2006]  info: oracle: Delivered connection from pool
dentro do add -inicio
Select MarcaPropriedadeIdSeq.NEXTVAL from DUAL
[Fri Jun 30 11:22:19 BRT 2006]  info: oracle: Delivered connection from pool
I am here 3
[Fri Jun 30 11:22:19 BRT 2006]  info: oracle: Returned connection to pool
[Fri Jun 30 11:22:19 BRT 2006]  info: oracle: Returned connection to pool
50
insert into MARCAPROPRIEDADE values (?, ?)
I am here 3
[Fri Jun 30 11:22:19 BRT 2006]  info: oracle: Returned connection to pool 



RES: problem with doPost method - executed twice

2006-06-30 Thread Siomara
I did not get this message. Can you please resend it?

Thanks

-Mensagem original-
De: Michael Jouravlev [mailto:[EMAIL PROTECTED]
Enviada em: sexta-feira, 30 de junho de 2006 16:02
Para: Tomcat Users List
Assunto: Re: problem with doPost method - executed twice


Did the answer that posted four hours ago in your other thread with
the same title not work for you?

On 6/30/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Dear all,

 I have developed a web application that is running under tomcat 5.5.17
that
 is under windows XP.

 I have a servlet that retrieves data from a html form, creates an object
and
 passes this object to a manager class that inserts the data into Oracle.

 Everything works fine except that I noticed that my doPost method executes
 twice each command. It is incrementing twice the Oracle sequence and
 inserting twice the same record.

 Does anyone have a clue on what is going on?

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



problem with doPost method - executed twice

2006-06-30 Thread Siomara
Hi all,

I have not received any reply regarding the issue bellow. Please, any help
is MORE THAN WELCOME. 

I also can´t see if my messages are reaching everybody correctly since I get
no copy of it when I post.

Sio
-Mensagem original-
De: Siomara Cintia Pantarotto 
Enviada em: sexta-feira, 30 de junho de 2006 15:45
Para: 'users@tomcat.apache.org'
Assunto: problem with doPost method - executed twice


Dear all,

I have developed a web application that is running under tomcat 5.5.17 that
is under windows XP.

I have a servlet that retrieves data from a html form, creates an object and
passes this object to a manager class that inserts the data into Oracle.

Everything works fine except that I noticed that my doPost method executes
twice each command. It is incrementing twice the Oracle sequence and
inserting twice the same record. 

Does anyone have a clue on what is going on?

When I look into the table this is what I get:

SQL select * from marcapropriedade;

IDMARCAPROPRIEDADE DESCRICAO
-- --
 1 Acordos Internacionais
 2 Adm Pública Federal
 3 Defesa
 4 Mercosul
45 lalalala
46 lalalala
47 papapapapapa
48 papapapapapa
49 another test
50 another test   

10 linhas selecionadas.



This is my servlet:

//package servlets;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

import objeto.MarcaPropriedade;
import objeto.MarcaPropriedadeGestor;

public class RegistraMarcaPropriedade extends HttpServlet {

  /**
   * Process the HTTP Post request
   */
  public void doPost(HttpServletRequest request, HttpServletResponse
response)
  throws ServletException, IOException {

System.out.println(I am here 1);

// Create object to store information from previous form
MarcaPropriedade marcaPropriedade = new MarcaPropriedade();
marcaPropriedade.setDescricao(request.getParameter(txtDescricao));
System.out.println(marcaPropriedade.getDescricao());

System.out.println(I am here 2);
 
// Create a MarcaPropriedadeGestor to add marcaPropriedade to the
database
MarcaPropriedadeGestor marcaPropriedadeGestor = new
MarcaPropriedadeGestor();
marcaPropriedadeGestor.add(marcaPropriedade);

System.out.println(I am here 3);

// Release resources
marcaPropriedadeGestor.releaseResources();  
   
// Here the registration is complete.
// Now send the user to the 'Relação de Marcas de Propriedades' page
RequestDispatcher dispatcher =
 
this.getServletContext().getRequestDispatcher(//Sisc/exibeMarcaPropriedade.
htm);
dispatcher.forward(request, response);
  }
}



this is what I get from LOG:

I am here 1
I am here 1
papapapapapa
papapapapapa
I am here 2
I am here 2
[Fri Jun 30 11:21:12 BRT 2006]  info: PoolManager: registered JDBC driver
oracle.jdbc.driver.OracleDriver
10
[Fri Jun 30 11:21:12 BRT 2006]  info: oracle: New pool created
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Opened a new connection
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Delivered connection from pool
dentro do add -inicio
Select MarcaPropriedadeIdSeq.NEXTVAL from DUAL
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Opened a new connection
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Delivered connection from pool
dentro do add -inicio
Select MarcaPropriedadeIdSeq.NEXTVAL from DUAL
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Opened a new connection
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Delivered connection from pool
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Opened a new connection
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Delivered connection from pool
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Returned connection to pool
47
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Returned connection to pool
48
insert into MARCAPROPRIEDADE values (?, ?)
insert into MARCAPROPRIEDADE values (?, ?)
I am here 3
I am here 3
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Returned connection to pool
[Fri Jun 30 11:21:13 BRT 2006]  info: oracle: Returned connection to pool
I am here 1
another test
I am here 2
[Fri Jun 30 11:22:19 BRT 2006]  info: oracle: Delivered connection from pool
dentro do add -inicio
Select MarcaPropriedadeIdSeq.NEXTVAL from DUAL
[Fri Jun 30 11:22:19 BRT 2006]  info: oracle: Delivered connection from pool
[Fri Jun 30 11:22:19 BRT 2006]  info: oracle: Returned connection to pool
49
insert into MARCAPROPRIEDADE values (?, ?)
I am here 1
another test
I am here 2
[Fri Jun 30 11:22:19 BRT 2006]  info: oracle: Delivered connection from pool
dentro do add -inicio
Select MarcaPropriedadeIdSeq.NEXTVAL from DUAL
[Fri Jun 30 11:22:19 BRT 2006]  info: oracle