• 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

Struts2 form action does not get invoked on clicking submit button

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Team,

I have built simple struts2 based websites but have never come across such a problem. There are basically two actions in my struts.xml.
The "customer-form" action just displays a web-form (customer.jsp) to add customer name,age,email and telephone. There is a submit button as well on this page but clicking

I am using simple tiles and the baselayout.jsp uses css.

Code for customer.jsp


The problem is that on clicking submit button "customer" action does not get called. Clicking on it just calls the same action "customer-form"....I have tried adding action on the submit button itself but the same thing happens.

Here is my struts.xml


Sometimes I get the javascript error although I have not defined any javascript in my application.




Rquest you to please suggest what could be the probable reasons for this.

Please suggest.
 
Chandan Kushtawar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One more update:

I have been able to resolve the javascript error by disabling the Customer-Validation.xml but still getting the same problem. The form action does not just get called on pressing the submit button. It keeps on referring the same action 'customer-form' instead of the action 'customer'. But using <s:a href="customer">Customer</s:a> the action customer does get called BUT the form's text values come as null. Please help.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


The validate attribute should only be "true" if you want to use client side validation, and in order to use client side validation, you must use either the xhtml or ajax themes. see here
It sounds like your validation is kicking you back to the page you declared for input results.
 
But how did the elephant get like that? What did you do? I think all we can do now is read 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