• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Resolving EL

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

I have two command buttons on my jsp, which I should show or hide based on the user action for which I have set a property in by backed bean.

i am using the rendered tag for this, the logic works fine

I mean the buttons are displayed accordingly, but one of the button does not work having the particular expression in the rendered tag,
below is my code....

<hx:commandExButton type="submit" value="Save"
styleClass="commandExButton" id="button1"
action="#{manage_News.insertNews}"
rendered="#{empty manage_News.actionType}"/>
<hx:commandExButton type="submit" value="Update"
styleClass="commandExButton" id="button2"
action="#{manage_News.insertNews}"
rendered="#{not empty manage_News.actionType}" />

the save button works good,

coming to the UPDATE button it is shown or hide accordingly based on the expression and what I expect

but the update button never hit my action having this particular expression,

if I change the expression like #{empty manage_News.actionType} it is displayed accordingly and also works fine,

can any one help me with this EL or if is there any problem with using 'not empty'

thank you.
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The rendered attribute is also determined during apply request values phase of the subsequent request (the form submit). You need to make sure that the getter behind the rendered attribute returns the same value as it did in the initial request (for display). Change the bean's logic, or use h:inputHidden with binding, or Tomahawk's t:saveState, or -more ridiculous-, set the bean in the session scope instead of request scope.
[ December 18, 2008: Message edited by: Bauke Scholtz ]
 
srinivas bodapati
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for the reply agin,

I don't think its the problem with scope,

If it is so, the logic should not work at all, I mean the button should not show up or should show up all the time.

But the display works fine, the buttons functionality is not working-- the button is not calling the action it is supposed to if I have this particular expression in the rendered tag.

That works fine if change the expression or remove it completely.

I hope you got what I am trying to explain here.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Read on about the JSF lifecycle and then reread my answer.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic