Less than 42 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JavaScript to JSF  RSS feed

 
Grae Cullen
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • 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
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!