I am currently using 1.2.3.
It seems like there may be a problem when using hidden field binding and
trying to get postback indication.
Example code:
-------------
<html>
<head><title>Simple jsp page</title></head>
<body>
<f:view>
<h:form>
<h:inputHidden value="#{testBean.xx}"
binding="#{testBean.htmlInputHidden}"/>
<h:commandButton value="Ok" action="#{testBean.someAction}" />
</h:form>
</f:view>
</body>
</html>
Bean code:
----------
public class TestBean
{
private String xx;
public TestBean()
{
xx = "5";
System.out.println(FacesUtil.isPostBack());
}
public String someAction()
{
return null;
}
public String getXx()
{
return xx;
}
public void setXx(String xx)
{
this.xx = xx;
}
private HtmlInputHidden htmlInputHidden;
public HtmlInputHidden getHtmlInputHidden()
{
return htmlInputHidden;
}
public void setHtmlInputHidden(HtmlInputHidden htmlInputHidden)
{
this.htmlInputHidden = htmlInputHidden;
}
}
Page loads ok. After pressing the "Ok" button, there is a null pointer
exception, because:
FacesUtil.getFacesContext().getRenderKit() returns "null".
When binding is removed, all works ok.
Guy.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 06, 2008 12:01 PM
To: MyFaces Discussion
Subject: Re: Postback
Guy Bashan schrieb:
>
> Hi,
>
>
>
> Is this a legitimate way of checking postback request?
>
>
>
> public static boolean isPostBack()
>
> {
>
> return
>
FacesUtil.getFacesContext().getRenderKit().getResponseStateManager().isPostb
ack(getFacesContext());
>
> }
>
Yep, that's the correct public API as far as I know (btw, it is JSF1.2
or later).