File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Display tags and Jsp Scriptlet" Watch "Display tags and Jsp Scriptlet" New topic
Author

Display tags and Jsp Scriptlet

Rajani Deshpande
Ranch Hand

Joined: May 08, 2000
Posts: 45
Hi,
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()%>"/>
</display:column>

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?

Thanks
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
Bartender

Joined: Jul 06, 2005
Posts: 1016
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
Hi,
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
Rajani
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60048
    
  65

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] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Display tags and Jsp Scriptlet
 
Similar Threads
Display Tag data exporting problem
problem exporting data using Display Tag
Scrollbars in tag display:table
display tag export problem
JSTL paging error