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 552627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:31:11+00:00 2026-05-13T11:31:11+00:00

The c:if test always fails for me and it never gets inside the loop.

  • 0

The c:if test always fails for me and it never gets inside the loop. I am using the following namespaces

xmlns:fn="http://java.sun.com/jsp/jstl/functions"
xmlns:c="http://java.sun.com/jstl/core"

The string (‘array’) to be split is “Tom and Jerry are GAP1 friends”

<s:decorate template="/layout/display-text.xhtml">
    <c:set var="array" value="#{_mybean.value}"/>
    <c:set var="space" value="#{fn:split(array, ' ')}"/>
    <c:set var="len" value="#{fn:length(space)}"/>
    <h:outputText value="total length = #{len}"/><br/>
    <c:forEach begin="0" end="5" var="index">
        <h:outputText value="index = #{index}, value = #{space[index]}"/><br/>
        <c:set var="val" value="#{space[index]}"/>
        <c:if test="#{fn:startsWith(val, 'GAP')}">
            <h:outputText value="Found keyword parameter GAP" /><br/>
        </c:if>
    </c:forEach>
</s:decorate>
  • 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-05-13T11:31:12+00:00Added an answer on May 13, 2026 at 11:31 am

    The JSTL core URI is invalid. As per the JSTL TLD it should be (note the extra /jsp):

    xmlns:c="http://java.sun.com/jsp/jstl/core"
    

    That said, mixing JSF with JSTL is never been a good idea. It won’t always give results as you’d expect because they doesn’t run in sync as you would expect from the coding. It’s more that JSP/JSTL runs from top to bottom first and then hands over the produced result to JSF to process further from top to bottom again. That would cause some specific constructs to fail. Better use pure JSF components/attributes instead.

    Instead of c:forEach, rather use Seam’s a4j:repeat or Facelets’ ui:repeat and instead of c:if make use of the rendered attribute of the JSF component which has to be toggled to show/hide. Instead of all that JSTL c:set, write appropriate code logic in managed bean constructor or action method or getter.

    The JSTL functions (fn) taglib is however still highly valuable in JSF. You can keep using it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my test automation practice I always use a gui mapping strategy that reduces
Test the following code: #include <stdio.h> #include <stdlib.h> main() { const char *yytext=0; const
Our test department has a series of web tests created using Visual Studio 2005
Test Driven Development has been the rage in the .NET community for the last
After test driving Google Chrome for 30 minutes or so, I like it, even
Our Test DB is suddenly missing rows. We want them back. Is there a
The test driven development guys refer to a quick, exploratory, investigation that involves coding
Given test.txt containing: test message I want to end up with: testing a message
The test form generated by ASMX is pretty handy for testing operations. However, there
I test my app only on local cassini web server, and I get strange

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.