You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Madan Narra <ma...@gmail.com> on 2007/06/02 13:44:27 UTC
[Tobago] Use static Variables in Tobago Pages
Hi All,
I have a class which has some static variables .
I tried to use these variables in Tobago pages for some validation.
This is the class i used to hold the static varibales --> ErrorMessages.java
Static variable is defined as follows --> *public* *static* String *required
* = "0002";
<tc:out rendered="#{login.errorValidatingLogin == errorMessages.required}"
value="#{bundle.requiredFieldsErrorMessage}" />
But was getting this error as follows:
Caused by: javax.servlet.jsp.el.ELException: Unable to find a value for
"loginError" in object of class 'com.mycompany.ErrorMessages" using operator
"."
Is there any possibility of using Static Variables in JSF/JSP using EL ?
--
Regards,
Madan N
Re: [Tobago] Use static Variables in Tobago Pages
Posted by Volker Weber <v....@inexso.de>.
Hi Madan,
in el you can't access properties, you need to setup getters for the
static Varibles.
Regards,
Volker
2007/6/4, Madan Narra <ma...@gmail.com>:
> Hi Bernd,
>
> I used the Class as a Managed Bean and specifid its scope as " application
> ". But no success.
>
> public static String loginError = "0001"; This is the varibale i declared in
> ErrorMessages.java with static .
>
> Was getting this error when used as such in jsp page
>
> <tc:out value="#{errorMessages.loginError}" />
>
> javax.faces.el.PropertyNotFoundException: Bean:
> com.mycompany.util.ErrorMessages, property: loginError
>
>
> Regards,
>
> Madan N
>
Re: [Tobago] Use static Variables in Tobago Pages
Posted by Madan Narra <ma...@gmail.com>.
Hi Bernd,
I used the Class as a Managed Bean and specifid its scope as " application
". But no success.
public *static* String *loginError* = "0001"; This is the varibale i
declared in ErrorMessages.java with static .
Was getting this error when used as such in jsp page
<tc:out value="#{errorMessages.loginError}"/>
javax.faces.el.PropertyNotFoundException: Bean:
com.mycompany.util.ErrorMessages, property: loginError
*Regards*,
Madan N
Re: [Tobago] Use static Variables in Tobago Pages
Posted by Bernd Bohmann <be...@atanion.com>.
Hello Madan,
you can use a ManagedBean with application scope.
Regards
Bernd
Madan Narra wrote:
> Hi All,
>
> I have a class which has some static variables .
>
> I tried to use these variables in Tobago pages for some validation.
>
> This is the class i used to hold the static varibales -->
> ErrorMessages.java
>
> Static variable is defined as follows --> *public* *static* String
> *required
> * = "0002";
>
> <tc:out rendered="#{login.errorValidatingLogin == errorMessages.required}"
> value="#{bundle.requiredFieldsErrorMessage}" />
>
> But was getting this error as follows:
> Caused by: javax.servlet.jsp.el.ELException: Unable to find a value for
> "loginError" in object of class 'com.mycompany.ErrorMessages" using
> operator
> "."
>
> Is there any possibility of using Static Variables in JSF/JSP using EL ?
>