• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Setting bean value problem

 
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
This mught be a very basic question. Don't know.

In my first page, I have a list of item to display to the user as below:
>

1. Of which fetches a list of items from the database to show a drop down list. And my config.xml is as below for the scope


2. Second item is a list from my config.xml as below:



3. Third item is just a inout box which is used to get the user inout and I have a validator to check for some specific formats.

As such I don't have problem in getting the values of what the user chooses and displying in the next page as well as I am updating a table in the database using hibernate.

Due to some special requirement, I am having some problem now.

Again let me repeat what I am displaying.

1. 1st item is a list (drop down)from a database as abc, def, hij and klm
2. 2nd item is a list (drop down) from my face-config.xml as extended and none
3. 3rd item is a input box.
4. I am using proper getter and setter methods to capture the values and sisplay in the next page as well as updating the database with respective values.

Now I want to check whether the item in the second value is (if the user chooses none from the drop down list) none and if it is so, I want to make the first and second value as none too.

I tried setting the values in the getter setter methods but it is throwing some exception as "null pointer exception" during database update.

For example as below:



How do I do it? Please let me know.
 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You mentioned that the exception is thrown in the DB update section, so is the display of the first drop down correct?

Also, paste the exception log for us to analyze.
 
Gopu Akraju
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Joe,
Thanks for your response.
The display of the list from the dabase is perfect. Update means, I am trying to get tehse three values and update into another table in the database.

Basically it is throwing "null pointer exception" Please let me know how to change the values of other two values depending upon the value the user chooses.

Regards
 
Joe Matthew
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I still did not get your issue. Are you trying to insert into the DB table when you get this error message?

Posting the exception log will go a long way to clear the confusion.
 
Gopu Akraju
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Joe,
Thanks. I will post the log on Monday.

My basic question is, I have three valus in a page. Sorry if my question is not clear for you.

1.Item1 is a drop down list from face-config.xml
2. Item2 is a drop down list from a database tableA
3. Inputbox.

Depending upon the value in the item2, I want to set the values for Item1 and Item2 and then finally save them in a database tabeB and also I want to display these values in the next page.

I tried using setter methods of UserBean and it is throwing exception. UserBean class contains getter and setter methods for Item1, Item2 and Item3 backing beans.

If the user chooses for example "non" for the Item2, the I want to make both Item1 and Item3 as "none".

I have no idea on how to do this. Please let me know. Thanks.
 
Gopu Akraju
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone tell me how to manipulate the bean value(Item1 and Item3) depending upon item2 value. Because right now I am using only one Java class (UserBean) for all getter and setter methods for all tem1, item2 and item3. If I want to manipulate bean value as I mentioned earlier, where to set them? Thanks.
reply
    Bookmark Topic Watch Topic
  • New Topic