At 11:03 AM -0500 3/4/05, Slattery, Tim - BLS wrote:
In my JSP I want to conditionally make an image and some text into a
hyperlink, depending on conditions. So I've written this code:

     <c:if test="${HistoryBean.noPayGroups == 2}">
        <html-el:link
href="entryForm.do?respondent=${HistoryBean.respondent}&payGroup=1">
     </c:if>
     <html-el:img page="/images/step1a.jpg"/><br>
     Pay Group 1
     <c:if test="${HistoryBean.noPayGroup == 2}">
       </html-el:link>
     </c:if>

I'm getting a syntax error, pointing to the first </c:if> line. I don't see
any syntax problems. Is it impermissible to open a tag within the body of
another tag, but not close it there?

Yes; tags must nest cleanly.

Solve like this:
<c:if test="..."><c:set var="url">case 1</c:set></c:if>
<c:if test="not ..."><c:set var="url" >case 2</c:set></c:if>
<html-el:link page="${url}">...</html-el:link>

Joe


--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Narrow minds are weapons made for mass destruction" -The Ex


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to