File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Display tags and Jsp Scriptlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Display tags and Jsp Scriptlet" Watch "Display tags and Jsp Scriptlet" New topic

Display tags and Jsp Scriptlet

Rajani Deshpande
Ranch Hand

Joined: May 08, 2000
Posts: 45
I have a table define like this
<display:table name="sessionScope.userInfo.partnerList" id="partner" class="ResultsTable">
In the column

<display:column title="Partner" sortable="true" headerClass="ColumnHdg" >
<myTag:message key="<%=DataKey+(String)partner.getFocusLevel()%>"/>

It gives me the error saying cannot find getFocusLevel MEthod...

but if I use the JSTL ${partner.focusLevel}, the value is displayed..

using JSTL is not a solution for me as myTag does not evaluate ${partner.focusLevel}
any ideas?

Purushoth Thambu
Ranch Hand

Joined: May 24, 2003
Posts: 425

You can test the instance type of parter before calling getFocusLevel() to find out what instance you are getting. That must give you some direction to find out the problem
[ June 29, 2006: Message edited by: Purushothaman Thambu ]
Stefan Evans

Joined: Jul 06, 2005
Posts: 1580
Most probably the scriptlet variable "partner" is being exposed only as a java.lang.Object.

JSTL works, because it uses introspection and reflection to see the actual properties a bean has.
The scriptlet code knows only that the variable 'partner' is an object.

so this could possibly work:
<% ((com.mypackage.Partner)partner).getFocusLevel() %>

If you have a JSP2.0 container, is there anything stopping you using the EL expression rather than the <%= expr %>?
Rajani Deshpande
Ranch Hand

Joined: May 08, 2000
Posts: 45
thanks .. Casting it helped.. It works !
I cannot use JSTL because, we have a custom tag which doesnt recognize nested JSTL tags...
I would love to use JSTL in this custom tag.. any pointers on how to make the custom tag recognize the JSTL ${variable} will be helpful..

Thanks for the help
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63839

I can think of no reason that JSTL and EL cannot peacefully co-exist with well-written and designed custom actions. What is it that you are doing that is preventing this from working? Are you disabling the evaluation of the body of the custom actions? If so, why?

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Display tags and Jsp Scriptlet
It's not a secret anymore!