aspose file tools*
The moose likes Struts and the fly likes getting an exception while calling processpopulate()  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "getting an exception while calling processpopulate()  " Watch "getting an exception while calling processpopulate()  " New topic
Author

getting an exception while calling processpopulate()

Sateesh Thota
Greenhorn

Joined: Dec 30, 2007
Posts: 5
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

Joined: Dec 30, 2007
Posts: 5
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

Joined: Feb 08, 2006
Posts: 948
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getting an exception while calling processpopulate()