I see. The outputText way is actually what I did. So, is there a way to call a method in the backing bean when/before loading a JSF page? Something like a pre-render method before loading a JSF page? I can do that in the backing bean methods that forward to the JSF page, but there are many places that could forward to that JSF page. That's why I trying to do it in the JSF page itself.

thanks


----- Original Message ----- From: "Ken" <[EMAIL PROTECTED]>
To: "MyFaces Discussion" <users@myfaces.apache.org>
Sent: Wednesday, August 24, 2005 10:17 PM
Subject: Re: How to call a method in the backing bean from a JSF page


Yes, commandLink and commandButton will render an anchor tag.  If you
don't want to do this you can do work in your properies getter method
when it gets called by outputText value and return an empty string.
However, I don't believe there is any guarante as to call order.
Putting your target outputText in the first line of your jsp file
doesn't mean it will get called before other getter methods further
down in the jsp file get called.


On 8/24/05, Saul Qunming Yuan <[EMAIL PROTECTED]> wrote:
Thanks for your reply, that makes sense. But won't h:commandLink render a
link and h:commandButton render a button in the page? I don't want to
display anything on the screen. My purpose is to initiate a call from the
JSF page to a method in the backing bean when the JSF page loads. I'm
returning an empty string from the method so nothing gets printed out from
<h:outputText>.


----- Original Message -----
From: "Ken" <[EMAIL PROTECTED]>
To: "MyFaces Discussion" <users@myfaces.apache.org>
Sent: Wednesday, August 24, 2005 9:53 PM
Subject: Re: How to call a method in the backing bean from a JSF page


> Try h:commandLink or h:commandButton.
> If your method returns a string that doesn't match any navigation-rule
> in your faces-confix.xml then the same page you came from will be
> rendered again.
>
>
> On 8/24/05, Saul Qunming Yuan <[EMAIL PROTECTED]> wrote:
>>
>> Hi,
>>
>> I'm wondering what's the correct way to call a method in the backing >> bean
>> from a JSF page. What I tried is to use <h:outputText
>> value="#{theBackingBean.theMethod}" />, the backing bean method >> returns
>> an
>> empty string, so nothing gets printed out in the page. Which works, >> but I
>> am
>> not sure this is the correct way to do it.
>>
>> thanks,
>> Saul



Reply via email to