I don't understand what you mean.  You said "the
attributes map in the RI might do the ValueBinding
checking for you".  But when I had
"rptTableCol.getAttributes().get("colSpan")" it was
returning null when colSpan used value binding.  That
was my problem, to get around that I had to do the
check that I mentioned.  I agree with you that the
attributes map might do the check for me, and it seems
to in JSF 1.1.01, but it doesn't in myFaces 1.0.7.  So
if what you are saying is true, then is there a bug in
the RI in myFaces 1.0.7?

Thanks,
Ray

--- Heath Borders <[EMAIL PROTECTED]> wrote:

> Well, the attributes map in the RI might do the
> ValueBinding checking for you.
> 
> 
> On Wed, 5 Jan 2005 18:42:39 -0800 (PST), Ray Clark
> <[EMAIL PROTECTED]> wrote:
> > Thanks Heath.
> > 
> > I just had time again to get back to this.  I have
> a
> > new solution :)
> > 
> > My renderer used to have this code:
> > 
> > String colSpan = (String)
> > rptTableCol.getAttributes().get("colSpan");
> > if (colSpan != null) {
> >         writer.writeAttribute("colSpan", colSpan,
> null);
> > }
> > 
> > That code worked fine in JSF 1.1.01, but didn't
> work
> > with myFaces 1.0.7.  Well, I now have new code in
> the
> > renderer that works.  The renderer now looks like
> > this:
> > 
> > ValueBinding vb =
> > rptTableCol.getValueBinding("colSpan");
> > String colSpan = null;
> > if (vb == null) {
> >         colSpan = (String)
> > rptTableCol.getAttributes().get("colSpan");
> > } else {
> >         colSpan = (String) vb.getValue(context);
> > }
> > if (colSpan != null) {
> >         writer.writeAttribute("colSpan", colSpan,
> null);
> > }
> > 
> > So to get this to work the renderer now has to
> check
> > to see if this attribute has value binding or not.
> > Then get the value appropriately.  Now why would
> there
> > be a difference between JSF 1.1.01 and myFaces?
> > 
> > Anyway, how does this solution look to you? :)
> > 
> > Thanks,
> > Ray
> > 
> > --- Heath Borders <[EMAIL PROTECTED]> wrote:
> > 
> > > Adding that line really doesn't go along with
> the
> > > spirit of
> > > valueBindings, though.  Ideally, you want the
> > > ValueBinding to be
> > > evaluated as late as necessary, preferably just
> > > before the UIComponent
> > > is rendered (which is when most ValueBindings
> are
> > > referenced, in the
> > > renderer).
> > >
> > >
> > > On Sun, 2 Jan 2005 16:41:55 -0800 (PST), Ray
> Clark
> > > <[EMAIL PROTECTED]> wrote:
> > > >
> > > > Well, I played around and I found a solution
> to my
> > > value binding problem.
> > > >
> > > > In the tag I have a setValueBinding method
> that I
> > > copied from the Core
> > > > JavaServerFaces book.  It looks like this now:
> > > >
> > > > public void setValueBinding(UIComponent
> component,
> > > String attributeName,
> > > >           String attributeValue) {
> > > >
> > > >      FacesContext context =
> > > FacesContext.getCurrentInstance();
> > > >      Application app =
> context.getApplication();
> > > >      ValueBinding.vb =
> > > app.createValueBinding(attributeValue);
> > > >      component.setValueBinding(attributeName,
> vb);
> > >
> > > >      // Adding this line of code makes it work
> > > >     
> component.getAttributes().put(attributeName,
> > > vb.getValue(context));
> > > > }
> > > >
> > > > I noticed that the Renderer was getting the
> value
> > > from the
> > > > component.getAttributes.  So I added the put
> and
> > > it started working.  I'm
> > > > not sure if this is what should have been
> done,
> > > but it certainly does the
> > > > job.  The tag extends the UIComponentTag. 
> Since
> > > this 1 line fixed the
> > > > problem I didn't think anyone would need any
> other
> > > code.  Let me know if you
> > > > do though.
> > > >
> > > > As I said, this worked fine with JSF 1.1.01
> > > without the 1 line that I had to
> > > > add.
> > > >
> > > > Hope this helps someone to figure out what the
> > > problem was.
> > > >
> > > > Thanks,
> > > > Ray
> > > >
> > > >
> > > > Heath Borders <[EMAIL PROTECTED]> wrote:
> > > > Date: Sun, 2 Jan 2005 11:22:46 -0600
> > > > From: Heath Borders
> > > > To: Ray Clark
> > > > Subject: Re: ValueBinding
> > > >
> > > >
> > > > Make sure to let us know the answer if you
> find
> > > it. :)
> > > >
> > > >
> > > > On Sun, 2 Jan 2005 08:41:03 -0800 (PST), Ray
> Clark
> > > wrote:
> > > > > Thank you for your response. I need to trim
> down
> > > my
> > > > > code so that it centers on the problem
> before I
> > > post
> > > > > it. When I get that done I'll post. It may
> be a
> > > > > couple of days. Who knows, I may stumble
> across
> > > the
> > > > > answer in the meantime.
> > > > >
> > > > > Thanks,
> > > > > Ray
> > > > >
> > > > > --- Heath Borders wrote:
> > > > >
> > > > > > Send your code for the getter/setter in
> your
> > > > > > component, and the jsp
> > > > > > code that you're drives the whole thing.
> The
> > > > > > problem must be there
> > > > > > then.
> > > > > >
> > > > > >
> > > > > > On Sat, 1 Jan 2005 12:13:32 -0800 (PST),
> Ray
> > > Clark
> > > > > > wrote:
> > > > > > > I just noticed a problem with my value
> > > binding
> > > > > > under myface. My value
> > > > > > > binding works the way that it is coded
> with
> > > JSF
> > > > > > 1.1.01, but doesn't work
> > > > > > > with myfaces 1.0.7. I was wondering if
> > > anyone
> > > > > > could tell me the right way
> > > > > > > to code this for myfaces?
> > > > > > >
> > > > > > > Here is my code that works for JSF
> 1.1.01. I
> > > got
> > > > > > it right out of the Core
> > > > > > > JavaServerFaces book:
> > > > > > >
> > > > > > > public void setProperties(UIComponent
> > > component) {
> > > > > >
> > > > > > > super.setProperties(component);
> > > > > > >
> > > > > > > setString(component, "rowSpan",
> rowSpan);
> 
=== message truncated ===



                
__________________________________ 
Do you Yahoo!? 
The all-new My Yahoo! - Get yours free! 
http://my.yahoo.com 
 

Reply via email to