wood burning stoves 2.0*
The moose likes JSF and the fly likes problem passing value to method in correct order(SOLVED) 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 » Java » JSF
Bookmark "problem passing value to method in correct order(SOLVED)" Watch "problem passing value to method in correct order(SOLVED)" New topic

problem passing value to method in correct order(SOLVED)

Matt Kohanek
Village Idiot
Ranch Hand

Joined: Apr 04, 2009
Posts: 483

I have my jsf page that has an input field and a submit button.

The input field binds the text the user enters to deviceContainer.Device.name (package.class.variable)
The submit button calls a method that is in a different package though - projectContainer.project.addDevice (package.class.method)

So in this addDevice method, I have tried a few different things, but the value being passsed is remaining null instead of getting the updated name variable from the deviceContainer package.

Here is a snippet of the method that is in the projectContainer package that is receiving a null value:

Now if I put this method in the same device class that holds the name variable it works just fine, I just have to change the device.setName(device.getName()) method to device.setName(name);

But this is not an option in this case.

So is there a way to fix this? I guess what needs to happen will be first when the user hits submit the values are set in the device class. That way when I do device.setName(device.getName()); in the project class it will return the value the user enters instead of null.

solution - I just added a deviceName variable to the project class so it wouldnt need to pull this value froma different class. these things are so simple if you just take a step back and think about them

True wisdom is in knowing you know nothing - Socrates
It is sorta covered in the JavaRanch Style Guide.
subject: problem passing value to method in correct order(SOLVED)
Similar Threads
null value being passed to method. value should come from inputText field but not working (SOLVED)
Need to make empty text fields not pass null as the value, need them to just not pass anything
Need help figuring out why I am getting <Detail>Operation Not Implemented</Detail> when doing "put"
Trying to bind inputText fields from an a4j:repeat tag to java code
Is there java class to parse xml nodes?