myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mert Çalışkan" <mcalis...@gmail.com>
Subject Re: URL of myfaces application
Date Thu, 12 Oct 2006 21:53:13 GMT
In the backing bean of the target page, define a variable.Iinitialize its
value in the getter method.

    *private *String myParam;

    *public *String getMyParam() {
        *if *(myParam == *null*) {
            myParam = (String) expressionResolver("#{param.abc}");
        }
        *return *myParam;
    }

    *public **void *setMyParam(String myParam) {
        *this*.myParam = myParam;
    }

    *public *Object expressionResolver(String expression) {
        Object value = *null*;

        *if *((expression.indexOf("#{") != -1) && (expression.indexOf("#{")
< expression.indexOf('}'))) {
            value =  getFacesContext().getApplication().createValueBinding(
expression).getValue(getFacesContext());
        } *else *{
            value = expression;
        }
        *return *value;
    }

Declare an input hidden field.to use it on the page.

<h:inputHidden id="hiddenParam" value="#{yourBackingBean.abc}"/>

Now you can use it even in js..

var myParam = document.getElementById('form1:hiddenParam').value;

Regards,
Mert
http://www.jroller.com/page/mert


On 10/12/06, ying lcs <yinglcs@gmail.com> wrote:
>
> Is it possible to change the myfaces application URL so that it does
> not use '*.jsf' in the URL?  And is it possible to pass in an argument
> (in my example ("abc = 1") in the myface URL ?
>
> http://localhost:8080/myfaceapplication.jsf?abc=1
>
> If yes, how can myface application get this value?
>
> Thank you.
>

Mime
View raw message