Skip to main content

problem with JSTL in a portlet

3 replies [Last post]
igorrohal
Offline
Joined: 2008-12-11
Points: 0

hi all,
im having this problem a i cant google anything about it and it itself seems very strange... I have a portlet in my open portal portlet container, using jsf nad jstl combined...
I havent had any problems with jsf tags rendering, but now I have to put in some JSTL tags, because i need a for cycle and some conditions and stuff... ( i guess there isnt a way to do that using jsf tags right..?) .. ok and that's where the problem occurs... JSTL seems to be working okay, because ex.

${dayItem}

renders just fine, as expected and when i refresh the page, it renders the same again, all correct.

But for example, if i do smth like this:

${dayItem.id}

it cannot access the list items. it retrieves the list, it knows how many items there are in the list, but it cant actually access the items. So it doesnt print out anything but the empty table cells, but what is worse, it doesnt even generate those empty cells after i refresh the page. Even those empty cells are gone after a refresh.... WHY? I have no idea...

I have no idea what to do with this because:

1. the "CalendarViewBean" and its properties are flawlessly accesible within JSF tags on that very same .jsp page of this portlet, so there shouldnt be any problem with accessing this object with EL command as i've shown above

2. if i try to deploy this JavaServer Faces application as a normal web application, not as a portlet application .... everything works just okay, including the page with this JSTL code that typed above...

so im getting really lost here...
if aaaaanyone could share a word about this one, i will appreciate it very very much ....
Thanks
Igor Rohal

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
igorrohal
Offline
Joined: 2008-12-11
Points: 0

a little update..
ok so i've gotten a little further with this problem, now i know why the problem occurs only in portlet enviroment... it's the session-scoped attribute names that mess it all up and unified EL commands used in JSTL tags like the one below cannot assess those attribute objects...

because a session-scoped attributed object CalendarViewBean in servlet enviroment gets the attribute name of "CalendarViewBean" and everything works just fine whereas when deployed as a portlet it obtains the name of "javax.portlet.p.AbsenceCalendar|AbsenceCalendarPortlet|AbsenceCalendar.AbsenceCalendarPortlet?CalendarViewBean"
which is okay and that's how it's suppossed to be of course and the JavaServer Faces EL in JSF tags can access all the set attributes/beans without any problems. It's only problem of JSTL tags and deferred syntax EL like #{..} used in them that do not work...

but I dont know how to get those JSTL tags work like they should be? does anybody know what im still doing wrong here? why jstl doesnt work in my portlets when it works all right in my servlets?

if anybody came across this one already, please share a word, i'd appreciate it very much... Thanks

Igor Rohal

mariusdrvostep
Offline
Joined: 2007-09-16
Points: 0

Hi,
I head the similar problem with c:foreach tag and I solve it by creating my own JSF component for iterating. You can use FOR cycle in Java code in method encodeBegin in component class. This solution isn't so easy but it was good for me during solving similar problem.

igorrohal
Offline
Joined: 2008-12-11
Points: 0

all right... i got sick of it so i solved it for now :) JSTL and JSF just cannot stand each other sometimes it seems. I didnt code my own component and thank you very much for a suggestion, i'd probably have gotten into it if i had no other choice. I plugged in an extention of MyFaces from apache called Tomahawk and there is the DataList tag with which you can iterate over a list of objects and the output doesnt necessarily have to be a table, so that's exactly what i needed and it works fine it seems, because it JSF only of course. But i have a feeling that i'll be solving another nasty(for me) problem pretty soon.. :)

take care
igor Rohal