Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

Struts2: Cannot submit action after a second validation attempt.

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I am new to struts2 and have encountered a problem.
I am using struts2 2.1.8 and tiles 2.1.4.

I have a simple login form which I validate using an xml file.

If I enter correct values in my login form then the action is forwarded to the correct page (in my case a tile). My problem occurs when I try to re-submit my form after the validation happened once (it worked correctly), meaning that if I re-enter correct values in my form, the action is not forwarded to my tile page.

I noticed that the url is incorrect after my second attempt to submit the form. When everything works, the url should be: http://localhost:8080/intellitracker/jsp/struts2/open/loginAction.action
After the validation occurred and I re-submit my form the url is: http://localhost:8080/intellitracker/loginAction.action. Obviously, it's missing "jsp/struts2/open/" so it can't display the tile correctly.

Can anybody help me with this problem?
Here is the related code to my login action:

tiles.xml


struts.xml


LoginAction-validation.xml


My welcome page which redirects to my login form:
index.jsp


login.jsp


Finally my action class
LoginAction.java


Any help would be appreciated.

Thanks,

Will
 
William Lopez
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I finally figured out why it wasn't working.
In my web.xml, the url mapping that I used for struts was "jsp/struts2/*". So, when I submitted the action it just sent loginAction.action which does not match the pattern for struts to handle it. When i put "/*" everything works fine.

My question now is, how can I submit a form that will have the "jsp/struts2/myAction.action" so that struts will be able to handle it?

Thanks,

Will
 
Drove my Chevy to the levee but the levee was dry. A wrung this tiny ad and it was still dry.
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic