• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Javascript submit not working

 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Water proof donuts! Eat them while reading this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic