Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Javascript submit not working

 
Kim Kantola
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic