• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Model object is not populated directly in struts2

 
Arulselvan Dharmalingam
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am new to struts2. i tried to populate model object from action class directly.when i run the application the null pointer exception thrown.this mean struts is not populated the form values into model object.i used spring for dependency injection.please go through the following files and let me know.thanks

MY Action class


Struts.xml


aplicationContext.xml for spring


jsp
 
Joe Ess
Bartender
Posts: 9312
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch.
Please UseCodeTags in the future. They preserve your formatting and make your code easier to read.
 
krishna bala
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Pleaase go through following sites,you'll get good examples
struts2 sample code
www.vaannila.com,
 
Arulselvan Dharmalingam
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Krishna,
it's working fine.
mistake in name property username
<s:textfield name="user.username" label="Username"/>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic