• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

JavaScript to JSF

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I guess things like this get asked a lot, but I am still having trouble with you. The answer I normally find is use AJAX... However, this is such a common problem, that I am hoping there is some other way around it. I don't really want to learn AJAX, for what I think should be a very simple form submit.

Let say I get a value in JavaScript; I would like to submit that value to the backing bean in JSF. I don't mind submitting the whole page. When the user submits the form, how do I send an extra value to the backing bean on the server?

What I need is something like the #{beanName.property} binding for components. However, I don't want to add an extra component to the site that the user will see.

Thanks,
Grae
 
Saloon Keeper
Posts: 25477
180
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Grae.

If you don't want to submit a component that the user can see, submit a component that the user can't see. Use the JSF tag that corresponds to the <INPUT TYPE="HIDDEN> HTML tag. Which is something like <h:inputHidden value="#{myBean.myHiddenProperty"}"/>, if my memory isn't too defective.
 
Grae Cullen
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you. I think that solved it. Just to be clear, how would you modify the value from the client side? Just a document.getElementById() call?

Thanks,
Grae
 
Grae Cullen
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks again. I am pretty sure i could do it now. So if your busy, don't worry about answering again.
 
You don't like waffles? Well, do you like this tiny ad?
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic