Skip to main content

Problem with attribute rendered

3 replies [Last post]
pmshik
Offline
Joined: 2010-06-04
Points: 0

I have problem with attribute "rendered". I use it to manage visibility of buttons. Visibility works correctly. But when this attribute is set(button shown) and I click button,method doCancelEditBuilding does not called. Instead of redirecting to building_list.xtml page, current page refreshes
but some fields of it's bean reset.

BuildinBean.java:
@ManagedBean
@RequestScoped
public class BuildingBean extends SuperBean{
private static final long serialVersionUID = 1L;

private Building currentBuilding = new Building();

public String doCancelEditBuilding(){
currentBuilding = new Building();
return "building_list";
}

//getters, setters
}

building_details.xhtml:

I use jsf 2.0, it's implementation mojarra 2.0.3.
Can you help me with my problem?

P.S. Sorry for my english...

Message was edited by: pmshik

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joel Weight

Without seeing more, it's hard to say exactly, but could it be that you are
having a validation problem with other controls? I notice that your cancel
button is not marked as immediate. Also, are you saying that if you remove
the "rendered" attribute from that button and change nothing else then
things function correctly?

joel

On Fri, Jun 4, 2010 at 12:43 PM, wrote:

> I have problem with attribute "rendered". I use it to manage visibility of
> buttons. Visibility works correctly. But when this attribute is set(button
> shown) and I click button,method doCancelEditBuilding does not called.
> Instead of redirecting to building_list.xtml page, current page refreshes
> but some fields of it's bean reset.
> BuildinBean.java:
> @ManagedBean
> @RequestScoped
> public class BuildingBean extends SuperBean{
> private static final long serialVersionUID = 1L;
>
> private Building currentBuilding = new Building();
>
> public String doCancelEditBuilding(){
> currentBuilding = new Building();
> return "building_list";
> }
>
> //getters, setters
> }
>
> building_details.xhtml:
> > image="/i/cancel.png" rendered="#{empty buildingBean.currentBuilding.id
> }"/>
>
> I use jsf 2.0, it's implementation mojarra 2.0.3.
> Can you help me with my problem?
>
> P.S. Sorry for my english...
> [Message sent by forum member 'pmshik']
>
> http://forums.java.net/jive/thread.jspa?messageID=472805
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>
>
[att1.html]

pmshik
Offline
Joined: 2010-06-04
Points: 0

Which files you want to see?

That my full buildings_details.xhtml:


xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:c="http://java.sun.com/jstl/core">









image="/i/passed.gif" update="messages" />
image="/i/delete.png" update="messages" />
image="/i/cancel.png" />


image="/i/add.gif" update="messages" />
image="/i/cancel.png" />




Yes, when I remove attribute "rendered" all works correctly, but I can't manage visibility of components.

Message was edited by: pmshik

Message was edited by: pmshik

Joel Weight

notice that your input text is required, and your cancel is not immediate.
That means it'll go through that validation for the input text even when
you are trying to cancel. That would be my first guess on the problem.

Joel

On Fri, Jun 4, 2010 at 6:34 PM, wrote:

> Which files you want to see?
>
> That my full buildings_details.xhtml:
>
> > http://www.w3.org/TR/html4/loose.dtd">
> > xmlns:h="http://java.sun.com/jsf/html"
> xmlns:f="http://java.sun.com/jsf/core"
> xmlns:ui="http://java.sun.com/jsf/facelets"
> xmlns:p="http://primefaces.prime.com.tr/ui"
> xmlns:c="http://java.sun.com/jstl/core">
>
>
>
>
>
>
> />
>
> label="#{i18n['pages.common_template.link.configuration']}"
> url="/pages/configuration.jsf" />
>
> label="#{i18n['pages.building_list.header']}" url="/pages/building_list.jsf"
> />
>
> label="#{i18n['pages.building_details.header']}" url="#" />
>
>

>

>

>
>
>
> align="left">#{i18n['pages.profile.loginInfo.commonInfo.header']}

> > columnClasses="colTitles, colValues" cellspacing="5px">
>
> > value="#{i18n['pages.building_details.buildingTitle']}" />
>
> > value="#{buildingBean.currentBuilding.buildingTitle}"
>
> style="width:50%; min-width:200px;" required="true"
>
> requiredMessage="#{i18n['pages.building_details.messages.TitleNotEmpty']}"/>
> > styleClass="required_message" />
>

> > rendered="#{not empty buildingBean.currentBuilding.id}">
> > type="image" action="#{buildingBean.doUpdateBuilding}"
>
> image="/i/passed.gif" update="messages" />  
> > type="image" action="#{buildingBean.doDeleteBuilding}"
>
> image="/i/delete.png" update="messages" />  
> > type="image" action="#{buildingBean.doCancelEditBuilding}"
>
> image="/i/cancel.png" />
>

> > rendered="#{empty buildingBean.currentBuilding.id}">
> > type="image" action="#{buildingBean.doAddBuilding}"
>
> image="/i/add.gif" update="messages" />  
> > type="image" action="#{buildingBean.doCancelEditBuilding}"
>
> image="/i/cancel.png" />
>

>

>
>

>
>
>
>
>
>
> Yes, when I remove attribute "rendered" all works correctly, but I can't
> manage visibility of components.
> [Message sent by forum member 'pmshik']
>
> http://forums.java.net/jive/thread.jspa?messageID=472837
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>
>
[att1.html]