You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Laurentiu Trica <tr...@gmail.com> on 2007/02/27 12:06:58 UTC

Problems using
Hi

I have to use the aliasBean for my page and I get this error:
Caused by: javax.faces.el.PropertyNotFoundException: /pages/test.xhtml
@11,46 value="#{aliasB['text']}": Bean: java.lang.String, property: text
    at com.sun.facelets.el.LegacyValueBinding.getValue(
LegacyValueBinding.java:58)
    at javax.faces.component.UIOutput.getValue(UIOutput.java:80)
    at
org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.getStringValue(
RendererUtils.java:223)

The page code is this:
<t:aliasBean alias="#{aliasB}" value="#{test}">
     <t:outputText value="#{aliasB.text}" />
</t:aliasBean>

The backing bean code is:
public class Test {
    private String text = "TEXT";

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }
}

Can anybody help?

-- 
Best regards,
Laurentiu

Re: Problems using Posted by Laurentiu Trica <tr...@gmail.com>.
Hi

I want to use the aliasBean for the same page because I need to be able to
copy/paste pages that are not similar, but the usage of the backing bean is
preety much the same.
So I make an alias for the backing bean, and on other pages, I don't have to
replace the name of the backing bean on the entire page, but in the alias
bean.
I know it's not big deal, but it can spare you some errors and the page gets
cleaner.

On 3/7/07, Martin Marinschek <ma...@gmail.com> wrote:
>
> I wonder why you do an aliasBean on the same page beforehand - why
> don't you just factor out the stuff into a separate facelets
> component?
>
> regards,
>
> Martin
>
> On 3/5/07, Werner Punz <we...@gmail.com> wrote:
> > Laurentiu Trica schrieb:
> > > Hi Werner
> > >
> > > As far as I read, the <ui:repeat> iterates a list and puts a value at
> a
> > > time in the var.
> > > Should this work in my case? I just need to make an alias for a bean
> on
> > > my page.
> > > I didn't quite understood how to push the component definition into
> the
> > > xml.
> > >
> > > Thank you for your time.
> > >
> >
> > Ok I am somewhat sorry, you have to get the code out of your
> > file, I just looked over the facelet docs again, as it seems there is
> > no way to extract parts of the page as components from a page
> > only one xml file per component is allowed.
> > I personally see it is a minor inconvenience if aliasbean does not work
> > for you.
> >
> > Rip out your reusable code into a separate xml file doing a
> ui:composition
> >
> > add an entry to your facelet xml for the component so that you get your
> > own tag and have the aliases as attributes
> >
> > here is an example doing exactly this (in the second part of the
> > article-Breaking the DRY principle)
> >
> > http://www-128.ibm.com/developerworks/java/library/j-facelets/
> >
> >
> >
>
>
> --
>
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>



-- 
Best regards,
Laurentiu
www.codebeat.ro

Re: Problems using Posted by Martin Marinschek <ma...@gmail.com>.
I wonder why you do an aliasBean on the same page beforehand - why
don't you just factor out the stuff into a separate facelets
component?

regards,

Martin

On 3/5/07, Werner Punz <we...@gmail.com> wrote:
> Laurentiu Trica schrieb:
> > Hi Werner
> >
> > As far as I read, the <ui:repeat> iterates a list and puts a value at a
> > time in the var.
> > Should this work in my case? I just need to make an alias for a bean on
> > my page.
> > I didn't quite understood how to push the component definition into the
> > xml.
> >
> > Thank you for your time.
> >
>
> Ok I am somewhat sorry, you have to get the code out of your
> file, I just looked over the facelet docs again, as it seems there is
> no way to extract parts of the page as components from a page
> only one xml file per component is allowed.
> I personally see it is a minor inconvenience if aliasbean does not work
> for you.
>
> Rip out your reusable code into a separate xml file doing a ui:composition
>
> add an entry to your facelet xml for the component so that you get your
> own tag and have the aliases as attributes
>
> here is an example doing exactly this (in the second part of the
> article-Breaking the DRY principle)
>
> http://www-128.ibm.com/developerworks/java/library/j-facelets/
>
>
>


-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: Problems using Posted by Werner Punz <we...@gmail.com>.
Laurentiu Trica schrieb:
> Hi Werner
> 
> As far as I read, the <ui:repeat> iterates a list and puts a value at a
> time in the var.
> Should this work in my case? I just need to make an alias for a bean on
> my page.
> I didn't quite understood how to push the component definition into the
> xml.
> 
> Thank you for your time.
> 

Ok I am somewhat sorry, you have to get the code out of your
file, I just looked over the facelet docs again, as it seems there is
no way to extract parts of the page as components from a page
only one xml file per component is allowed.
I personally see it is a minor inconvenience if aliasbean does not work
for you.

Rip out your reusable code into a separate xml file doing a ui:composition

add an entry to your facelet xml for the component so that you get your
own tag and have the aliases as attributes

here is an example doing exactly this (in the second part of the
article-Breaking the DRY principle)

http://www-128.ibm.com/developerworks/java/library/j-facelets/



Re: Problems using Posted by Laurentiu Trica <tr...@gmail.com>.
Hi Werner

As far as I read, the <ui:repeat> iterates a list and puts a value at a time
in the var.
Should this work in my case? I just need to make an alias for a bean on my
page.
I didn't quite understood how to push the component definition into the xml.

Thank you for your time.

On 3/5/07, Werner Punz <we...@gmail.com> wrote:
>
> Laurentiu Trica schrieb:
> > Hi Werner
> >
> > Yes, you could use facelets for parameters.
> > What I actually need is to use an alias bean on the same page.
> > Is there a mistake I am doing?
> >
>
> Sorry to push you towards facelets again
>
> <ui:repeat >
>
> might be your friend in your case
> also give it a try to make a component within the same page
> and push your component def into the xml i have not tried it but it
> might work.
>
>
>
>
> > On 2/28/07, * Werner Punz* <werner.punz@gmail.com
> > <ma...@gmail.com>> wrote:
> >
> >     Laurentiu Trica schrieb:
> >     > Hi Werner,
> >     >
> >     > I use Spring 2 and facelets too.
> >     > How can I do the same functionality using facelets?
> >     >
> >
> >     yes facelets allow componentization on the view layer, since you
> >     already
> >     are on facelets there is absolutely no reason for aliasbean.
> >
> >     check out the ui:component part of the facelet manuals
> >     what you can do is basically that you can add new tags for pageparts
> >     which can have input parameters, pretty much exactly what you can
> get
> >     with aliasbean but way less verbose, because you define it once
> >     and then you just work with the tag.
> >
> >
> >
> >
> > --
> > Best regards,
> > Laurentiu
> > www.codebeat.ro <http://www.codebeat.ro>
>
>


-- 
Best regards,
Laurentiu
www.codebeat.ro

Re: Problems using Posted by Werner Punz <we...@gmail.com>.
Laurentiu Trica schrieb:
> Hi Werner
> 
> Yes, you could use facelets for parameters.
> What I actually need is to use an alias bean on the same page.
> Is there a mistake I am doing?
> 

Sorry to push you towards facelets again

<ui:repeat >

might be your friend in your case
also give it a try to make a component within the same page
and push your component def into the xml i have not tried it but it
might work.




> On 2/28/07, * Werner Punz* <werner.punz@gmail.com
> <ma...@gmail.com>> wrote:
> 
>     Laurentiu Trica schrieb:
>     > Hi Werner,
>     >
>     > I use Spring 2 and facelets too.
>     > How can I do the same functionality using facelets?
>     >
> 
>     yes facelets allow componentization on the view layer, since you
>     already
>     are on facelets there is absolutely no reason for aliasbean.
> 
>     check out the ui:component part of the facelet manuals
>     what you can do is basically that you can add new tags for pageparts
>     which can have input parameters, pretty much exactly what you can get
>     with aliasbean but way less verbose, because you define it once
>     and then you just work with the tag.
> 
> 
> 
> 
> -- 
> Best regards,
> Laurentiu
> www.codebeat.ro <http://www.codebeat.ro>


Re: Problems using Posted by Laurentiu Trica <tr...@gmail.com>.
Hi Werner

Yes, you could use facelets for parameters.
What I actually need is to use an alias bean on the same page.
Is there a mistake I am doing?

On 2/28/07, Werner Punz <we...@gmail.com> wrote:
>
> Laurentiu Trica schrieb:
> > Hi Werner,
> >
> > I use Spring 2 and facelets too.
> > How can I do the same functionality using facelets?
> >
>
> yes facelets allow componentization on the view layer, since you already
> are on facelets there is absolutely no reason for aliasbean.
>
> check out the ui:component part of the facelet manuals
> what you can do is basically that you can add new tags for pageparts
> which can have input parameters, pretty much exactly what you can get
> with aliasbean but way less verbose, because you define it once
> and then you just work with the tag.
>
>


-- 
Best regards,
Laurentiu
www.codebeat.ro

Re: Problems using Posted by Werner Punz <we...@gmail.com>.
Laurentiu Trica schrieb:
> Hi Werner,
> 
> I use Spring 2 and facelets too.
> How can I do the same functionality using facelets?
> 

yes facelets allow componentization on the view layer, since you already
are on facelets there is absolutely no reason for aliasbean.

check out the ui:component part of the facelet manuals
what you can do is basically that you can add new tags for pageparts
which can have input parameters, pretty much exactly what you can get
with aliasbean but way less verbose, because you define it once
and then you just work with the tag.


Re: Problems using Posted by Laurentiu Trica <tr...@gmail.com>.
Hi Werner,

I use Spring 2 and facelets too.
How can I do the same functionality using facelets?

On 2/28/07, Werner Punz <we...@gmail.com> wrote:
>
> Laurentiu Trica schrieb:
> > Hi Simon
> >
> > This could be the problem, I am using Spring VariableResolver.
> > But I need to use it. Even if it's working otherwise.
> >
> > Any idea why they are not working together?
> >
> > Thanks.
> >
>
> Which spring version?
> If you are in 1.0 give 2.x a try the variable resolving stuff
> in spring has been improved.
> Also I personally consider while being very good, alias bean usable
> for minor usecases (I once used it for major templating and
> it was rather stressful, but it was the best you could do back then).
> If you can, move towards facelets, they provide similar mechanisms,
> as aliasbean but much much more.
>
>


-- 
Best regards,
Laurentiu
www.codebeat.ro

Re: Problems using Posted by Werner Punz <we...@gmail.com>.
Laurentiu Trica schrieb:
> Hi Simon
> 
> This could be the problem, I am using Spring VariableResolver.
> But I need to use it. Even if it's working otherwise.
> 
> Any idea why they are not working together?
> 
> Thanks.
> 

Which spring version?
If you are in 1.0 give 2.x a try the variable resolving stuff
in spring has been improved.
Also I personally consider while being very good, alias bean usable
for minor usecases (I once used it for major templating and
it was rather stressful, but it was the best you could do back then).
If you can, move towards facelets, they provide similar mechanisms,
as aliasbean but much much more.


Re: Problems using Posted by Laurentiu Trica <la...@codebeat.ro>.
Hi Simon

This could be the problem, I am using Spring VariableResolver.
But I need to use it. Even if it's working otherwise.

Any idea why they are not working together?

Thanks.

On 2/27/07, Simon Kitching <si...@rhe.co.nz> wrote:
>
> I presume you're using the custom Spring VariableResolver. It looks to
> me like this is the problem as I cannot see anything else wrong with
> your code.
>
> Can you try defining test as a standard JSF managed bean rather than as
> a spring bean?
>
> Laurentiu Trica wrote:
> > If I create an alias for an attribute of the bean, it is working.
> > For example, this is working:
> > <t:aliasBean alias="#{aliasB}" value="#{test.text}">
> >             <t:outputText value="#{aliasB}" />
> >         </t:aliasBean>
> >
> > This doesn't work:
> > <t:aliasBean alias="#{aliasB}" value="#{test}">
> >             <t:outputText value="#{aliasB.text}" />
> >         </t:aliasBean>
> >
> > Anyone has any idea why this is happening?
> >
> > The error is still the same:
> > Caused by: javax.faces.el.PropertyNotFoundException: /pages/test.xhtml
> > @11,43 value="#{ aliasB.text}": Bean: java.lang.String, property: text
> >     at com.sun.facelets.el.LegacyValueBinding.getValue
> > (LegacyValueBinding.java:58)
> >     at javax.faces.component.UIOutput.getValue(UIOutput.java:80)
> >     at
> >
> org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.getStringValue(
> RendererUtils.java:223)
> >
> > On 2/27/07, *Laurentiu Trica* <tricasoft@gmail.com
> > <ma...@gmail.com>> wrote:
> >
> >     Yes, it is working...
> >
> >
> >     On 2/27/07, *Volker Weber* < v.weber@inexso.de
> >     <ma...@inexso.de>> wrote:
> >
> >         Hi,
> >
> >         is <t:outputText value="#{test.text}" /> working?
> >
> >
> >
> >         2007/2/27, Laurentiu Trica < tricasoft@gmail.com
> >         <ma...@gmail.com>>:
> >         >  Hi
> >         >
> >         >  I have to use the aliasBean for my page and I get this error:
> >         >  Caused by: javax.faces.el.PropertyNotFoundException:
> >         >  /pages/test.xhtml @11,46 value="#{aliasB['text']}": Bean:
> >         java.lang.String,
> >         >  property: text
> >         >     at
> >         >  com.sun.facelets.el.LegacyValueBinding.getValue
> >         (LegacyValueBinding.java:58)
> >         >     at
> >         >  javax.faces.component.UIOutput.getValue(UIOutput.java:80)
> >         >      at
> >         >
> >
> org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.getStringValue(
> RendererUtils.java
> >         :223)
> >         >
> >         >  The page code is this:
> >         >  <t:aliasBean alias="#{aliasB}" value="#{test}">
> >         >      <t:outputText value="#{aliasB.text}" />
> >         >  </t:aliasBean>
> >         >
> >         >  The backing bean code is:
> >         >  public class Test {
> >         >      private String text = "TEXT";
> >         >
> >         >      public String getText() {
> >         >         return text;
> >         >      }
> >         >
> >         >     public void setText(String text) {
> >         >          this.text = text;
> >         >     }
> >         >  }
> >         >
> >         >  Can anybody help?
> >         >
>



-- 
Best regards,
Laurentiu
www.codebeat.ro

Re: Problems using Posted by Simon Kitching <si...@rhe.co.nz>.
I presume you're using the custom Spring VariableResolver. It looks to 
me like this is the problem as I cannot see anything else wrong with 
your code.

Can you try defining test as a standard JSF managed bean rather than as 
a spring bean?

Laurentiu Trica wrote:
> If I create an alias for an attribute of the bean, it is working.
> For example, this is working:
> <t:aliasBean alias="#{aliasB}" value="#{test.text}">
>             <t:outputText value="#{aliasB}" />
>         </t:aliasBean>
> 
> This doesn't work:
> <t:aliasBean alias="#{aliasB}" value="#{test}">
>             <t:outputText value="#{aliasB.text}" />
>         </t:aliasBean>
> 
> Anyone has any idea why this is happening?
> 
> The error is still the same:
> Caused by: javax.faces.el.PropertyNotFoundException: /pages/test.xhtml 
> @11,43 value="#{ aliasB.text}": Bean: java.lang.String, property: text
>     at com.sun.facelets.el.LegacyValueBinding.getValue 
> (LegacyValueBinding.java:58)
>     at javax.faces.component.UIOutput.getValue(UIOutput.java:80)
>     at 
> org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.getStringValue(RendererUtils.java:223)
> 
> On 2/27/07, *Laurentiu Trica* <tricasoft@gmail.com 
> <ma...@gmail.com>> wrote:
> 
>     Yes, it is working...
> 
> 
>     On 2/27/07, *Volker Weber* < v.weber@inexso.de
>     <ma...@inexso.de>> wrote:
> 
>         Hi,
> 
>         is <t:outputText value="#{test.text}" /> working?
> 
> 
> 
>         2007/2/27, Laurentiu Trica < tricasoft@gmail.com
>         <ma...@gmail.com>>:
>         >  Hi
>         >
>         >  I have to use the aliasBean for my page and I get this error:
>         >  Caused by: javax.faces.el.PropertyNotFoundException:
>         >  /pages/test.xhtml @11,46 value="#{aliasB['text']}": Bean:
>         java.lang.String,
>         >  property: text
>         >     at
>         >  com.sun.facelets.el.LegacyValueBinding.getValue
>         (LegacyValueBinding.java:58)
>         >     at
>         >  javax.faces.component.UIOutput.getValue(UIOutput.java:80)
>         >      at
>         >
>         org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.getStringValue(RendererUtils.java
>         :223)
>         >
>         >  The page code is this:
>         >  <t:aliasBean alias="#{aliasB}" value="#{test}">
>         >      <t:outputText value="#{aliasB.text}" />
>         >  </t:aliasBean>
>         >
>         >  The backing bean code is:
>         >  public class Test {
>         >      private String text = "TEXT";
>         >
>         >      public String getText() {
>         >         return text;
>         >      }
>         >
>         >     public void setText(String text) {
>         >          this.text = text;
>         >     }
>         >  }
>         >
>         >  Can anybody help?
>         >

Re: Problems using Posted by Laurentiu Trica <tr...@gmail.com>.
If I create an alias for an attribute of the bean, it is working.
For example, this is working:
<t:aliasBean alias="#{aliasB}" value="#{test.text}">
            <t:outputText value="#{aliasB}" />
        </t:aliasBean>

This doesn't work:
<t:aliasBean alias="#{aliasB}" value="#{test}">
            <t:outputText value="#{aliasB.text}" />
        </t:aliasBean>

Anyone has any idea why this is happening?

The error is still the same:
Caused by: javax.faces.el.PropertyNotFoundException: /pages/test.xhtml
@11,43 value="#{aliasB.text}": Bean: java.lang.String, property: text
    at com.sun.facelets.el.LegacyValueBinding.getValue (
LegacyValueBinding.java:58)
    at javax.faces.component.UIOutput.getValue(UIOutput.java:80)
    at
org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.getStringValue(
RendererUtils.java:223)

On 2/27/07, Laurentiu Trica <tr...@gmail.com> wrote:
>
> Yes, it is working...
>
> On 2/27/07, Volker Weber <v....@inexso.de> wrote:
> >
> > Hi,
> >
> > is <t:outputText value="#{test.text}" /> working?
> >
> >
> >
> > 2007/2/27, Laurentiu Trica <tr...@gmail.com>:
> > > Hi
> > >
> > > I have to use the aliasBean for my page and I get this error:
> > > Caused by: javax.faces.el.PropertyNotFoundException:
> > > /pages/test.xhtml @11,46 value="#{aliasB['text']}": Bean:
> > java.lang.String,
> > > property: text
> > >     at
> > > com.sun.facelets.el.LegacyValueBinding.getValue (
> > LegacyValueBinding.java:58)
> > >     at
> > > javax.faces.component.UIOutput.getValue(UIOutput.java:80)
> > >      at
> > >
> > org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.getStringValue
> > (RendererUtils.java :223)
> > >
> > > The page code is this:
> > > <t:aliasBean alias="#{aliasB}" value="#{test}">
> > >      <t:outputText value="#{aliasB.text}" />
> > >  </t:aliasBean>
> > >
> > > The backing bean code is:
> > > public class Test {
> > >      private String text = "TEXT";
> > >
> > >      public String getText() {
> > >         return text;
> > >      }
> > >
> > >     public void setText(String text) {
> > >          this.text = text;
> > >     }
> > >  }
> > >
> > > Can anybody help?
> > >
> > > --
> > > Best regards,
> > > Laurentiu
> >
>
>
>
> --
> Best regards,
> Laurentiu




-- 
Best regards,
Laurentiu
www.codebeat.ro

Re: Problems using Posted by Laurentiu Trica <tr...@gmail.com>.
Yes, it is working...

On 2/27/07, Volker Weber <v....@inexso.de> wrote:
>
> Hi,
>
> is <t:outputText value="#{test.text}" /> working?
>
>
>
> 2007/2/27, Laurentiu Trica <tr...@gmail.com>:
> > Hi
> >
> > I have to use the aliasBean for my page and I get this error:
> > Caused by: javax.faces.el.PropertyNotFoundException:
> > /pages/test.xhtml @11,46 value="#{aliasB['text']}": Bean:
> java.lang.String,
> > property: text
> >     at
> > com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java
> :58)
> >     at
> > javax.faces.component.UIOutput.getValue(UIOutput.java:80)
> >      at
> >
> org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.getStringValue(
> RendererUtils.java:223)
> >
> > The page code is this:
> > <t:aliasBean alias="#{aliasB}" value="#{test}">
> >      <t:outputText value="#{aliasB.text}" />
> >  </t:aliasBean>
> >
> > The backing bean code is:
> > public class Test {
> >      private String text = "TEXT";
> >
> >      public String getText() {
> >         return text;
> >      }
> >
> >     public void setText(String text) {
> >          this.text = text;
> >     }
> >  }
> >
> > Can anybody help?
> >
> > --
> > Best regards,
> > Laurentiu
>



-- 
Best regards,
Laurentiu

Re: Problems using Posted by Volker Weber <v....@inexso.de>.
Hi,

is <t:outputText value="#{test.text}" /> working?



2007/2/27, Laurentiu Trica <tr...@gmail.com>:
> Hi
>
> I have to use the aliasBean for my page and I get this error:
> Caused by: javax.faces.el.PropertyNotFoundException:
> /pages/test.xhtml @11,46 value="#{aliasB['text']}": Bean: java.lang.String,
> property: text
>     at
> com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:58)
>     at
> javax.faces.component.UIOutput.getValue(UIOutput.java:80)
>      at
> org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.getStringValue(RendererUtils.java:223)
>
> The page code is this:
> <t:aliasBean alias="#{aliasB}" value="#{test}">
>      <t:outputText value="#{aliasB.text}" />
>  </t:aliasBean>
>
> The backing bean code is:
> public class Test {
>      private String text = "TEXT";
>
>      public String getText() {
>         return text;
>      }
>
>     public void setText(String text) {
>          this.text = text;
>     }
>  }
>
> Can anybody help?
>
> --
> Best regards,
> Laurentiu