• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting an exception while calling processpopulate()

 
Sateesh Thota
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This exception is happening after processing 10 similar requests and for the 11th request it throws an error..

I have two formbeans formA and formB
formB exdends formA..
In formB .. I have a property 'currenId' and getters and setters for it..

In formB .. I have a property 'policy'. it also has a getter.. but in set method..I am using the getCurrentId() method..

setPolicy() {
getCurrentId();
}

The problem is for initial 10 requests there is no error because the setCurrentVehicleId() is called first and later setPolicy().. But for next request.. propcesspopulate() method calls setPolicy() first.. the currentId was not set yet..so it was throwing some NUll Pointer..


Is there any order in which the request parameters are populated to the formBean ?
I have solved this issue by following a different way..But I was curious how this processpopulate sets the order..


let me know If you need any information
Thanks,
Sateesh
 
Sateesh Thota
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I made a correction to above question ..replaced formB with formA..

This exception is happening after processing 10 similar requests and for the 11th request it throws an error..

I have two formbeans formA and formB
formB exdends formA..
In formA .. I have a property 'currenId' and getters and setters for it..

In formB .. I have a property 'policy'. it also has a getter.. but in set method..I am using the getCurrentId() method..

setPolicy() {
getCurrentId();
}

The problem is for initial 10 requests there is no error because the setCurrentVehicleId() is called first and later setPolicy().. But for next request.. propcesspopulate() method calls setPolicy() first.. the currentId was not set yet..so it was throwing some NUll Pointer..


Is there any order in which the request parameters are populated to the formBean ?
I have solved this issue by following a different way..But I was curious how this processpopulate sets the order..


let me know If you need any information
Thanks,
Sateesh
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you would want to code your set methods such that they can be called in any order and not produce NullPointerExceptions. You could look at the Struts source code to get your answer. I am not sure if it starts by looking at the properties on your form and checking the request, or if it starts with a list of parameters on the request and checks your form for matching properties. In either case I would not count on any specific order.

- Brent
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic