Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Retrieve value from state on submit  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a xhtml with:



... and in the backingbean:



.. and I call a webservice in createNew()

My problem is that maybe I have misunderstood everything about hos JSF works?

I thought that when I used value="#{myListBacking.myState.text} that would bind the xhtml view together with the backing view so that when I click submit, I can retrieve the value from myState and use it for calling the webservice.
I have another field that it works with - but is this even the right way to go?



 
Bartender
Posts: 20353
111
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Peter!

I am not 100% certain I understood the question, but I think you're saying that you can neither see the value of myListBacking.myState.text when you display the View nor can you update the value of myListBacking.myState.text when you submit the form.

Since your examples are only partial, I'm going to have to assume things about the parts that aren't shown. We prefer, when possible, that you show as complete an example as you can (although if you dump large chunks of code, no one will read them, so there's a compromise there).

First off, you don't show "inputfield" actually in a form on your View Template (xhtml). All controls that you want to submit to the server must be in a form, That is basic HTML requirements. For JSF, the form must be a JSF "h:form" tag and not a basic (non-JSF) HTML form tag.

Secondly, you do not show any public get/set methods for the backing bean property "myState". The Expression Language (EL) processor cannot look at or in properties. Instead, you must provide public accessor methods (getMyState(), setMyState()) for it to call.

More precisely, you'd need a "public MyState getMyState() { return myState; }" method. You don't need a "set" method, since this property won't be set from incoming JSF form submit.

Of course, the value "text" within class MyState needs public getText() and setText() methods, because here again EL expects standard JavaBean architecture.
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!