I am working on panelgroup select menu that would only be visible if the first select Menu wasn't set as a "P" or as a "N". I found an example but before i can try it, I got an error stating
java.lang.NoClassDefFoundError: javax/servlet/jsp
/jstl/core/Config
Which is strange because I am sure i am using jsf 2.2 . the only jar file i have my project library is:
javax.faces-2.2.5.jar
Below is the section of new code i wrote based on a example I found.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://java.sun.com/jsf/core" >
<h:body>
<h:form>
<b>Blue tooth test: </b>
<h:selectOneMenu value="#{qcFormBean.dliStickerValue}">
<f:selectItem itemValue="P" itemLabel="Pass" />
<f:selectItem itemValue="N" itemLabel="N:A" />
<f:selectItem itemValue="M" itemLabel="FAIL-Mechanical" />
<f:selectItem itemValue="E" itemLabel="FAIL-Electrical" />
<f:selectItem itemValue="C" itemLabel="FAIL-Cosmetic" />
<f:selectItem itemValue="S" itemLabel="FAIL-Software" />
<f:ajax event="change" execute="@this" render="perfbyDliSticker" />
</h:selectOneMenu>
<h:panelGroup id="perfbyDliSticker">
<h:selectOneMenu value="#{qcFormBean.stickerFreq}"
rendered="#{!qcFormBean.dliStickerValue eq 'P' or !qcFormBean.dliStickerValue eq 'N'}">
<f:selectItem itemValue="O" itemLabel="Often" />
<f:selectItem itemValue="S" itemLabel="Seldom" />
</h:selectOneMenu>
Is there something i am doing wrong or is the way i am trying to render this not JSF-ish or am i missing more files because I added these files before
jsf-api.jar jstl-1.2.jar jsf-impl.jar
but then i got a tomcat error in eclipse saying that the file is now a jsp file instead of a jsf file and needs to be added to the web.xml. So there must be some other way about this.
------Update------
Made changes to my code here is the update:
<h:selectOneMenu value="#{qcFormBean.dliStickerValue}">
<f:selectItem itemValue="P" itemLabel="Pass or Not applicable" />
<f:selectItem itemValue="M" itemLabel="FAIL-Mechanical" />
<f:selectItem itemValue="E" itemLabel="FAIL-Electrical" />
<f:selectItem itemValue="C" itemLabel="FAIL-Cosmetic" />
<f:selectItem itemValue="S" itemLabel="FAIL-Software" />
<f:ajax event="change" execute="@this" render="perfbyDliSticker" />
</h:selectOneMenu>
<h:panelGroup id="perfbyDliSticker">
<h:selectOneMenu value="#{qcFormBean.performedByRoleID}"
rendered="#{!qcFormBean.dliStickerValue eq 'P'}">
<f:selectItem itemValue="A" itemLabel="Always" />
<f:selectItem itemValue="O" itemLabel="Often" />
<f:selectItem itemValue="S" itemLabel="Seldom" />
</h:selectOneMenu>
--update 2_----- adding my web.xml to see if it helps.
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<description>State saving method: 'client' or 'server' (default). See JSF Specification section 2.5.2</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<welcome-file-list>
<welcome-file>index.jsf</welcome-file>
<welcome-file>welcome.jsf</welcome-file>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>