Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Display tags and Jsp Scriptlet

 
Rajani Deshpande
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 1751
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64971
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic