• Post Reply Bookmark Topic Watch Topic
  • New Topic

Adding and displaying the sum of values with AJAX and JSF  RSS feed

Sam Williams
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

As detailed in my previous post, I am still fairly new to the whole java scene, let along JSF and AJAX and am getting a grasp of it so far.

I was just curious in regards to a issue I am currently having regarding a basic AJAX calculator within JSF. I am looking to display the total of two+ numbers as the variable in the backing bean is altered however for some reason the total only displays the last item selected?

The price of the object selected in the dropdown is looked up in the database and the price then assigned to itemOneToAdd variable which in turn is successfully shown with AJAX on the xhtml page.

There is a total of four items, all being more or less identical to the code below however for itemtwo etc etc, and as described above, when the first item is selected the subtotal is updated, however when the second item is selected instead of adding it to the subtotal it displays the value of the second item?

Hopefully someone can show me the way regarding this, preferably with a example as I have tried numerous ways to try and get this working however to no avail thus far.

Apologies for any obvious mistakes, still quite new to working with AJAX and JSF! :)

Thanks a mill!

xhtml snippet

Java snippet

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!