|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
facelets valueExpression always as String?Hi all,
actually I am facing the following problem: I have moved an existing JSF project to facelets. Within the project there are "old" JSF custom tags which I can use without problems in the new facelets environment as long as all my expressions belong to be Strings. As my custom components have attributes different to Strings I have not found a solution to access them. My custom tag: <jb:eventplanner event="#{event}"/> So there it is, my attribute event which ii a net.jb.model.businessobjects.Event class. Again: my old Tags were working. Now in my renderer class, I just access the valueexpression by ValueExpression ve = component.getValueExpression("event"); If I just have a look to ve.getExpectedType() this returns String. Not good! I just inspect the String in the debugger and, surprise, my whole Object is there as a String. Not sure whether this is a serialized kind of my object or something like this. Event ( net.jb.model.businessobjects.Event@b3d2d92d | date = java.util.GregorianCalendar[time=1247133600000,areFieldsSet=true,areAllField sSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Berlin",of fset=3600000,dstSavings=3600000,useDaylight=true,transitions=143,lastRule=ja va.util.SimpleTimeZone[id=Europe/Berlin,offset=3600000,dstSavings=3600000,us eDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWe ek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDay OfWeek=1,endTime=3600000,endTimeMode=2]],firstDayOfWeek=2,minimalDaysInFirst Week=4,ERA=1,YEAR=2009,MONTH=6,WEEK_OF_YEAR=28,WEEK_OF_MONTH=2,DAY_OF_MONTH= 9,DAY_OF_YEAR=190,DAY_OF_WEEK=5,DAY_OF_WEEK_IN_MONTH=2,AM_PM=1,HOUR=0,HOUR_O F_DAY=12,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=3600000,DST_OFFSET=3600 000] | hotelOptionFlag = true | id = 2 | identifier = DANCING | mainEvent = null | showInOverviewFlag = true | ) So ve.getValue(context.getELContext()); will give me always a String :-( Can anyone explain me, how to access my "real" object. I have absolutely now ideas left. Thanks in advance John --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: facelets valueExpression always as String?Hi
Are you sure it is a String? From the info you supplied it looks like an Event object, or? (net.jb.model.businessobjects. Event@b3d2d92d). Are you getting class cast exceptions or something? Afraid I can't help much just thought I'd post this little observation, on the off chance it helps ;) - Micke 2009/6/28 John Begham <jebe@...> Hi all, |
|
|
AW: facelets valueExpression always as String?Hi, thanks for the replay. Yes, it is a String and I do get a Class
Cast Exception if I try to cast to Event, that says "cannot cast from
String to Event". That drives me crazy! Cheers John Von: Mikael Andersson
[mailto:mail.micke@...] Hi Event@b3d2d92d). 2009/6/28 John Begham <jebe@...> Hi all, |
|
|
Re: facelets valueExpression always as String?Could you post the rest of your rendering class? I tried something
similar a week ago, but did it with a taghandler resolving the value and setting it as value for the renderer to render only. I think I came across some other ways to access the value like faceletsContext.getFacesContext().getELContext().getVariableResolver()...getValueExpression(uiComponent, does this code work for you? ValueExpression ve = faceletContext.getExpressionFactory().createValueExpression(faceletContext.getFacesContext().getELContext(), name, Event.class); Event myEvent = ve.getValue(face(lets|es i don't know)context.getELContext()); ? Regards, Dominik On Mon, Jun 29, 2009 at 7:51 PM, John Begham<jebe@...> wrote: > Hi, > > > > thanks for the replay. Yes, it is a String and I do get a Class Cast > Exception if I try to cast to Event, that says "cannot cast from String to > Event". > > > > That drives me crazy! > > > > Cheers > > John > > > > Von: Mikael Andersson [mailto:mail.micke@...] > Gesendet: Montag, 29. Juni 2009 17:55 > An: users@... > Betreff: Re: facelets valueExpression always as String? > > > > Hi > > Are you sure it is a String? > > From the info you supplied it looks like an Event object, or? > (net.jb.model.businessobjects. > > Event@b3d2d92d). > > Are you getting class cast exceptions or something? > > Afraid I can't help much just thought I'd post this little observation, on > the off chance it helps ;) > > - Micke > > > > 2009/6/28 John Begham <jebe@...> > > Hi all, > > actually I am facing the following problem: I have moved an existing JSF > project to facelets. Within the project there are "old" JSF custom tags > which I can use without problems in the new facelets environment as long as > all my expressions belong to be Strings. > > As my custom components have attributes different to Strings I have not > found a solution to access them. > > My custom tag: > <jb:eventplanner event="#{event}"/> > > So there it is, my attribute event which ii a > net.jb.model.businessobjects.Event class. Again: my old Tags were working. > > Now in my renderer class, I just access the valueexpression by > > ValueExpression ve = component.getValueExpression("event"); > > If I just have a look to ve.getExpectedType() this returns String. Not good! > > I just inspect the String in the debugger and, surprise, my whole Object is > there as a String. Not sure whether this is a serialized kind of my object > or something like this. > > Event ( net.jb.model.businessobjects.Event@b3d2d92d | date = > java.util.GregorianCalendar[time=1247133600000,areFieldsSet=true,areAllField > sSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Berlin",of > fset=3600000,dstSavings=3600000,useDaylight=true,transitions=143,lastRule=ja > va.util.SimpleTimeZone[id=Europe/Berlin,offset=3600000,dstSavings=3600000,us > eDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWe > ek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDay > OfWeek=1,endTime=3600000,endTimeMode=2]],firstDayOfWeek=2,minimalDaysInFirst > Week=4,ERA=1,YEAR=2009,MONTH=6,WEEK_OF_YEAR=28,WEEK_OF_MONTH=2,DAY_OF_MONTH= > 9,DAY_OF_YEAR=190,DAY_OF_WEEK=5,DAY_OF_WEEK_IN_MONTH=2,AM_PM=1,HOUR=0,HOUR_O > F_DAY=12,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=3600000,DST_OFFSET=3600 > 000] | hotelOptionFlag = true | id = 2 | identifier = DANCING | > mainEvent = null | showInOverviewFlag = true | ) > > > So > ve.getValue(context.getELContext()); > > will give me always a String :-( > > Can anyone explain me, how to access my "real" object. I have absolutely now > ideas left. > > Thanks in advance > John > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@... > For additional commands, e-mail: users-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
| Free embeddable forum powered by Nabble | Forum Help |