0

Hi i have a custom tag in JSP

<dc:drawMultiSelect
    availableLabel='<%=request.getAttribute("availableCoreColumn").toString()%>'
    selectedLabel='<%=request.getAttribute("selectedCoreColumns").toString()%>'
    availableCName="selectCol" 
    selectedCName="selectedCol"
    availableCId="select1" 
    selectedCId="select2" 
    sort="off"
    columnHelp="on" 
    helpURL='<%=((Map)request.getAttribute("constants")).get("WEB_CONTEXT").toString()%>/web/ABCGlossary.jsp'
    selectSize="8" 
    selectWidth="250px"
    selectMultiple="true"
    availableMap='<%=((HashMap) request.getAttribute("availableColMap"))%>'
    selectedMap='<%=((HashMap) request.getAttribute("selectedColMap"))%>'>

It is working fine except for helpURL='<%=((Map)request.getAttribute("constants")).get("WEB_CONTEXT").toString()%>/web/ABCGlossary.jsp'

it is not getting translated in jsp it is giving output some like %=((Map)request.getAttribute("constants")).get("WEB_CONTEXT").toString()%>/web/ABCGlossary.jsp

Can you please help me what is the problem it have enable rtexprvalue

Rahul Garg
  • 8,410
  • 8
  • 33
  • 28

1 Answers1

2

This is likely down to the way you're mixing script expressions and literals, you're confusing the JSp compiler.

If this is JSP 2.0 or higher, you can make this much more readable by using EL expressions rather than scriptlets, like this:

helpURL="${requestScope.constants.WEB_CONTEXT + '/web/ABCGlossary.jsp'}"

Failing that, just make your life easier by assigning the value of the helpURL to a seperate variable and then referring to it in your tag

<% String helpURL = ((Map)request.getAttribute("constants")).get("WEB_CONTEXT").toString() + '/web/ABCGlossary.jsp' %>

helpURL='<%= helpURL  %>'
skaffman
  • 398,947
  • 96
  • 818
  • 769
  • yes i know that but it work when u dont have a custom tag like – Rahul Garg Jul 03 '09 at 09:45
  • 1
    Yeah, I know it seems like it should work. Can you come up with the custom tag declaration? So we may take a look why everything else is working and not just "helpURL". – Adeel Ansari Jul 03 '09 at 10:18