• 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 ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Example to make JSF work with DWR

Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I have been trying to get JSF to work with DWR.I keep getting a javascript error on the onblur where I call the Serverside JavascriptBasic HTMl code works fine but it sarts failing as soon as I introduce JSF JSP tags. I have read the DWR links on JSF Integration.

I am trying to populate the city and state based on the zip from a DB.I have dwr.xml setup along with web.xml. As i said, the example works fine with plain old HTML but when i try to introduce JSF , it doesn't like the
DWR tags to get the value in the onblur.
Any help or any example showing some code example is appreciated.

I am not able to post my code.Tried a few times and changed the < etc.

Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've noticed that JSF checks the value in the posted form versus the selectItems on the server side. So if for example :

Say for example that stateItems returns as the list of Mexican states. Then through Ajax I change that list to US states. JSF will once again rebuild stateItems, realize that the posted state ID isn't in the select list and create a validation error. You have to tell your managed bean that the list changed too.

So what I do is use the verbatim tag to place a facade HTML code on the page with some javascript that copies those values to a hidden field. I have a state select which isn't linked to any JSF component and a hidden field with the state value. On page load the list is populated with the state values and the hidden state value is set. The user can work all he wants with Ajax. On submit the select value is copied to the hidden field and posted.

It isn't real JSF / AJAX integration, but it has two benefits. One it is simple. Two it lets me test AJAX independent of JSF. Kinda like a view inside a view. Once your done working with those values, they get copied to the hidden fields and posted.
Today's lesson is that you can't wear a jetpack AND a cape. I should have read this tiny ad:
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic