aspose file tools*
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
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
Author

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem passing value to method in correct order(SOLVED)