• Post Reply Bookmark Topic Watch Topic
  • New Topic

Command button useless  RSS feed

 
Hernán Quevedo
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

I have a command button <h:commandButton type="submit" value="#{msg.esku_title_module}" action="#{eskuNavigatorBean.goWhatDescription}">

which is in a <f:subview> tag, which is included through a <jsp:include> tag in another jsp. The thing is that is not doing anyhing but cleaning the form above it. It passes throught all the JSF phases and that's it, no error, no debug from the invocation phase is being logged.

Any ideas?

Thnx.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it been placed in a (single) h:form? If so, does it or one or more of its parent elements have the 'rendered' attribute set by EL? If so, does it (they all) evaluate true at the moment that JSF determines which command action to invoke (during 2nd phase, the apply request values)?
 
Hernán Quevedo
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I forgot to include the attribute rendered="#{!searchSKUBean.emptyGrid}", which behaves normally checking if some dataTable is empty, if so, it doesn't render.
When I submit the form, the only one, the table gets populated and the button shows up; when I click it, nothing happens, other than erasing table data hence evatulating true at the rendered condition.

I actually have two buttons, set with the same condition on the rendered attribute. They do evaluate true at second phase.
 
Hernán Quevedo
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Done it.

It was very silly... My faces-config.xml was having this bean in a request scope. I put it on session and the dataTable holds the data all the time unless I nullify objetcs on purpose.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Placing it in session scope has more impact on user experience. Think about opening multiple windows/tabs in the same session.

Request scoped data should be placed in the request scope. If the commandbutton is placed in a datatable whose rendering is dependent on the availablility of the datamodel, you should rather construct the datamodel in the constructor of the bean or at least introduce lazy loading in the getter of the datamodel.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!