• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts Form Values are null

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I have a form called as UserForm(UserForm.java ) and a UserAction(UserAction.java) configured in the struts config for the dispatch action method named getUserDetails.The UserForm has a property called as userID.

My JSP Code is

<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>

<html:form styleId="userForm"
action="/DisplayUserDetails.do?method=getUserDetails"
method="POST">
<html:text name="userForm" property="userID" styleClass="usertextbox"></html:text>
<html:submit value="GO" styleClass="buttonedit"></html:submit>

</html:form>

This HTML form is a part of a tile layout.When I submit the form ,the userID value in the getUserDetails method of the UserAction Class is found to be null..Is there any reason for the userID to be null ???

I have the correct form bean mapping and action mapping in the struts config and also the getters and setters for the form properties are correct.Can U let me know why the form values are null on submit ??? I also tried submitting the form using Java Script and still the form values are found to be null..My Struts version is 1.3.5

Any Clues???

Thanks in Advance ..
Ram
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you remove the parameter from your action attribute and add the following tag, it will work.

An <html:hidden> tag will work also, but if you use it, you must also add a method property to your form bean.
 
I have a knack for fixing things like this ... um ... sorry ... here is a consilitory tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic