tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hans Bergsten <h...@gefionsoftware.com>
Subject Re: BugRat Report #804 has been filed.
Date Fri, 19 Jan 2001 18:02:16 GMT
BugRat Mail System wrote:
> 
> Bug report #804 has just been filed.
> 
> You can view the report at the following URL:
> 
>    <http://znutar.cortexity.com/BugRatViewer/ShowReport/804>
> 
> REPORT #804 Details.
> 
> Project: Tomcat
> Category: Bug Report
> SubCategory: New Bug Report
> Class: swbug
> State: received
> Priority: high
> Severity: serious
> Confidence: public
> Environment:
>    Release: 3.2 final release
>    JVM Release: 1.2.2
>    Operating System: Win NT
>    OS Release: 4.0 ServPack 6
>    Platform: Intel
> 
> Synopsis:
> java expression not translates in attribute value
> 
> Description:
> <%@ taglib uri="/atl" prefix="atl" %>
> <jsp:useBean id="PbPb" scope="session"
>   class="at.alcatel.gcca.beans.pinboard.PbPinboard" />
> 
> <html>
> 
>  <atl:Menu name="xxPinboard" type="at.alcatel.gcca.beans.pinboard.PbPinboardStructure"
>       vector="<%=PbPb.getPinboards(\"chris\")%>">
> 
>   <atl:MenuLink text="<%= xxPinboard.PbName %>" link="<%=new String(\"Messages.jsp?pinboardId=\"+xxPinboard.PbId)%>"
/>
> 
>   <atl:MenuLink text="<%= xxPinboard.PbName %>" link="Messages.jsp?pinboardId=<%=
xxPinboard.PbId%>" />
> 
>  </atl:Menu>
> </html>
> 
> In the above there are 2 MenuLink tags. The second one with 'link="Messages.jsp?pinboardId=<%=
xxPinboard.PbId%>"'
> was the planed version, but it does not evaluate the xxPinboard.PbId.
> If I write it as in the first version (with new String) it works, but it is unreadable.

The JSP spec doesn't support mixing static text and JSP expressions in
an attribute value. An alternative way to get what you want is this:

  <atl:MenuLink text="<%= xxPinboard.PbName %>" 
    link='<%= "Messages.jsp?pinboardId" + xxPinboard.PbId %>' />

Note that you can use single quotes around the attribute value so you
don't have to escape double quotes in the value.

Hans
-- 
Hans Bergsten		hans@gefionsoftware.com
Gefion Software		http://www.gefionsoftware.com
Author of JavaServer Pages (O'Reilly), http://TheJSPBook.com

Mime
View raw message