Meaningless Drivel is fun!*
The moose likes Struts and the fly likes Null value is coming Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Null value is coming" Watch "Null value is coming" New topic
Author

Null value is coming

pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 300
Hi List[],

I have two list box first list box is showing State.On clicking the state the value in the second box is changing according to state.But when i am selecting the second list box value and submitting the value its showing null value.
Please help me how to solve this problem.

My Jsp Page;


and second jsp page which acting like java script file


David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

So the second select box has a name of "select"? Is there a "select" property in your action? (That's not a very specific name--it might be better in the long run to name it something meaningful.)

When posting code examples it's best to limit the posted code to only the code directly related to the problem. It's difficult to wade through 125 lines of HTML just to find the 5-10 lines of the state select box and ajax tag.
pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 300
ok,Next time i will post the limited code.

But still i am getting the null value even i created the setter and getter in action class.

Thanks
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Have you checked teh actual submission to see if a "select" form value is being sent from the browser?
pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 300
Hi David Newton ,

I am not understanding what you saying .Can you explain in detail.



Thanks
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Using a tool like HttpHeaders, Firebug, etc. have you checked to make sure there's a "select" form value being sent?

If there's a "select" form value, and a select setter of the appropriate type (how did you declare your setter?) then it should work, assuming the HTML is rendering and submitting properly.
Saifuddin Merchant
Ranch Hand

Joined: Feb 08, 2009
Posts: 597

The usual way to check if the parameter is getting passed is using a tool like HttpHeaders, Firebug like David has mentioned.

Other than that (as I think your is a get request) you should be able to see the parameters being passed in the URL itself (The URL once you click the submit button) Check to see if the parameters are getting passed there.
(In case of post a simple trick is to temporarily change the method to get - to see if the parameters being passed are correct. Of course if its Ajax there is no option but to fall back on Firebug and any http sniffer)

Cheers - Sam.
Twisters - The new age Java Quiz || My Blog
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

@Sam: The <s:form> tag creates a POST request by default. Also, in this case, the form submission itself isn't Ajax--just the load of the secondary select.
pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 300
Hi,

I have install the firebug. and when inspect its show the structure like this.

name "state"
options [options]
.
.
.
.
.
value= 3.

what does it mean.


David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

...

Okay, maybe it *would* be easier for you to change the form method to "get" and check the URL :/

Ultimately, you have to determine if the value is being sent from the client to the server.

You still haven't mentioned how your setter is declared.
pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 300
but when i am posting data using get method .it does not showing values in url i.e it sending data as post method.

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Are you getting *any* data? How is your setter declared? Can you post the *entire* POST data from Firebug so we can see what's being sent?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Null value is coming
 
Similar Threads
How to retain the latest selected value of drop down box.
No result defined for action
Need help in getting check box values
how to add dynamic row in strut2
Jsp file not compling