1 Reply Latest reply on Aug 13, 2004 3:28 AM by kennethaitken

    JSF and JSTL bug with JBoss 3.2.5

    kennethaitken

      I have tried to create a simple set of URL links using Java Server Faces coupled with JSTL, which change to plain text when the relevant link was clicked:

      one two three

      I click on three, then three is selected and no longer a link(underlined):
      one two three

      If I then click on two, two is selected and no longer a link:
      one two three

      Or I click on one:
      one two three

      Here is the code for the JSF file (excuse the strange formatting, because it looks even stranger with indentations):

      <%@ page language="java" import="java.lang.*,java.util.*" %>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
      
      <%
      String path = request.getContextPath();
      String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
      %>
      <html>
      <head>
      <base href="<%=basePath%>">
      
      <title>Test</title>
      
      <meta http-equiv="pragma" content="no-cache">
      <meta http-equiv="cache-control" content="no-cache">
      <meta http-equiv="expires" content="0">
      
      <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
      <meta http-equiv="description" content="This is my page">
      
       <!--
       <link rel="stylesheet" type="text/css" href="styles.css">
       -->
      </head>
      
       <body>
       <f:view>
       <h:form id="BugDemo">
       <c:choose>
       <c:when test="${param.test != 'one'}">
       <h:outputLink value="http://localhost:8080/test1/BugDemo.faces">
       <f:param name="test" value="one"/>
       <h:outputText id="oneLink" value="one"/>
       </h:outputLink>
       </c:when>
       <c:otherwise>
       <h:outputText id="one" value="one"/>
       </c:otherwise>
       </c:choose>
      
       <c:choose>
       <c:when test="${param.test != 'two'}">
       <h:outputLink value="http://localhost:8080/test1/BugDemo.faces">
       <f:param name="test" value="two"/>
       <h:outputText id="twoLink" value="two"/>
       </h:outputLink>
       </c:when>
       <c:otherwise>
       <h:outputText id="two" value="two"/>
       </c:otherwise>
       </c:choose>
      
       <c:choose>
       <c:when test="${param.test != 'three'}">
       <h:outputLink value="http://localhost:8080/test1/BugDemo.faces">
       <f:param name="test" value="three"/>
       <h:outputText id="threeLink" value="three"/>
       </h:outputLink>
       </c:when>
       <c:otherwise>
       <h:outputText id="three" value="three"/>
       </c:otherwise>
       </c:choose>
      
       </h:form>
       </f:view>
       </body>
      </html>


      When I run this faces file in Tomcat 5.0.27, it behaves as expected. But running it in JBoss 3.2.5, the parameters get mixed up. For example, URL link three gets the parameter ?test=two. Or link two gets the parameter ?test=one. Can someone explain what is going on? Is it a bug in JBoss?

        • 1. Re: JSF and JSTL bug with JBoss 3.2.5
          kennethaitken

          I have discovered the solution, namely to give every JSF component an ID. There seems to be a bug in JBoss's allotment of IDs, so that, in this case, URLs get switched between the components.
          Therefore, as soon as I also give every <f:param> an id and every <h:outputLink> an id, the problem vanishes.