Re: R: R: my execute method of action class is getting executed twice

2007-12-04 Thread Dave Newton
What JavaScript confirm message?

*Please* post the complete code.

And stop copying me; replying to the list is fine.

d.

--- Gigliotti, Andrea [EMAIL PROTECTED] wrote:

 I tried to remove the javascript confirm message, and now it work fine!
 
 I still have the localization problem with the package_it.properties file.
 This is a bug for sure!
 
 Andrea
 
 -Messaggio originale-
 Da: Dave Newton [mailto:[EMAIL PROTECTED]
 Inviato: martedì 4 dicembre 2007 15.38
 A: Gigliotti, Andrea
 Oggetto: Re: R: my execute method of action class is getting executed twice
 
 Okay, now post the rest of it: the action
 configuration, the HTML/JSP, any additional
 JavaScript, etc.
 
 d.
 
 --- Gigliotti, Andrea
 [EMAIL PROTECTED] wrote:
 
  Below my configuration:
 
  O.S. Windows XP Pro (ITA)
  Tomcat 5.0.27
  JDKL 1.5.0.12
  IE 6.0
 
 
  Action's code:
  - - - - - - - - - - - - -
  package it.kappapackaging.com.action.visits;
 
  import java.sql.Connection;
  import java.sql.DriverManager;
 
  import com.opensymphony.xwork2.ActionSupport;
 
  import it.kappapackaging.com.dao.VisitDao;
  import it.kappapackaging.com.db.DBConnection;
 
  /**
   * Base Action class for the Tutorial package.
   */
  public class Delete extends
  it.kappapackaging.com.action.ActionBase {
 
 
  public String execute() throws Exception {
 
  VisitDao vis = new VisitDao();
  vis.setBean(request);
 
  if(vis.deleteBean() == 1) return SUCCESS;
  else return ERROR;
 
  }
 
  }
  - - - - - - - - - - - - -- - - - - - - - - - - - -
  Method's code in class VisitDao:
 
  public int deleteBean() {
  java.sql.Statement s = null;
  String sql = ;
  //Connection conn = null;
  int ret = 0;
  try {
  //conn = DBConnection.getAccessConnection();
  s =
 
 DBConnection.getAccessConnection().createStatement();
  //s = conn.createStatement();
  sql = DELETE FROM Visits;
  sql +=  WHERE vis_mill = ' +
  decodeMill(mill_code) + ';
  sql +=  AND vis_customer_code =  +
  customerCode;
  sql +=  AND vis_date = Format(' + visitDate +
  ', 'mm/dd/');
  sql +=  AND vis_oper = ' + oper + ';
  sql +=  AND vis_type =  + typeCode;
  sql +=  AND vis_inser = Format(' + visitInser +
  ', 'mm/dd/ HH:mm:ss');
  ret = s.executeUpdate(sql);
  //DBConnection.getAccessConnection().commit();
  } catch (SQLException e) {
  // TODO Auto-generated catch block
  e.printStackTrace();
  }
  finally {
  try {
  if(s != null) s.close();
  //conn.close();
  } catch (SQLException e) {
  e.printStackTrace();
  }
  }
  return ret;
 
  }
  - - - - - - - - - - - - -
 
  The class ActionBase extends ActionSupport.
  The action's execute method is called twice!
 
  Andrea
 
  -Messaggio originale-
  Da: Dave Newton [mailto:[EMAIL PROTECTED]
  Inviato: martedì 4 dicembre 2007 15.08
  A: Struts Users Mailing List
  Oggetto: Re: my execute method of action class is
  getting executed twice
 
  --- giglian [EMAIL PROTECTED]
  wrote:
   The method return the number of rows deleted.
 
  What method does? A method being called by
  execute()?
 
   I thought was a bug of my application, but now i'm
   thinking it's a bug of struts 2 framework. I hope
   will be fix very soon.
 
  That's certainly possible, but I've certainly never
  seen an extra call to execute() for no reason.
 
  Did you post your configuration and action code in
  question?
 
  d.
 
 
 
 -
  To unsubscribe, e-mail:
  [EMAIL PROTECTED]
  For additional commands, e-mail:
  [EMAIL PROTECTED]
 
 
 
 **
  Le informazioni contenute in questa comunicazione
  sono riservate e
  destinate esclusivamente alla/e persona/e o
  all'ente/i a cui sono
  stati indirizzati. Se questa comunicazione Vi e'
  pervenuta per errore,
  siete pregati di informare il mittente rispondendo a
  questa mail.
 
  Questa nota conferma inoltre che questa mail e'
  stata verificata da un
  opportuno programma contro la presenza di virus
  informatici.
 
  This email and any files transmitted with it are
  confidential and
  intended solely for the use of the individual or
  entity to whom they
  are addressed. If you have received this email in
  error please notify
  the sender.
 
  This footnote also confirms that this email message
  has been swept by
  appropriate software for the presence of computer

Re: R: R: my execute method of action class is getting executed twice

2007-12-04 Thread Dave Newton
--- Gigliotti, Andrea [EMAIL PROTECTED] wrote:
 I tried to remove the javascript confirm message, and now it work fine!

Btw, I'm in the camp of the other comment that said you're probably
submitting it twice (without knowing, since you didn't post the complete
code). If you're doing a submit from within the handler somewhere and not
returning false to the onclick attribute then it will be submitted by both
your handler and via a regular form submission.

d.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]