File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem passing value to method in correct order(SOLVED)

 
Matt Kohanek
Village Idiot
Ranch Hand
Posts: 484
Java jQuery Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic