aspose file tools*
The moose likes Struts and the fly likes Javascript submit not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Javascript submit not working" Watch "Javascript submit not working" New topic
Author

Javascript submit not working

Kim Kantola
Ranch Hand

Joined: May 17, 2001
Posts: 274
Hi All,
I have a jsp page with a html:link that has a reference to a Javascript method when it is clicked on:



The javaScript method should submit the page:


I can see that I do get into the javascript method because I see the alert message. However, instead of submitting the page, I seem to get redirected to a Tomcat page which says :

Directory Listing For /

And then lists the folders conf, dist, web, etc.

Can't seem to figure out why this is happening, It looks like I do not get to the action that I expect.

In the jsp I have :


and in struts-config.xml :


[ April 23, 2007: Message edited by: Kim Kantola ]
Purushoth Thambu
Ranch Hand

Joined: May 24, 2003
Posts: 425
I don't see you using anything specific to Struts in the html:link element. If you look at the Struts api documentation for link tag you can see that

You must specify exactly one of the action attribute, the forward attribute, the href attribute, the linkName attribute, or the page attribute.


And you don't mention any one of the required attribute and this mostly likely would have caused the issue. I would suggest you test with ordinary link and confirm the issue.

Here is the link.
Kim Kantola
Ranch Hand

Joined: May 17, 2001
Posts: 274
Ah, thank you very much for your reply. It got me to thinking about why I was using a html:link in the first place. What I needed was to click on some text on my page and be sent to some javascript code on the page. I googled around and found this way to do this, and it did work.



Thanks again, and let me know if you think this is not the best way to handle what I am trying to do.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Javascript submit not working