Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8140805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:17:13+00:00 2026-06-06T12:17:13+00:00

<%@ taglib uri=http://java.sun.com/jsp/jstl/core prefix=c%> <td colspan=1 width=100> <c:choose> <c:when> <c:choose> <c:when></c:when><c:otherwise> <c:when test=<%=\F\.equals(result[1]) %>>

  • 0
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<td colspan="1" width="100">
<c:choose>
  <c:when>
    <c:choose>
       <c:when></c:when><c:otherwise>
    <c:when test="<%=\"F\".equals(result[1]) %>">
     <c:set var="checked"><%=result[0].equals("Y")%></c:set>
     <input type="checkbox" id="<%="ABC"+"$"+rows%>" name="<%="ABC"+"$"+rows%>" value="<%=String.valueOf(rows)%>" ${checked ? 'checked' : ''} onclick="someFunction(this)"/>
    </c:when></c:otherwise>
    </c:choose>
  </c:when>    
  <c:otherwise>
  </c:otherwise>
</c:choose>
</td>

For some reason, the JSP compiler complains that there is no end tag for the <c:when> that nests the input type=”checkbox”…may i know what i’m doing wrong? i tried using <c:if> and it doesnt work either, compiler complains no end tag too.

EDIT: if i dont nest the input type and the set var like below, then it works…but it fails to accomplish my original logic..

    <c:otherwise>
            <c:when test="<%=\"F\".equals(result[1]) %>">
            </c:when>
            <c:set var="checked"><%=result[0].equals("Y")%></c:set>
             <input type="checkbox" id="<%="ABC"+"$"+rows%>" name="<%="ABC"+"$"+rows%>" value="<%=String.valueOf(rows)%>" ${checked ? 'checked' : ''} onclick="someFunction(this)"/>
    </c:otherwise>

EDIT 2: i have to code jsp in this manner on pain of death from my architect lol. any advice will be gladly accepted to retain my proposed logic.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T12:17:14+00:00Added an answer on June 6, 2026 at 12:17 pm

    Just get rid of all those scriptlets (the oldschool <% %> things). They don’t mix well with taglibs. The JSTL attributes take EL expressions only.

    E.g., assuming that you’ve done a request.setAttribute("results", results) beforehand, which designtechnically needs to be done in a servlet, but can also be done in a scriptlet somewhere in top of JSP.

    <c:forEach items="${results}" var="result">
      ...
      <td colspan="1" width="100">
        <c:choose>
          <c:when>
            <c:choose>
              <c:when></c:when>
              <c:otherwise>
                <c:when test="${result[1] == 'F'}">
                  <c:set var="checked">${result[0] == 'Y'}</c:set>
                  <input type="checkbox" id="ABC$${rows}" name="ABC$${rows}" value="${rows}" ${checked ? 'checked' : ''} onclick="someFunction(this)" />
                </c:when>
              </c:otherwise>
            </c:choose>
          </c:when>    
          <c:otherwise>
          </c:otherwise>
        </c:choose>
      </td>
      ...
    </c:forEach>
    

    It’s instantly also much better readable this way.

    See also:

    • Show JDBC ResultSet in HTML in JSP page using MVC and DAO pattern
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this JSP code snippet: <%@ taglib uri=http://java.sun.com/jsp/jstl/core prefix=c%> <c:choose> <c:when test=${var1.properties[\Item Type\]
This is my JSP page's taglib directive: <%@ taglib uri=http://java.sun.com/jsp/jstl/core prefix=c %> I'm getting
<%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core %> <%@ page import=com.library.controller.*%> <%@ page import=com.library.dao.* %> <%@ page
<%@ taglib prefix=c uri=http: java.sun.com/jstl/core %> this doesn't work. What is the new taglib
Im using displaytag 1.2 and fmt tags: <%@ taglib uri=http://java.sun.com/jsp/jstl/fmt prefix=fmt %> <%@ taglib
I want to use JSTL I tried to import taglib using: <%@ taglib uri=http://java.sun.com/jsp/jstl/core
Code in the jsp page: <%@page contentType=text/html pageEncoding=UTF-8%> <%@taglib prefix=c uri=http://java.sun.com/jsp/jstl/core %> <%@page import=GeneralClasses.FooClass
I have a simple scrollableDataTable in a jsf <%@ taglib uri=http://java.sun.com/jsf/core prefix=f %> <%@
I've a JSP with <%@taglib uri=http://java.sun.com/jsf/facelets prefix=ui %> However it errors with The absolute
org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.