This week's book giveaways are in the Jython/Python and Object-Oriented programming forums.
We're giving away four copies each of Machine Learning for Business: Using Amazon SageMaker and Jupyter and Object Design Style Guide and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming 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
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Difference Between JSF request and HttpServletRequest and how do you retreive parameters from them

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am having a problem retreiving the values from my form submit.
I never have any of the input parameters come back.

Here is my code:



Here are the bean methods:



Any help would be greatly appreciated.
 
Ranch Hand
Posts: 200
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you say you aren't getting the input parameters back, what do you mean? If I understand your code correctly you're trying to do a form submit when the selectOneMenu value changes. It seems to be the only input control on the form.

For JSF to do a form submit you need an ActionListener, usually triggered by a commandButton or commandLink control with a type="submit" attribute.

 
Saloon Keeper
Posts: 21623
147
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Guy deLyonesse wrote:

For JSF to do a form submit you need an ActionListener, usually triggered by a commandButton or commandLink control with a type="submit" attribute.



Listeners are used too much in JSF. A simple action method is usually sufficient, simpler to code, and doesn't tie the backing bean as strongly to a particular technology. I think the whole listener thing came about because stale information has a remarkable way of hanging around the Internet forever. Listeners have their uses, but not as often as people think. I don't think I've ever done an ActionListener, for example, since the only real reason to would be to fire multiple methods from a single command.

The original post misses the point, however. It's an attempt to apply legacy design to an entire new paradigm. JSF is intended to allow people to be able to design a View, present it to the client, go through a series of postbacks until all submitted data in the form passes validation, then fire an Action to act on the submitted data. You don't retrieve data, it's presented to you. The more logic you code in JSF, the more likely you're doing it wrong. And the more times you explicitly reference classes in the javax.faces package tree - excepting the datamodel classes - the more likely you're doing it wrong.

JSF is designed to make things simple and easy, and the biggest problem with it is that too many people keep trying to make it not be simple and easy.
 
Eat that pie! EAT IT! Now read this tiny ad. READ IT!
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!