I would suggest that you examine the call stack of both the threads when the
breakpoint is hit in your debugger. This way you can work backwards to find
whats causing two invocations when there should just be one.

On 4/3/07, Stine, Matt <[EMAIL PROTECTED]> wrote:

Yes

-Matt

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Matt
Raible
Sent: Tuesday, April 03, 2007 12:25 PM
To: [email protected]
Subject: Re: [appfuse-user] Struts 2 Double Submit?

Does this happen if you disable JavaScript before clicking "submit"?

On 4/3/07, Stine, Matt <[EMAIL PROTECTED]> wrote:
>
>
>
>
> All,
>
>
>
> I'm not sure exactly how to describe this problem. Basically I have an
> action that is mapped to a form listing XML files to import into the
> database. The user selects X number of files and clicks submit. The
action
> then spawns an XML parser, parses the selected files, and saves them
using a
> manager/DAO. My problem is that this action's execute() method seems
to be
> called twice in separate threads, and I don't know why. I have used
the
> Tamper Data plugin for Firefox to verify that only one request is
being sent
> by the browser.  When I run in the debugger, I definitely see
execute()
> being called in two separate threads, and I also confirmed this using
debug
> log statements.
>
>
>
> Here is the action's execute method:
>
>
>
> public String execute() throws Exception {
>
>         try {
>
>             if (this.cancel != null) {
>
>                 return "cancel";
>
>             }
>
>
>
>             String[] filesToImport =
> getRequest().getParameterValues("filesToImport");
>
>             for (int i = 0; i < filesToImport.length; i++) {
>
>                 fileAbsPath = filesToImport[i];
>
>                 file = new File(fileAbsPath);
>
>
>
>                 if (file == null || file.length() > 68000000) {
>
>
> addActionError(getText("maxLengthExceeded"));
>
>                     return INPUT;
>
>                 }
>
>
>
>                 log.debug("Path to uploaded file: " +
> file.getAbsolutePath());
>
>                 log.debug("File size: " + file.length());
>
>
>
>                 //retrieve the file data
>
>                 InputStream stream = new FileInputStream(file);
>
>
>
>                 SAXParserFactory saxParserFactory =
> SAXParserFactory.newInstance();
>
>                 InputSource src = new InputSource(stream);
>
>                 MascotXMLContentHandler mascotXMLContentHandler = new
> MascotXMLContentHandler(file.getName());
>
>                 SAXParser parser = saxParserFactory.newSAXParser();
>
>                 XMLReader reader = parser.getXMLReader();
>
>
>
>                 reader.setContentHandler(mascotXMLContentHandler);
>
>                 reader.parse(src);
>
>
>
>                 SearchSummary searchSummary =
> mascotXMLContentHandler.getSearchSummary();
>
>
>
>                 searchSummaryManager.save(searchSummary);
>
>             }
>
>         } catch (Exception e) {
>
>             log.debug("Exception caught in
ImportXmlFileAction.execute():
> ",e);
>
>             e.printStackTrace();  //To change body of catch statement
use
> File | Settings | File Templates.
>
>             throw e;
>
>         }
>
>
>
>         return SUCCESS;
>
>     }
>
>
>
> And its mapping:
>
>
>
> <action name="importXmlFiles" class="importXmlFileAction">
>
>             <result
> name="success">/WEB-INF/pages/fileImported.jsp</result>
>
>         </action>
>
>
>
> Here's the log output showing the multiple threads:
>
>
>
> [mascotXmlQueries] DEBUG [btpool0-5] ImportXmlFileAction.execute(67) |
Path
> to uploaded file: C:\projects\mascotOutputFiles\F004823.xml
>
> [mascotXmlQueries] DEBUG [btpool0-5] ImportXmlFileAction.execute(68) |
File
> size: 66426926
>
> [mascotXmlQueries] DEBUG [btpool0-6] ImportXmlFileAction.execute(67) |
Path
> to uploaded file: C:\projects\mascotOutputFiles\F004823.xml
>
> [mascotXmlQueries] DEBUG [btpool0-6] ImportXmlFileAction.execute(68) |
File
> size: 66426926
>
>
>
> Any help/suggestions would be greatly appreciated. Thanks!
>
>
>
> Matt Stine
>
> Senior Software Engineer
>
> Hartwell Center for Bioinformatics and Biotechnology
>
> St. Jude Children's Research Hospital
>
> 332 N. Lauderdale St.
>
> Memphis, TN 38105
>
> Voice: 901.495.4602
>
> Fax: 901.495.5108
>
> Pgr: 901.495.3578 #1314
>
> [EMAIL PROTECTED]
>
> http://www.hartwellcenter.org
>
>


--
http://raibledesigns.com

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



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


Reply via email to