Actually I'm facing problem with jsp code on jsf page. I'm taking value in my bean property through selectOneMenu. I want to add this bean property to a list which is also a bean property. But the list doesn't get populated. Please look at the code below:
JSP Code
<%@page session="false" contentType="text/html;charset=utf-8"%>
<%@page import="com.ati.qa.bean.RawMaterialQCDetails"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<html>
<head>
<title>Quality Assurance</title>
<link rel="stylesheet" type="text/css" href="Css/Style.css"/>
<jsp:useBean id="rmqc" class="com.ati.qa.bean.RawMaterialQCDetails" scope="page">
<jsp:setProperty name="rmqc" property="*"/>
</jsp:useBean>
<f:subview id="resultc" rendered="#{rmqc.result=='c'}">
<h:selectOneMenu id="comply" styleClass="selectOneMenu" value="#{rawmaterialqcdetails.testValueC}">
<f:selectItem itemLabel="Complies" itemValue="complies"/>
<f:selectItem itemLabel="Does not Comply" itemValue="compliesnot"/>
</h:selectOneMenu>
<jsp:getProperty name="rmqc" property="testValueC"/>
<jsp:getProperty name="rmqc" property="testValList"/>
<%
List list = new java.util.ArrayList();
list.add(rmqc.getTestValue());
rmqc.setTestValList(list);
rmqc.getTestValList().add(rmqc.getTestValue());
%>
</f:subview>
I'd like to add this testValueC to testValList but I don't get the value of testValueC here.
Bean
private String testValueC;
private List testValList;
public List getTestValList()
{
return this.testValList;
}
public void setTestValList(List testValList)
{
this.testValList = testValList;
}
public String getTestValueC()
{
return this.testValueC;
}
public void setTestValueC(String testValueC)
{
this.testValueC = testValueC;
}
Could you please help me solve the problem?
Thanks
To define it in managed bean tag I need to know the class path which I've to write in <managed-bean-class> tag. Could you tell me that? My target is to add the value accepted from selectOnemenu to a List. The bean property is testValueC as you see in the tag:
<h:selectOneMenu id="comply" styleClass="selectOneMenu" value=[i]"#{rawmaterialqcdetails.testValueC}"[/i]>
<f:selectItem itemLabel="Complies" itemValue="complies"/>
<f:selectItem itemLabel="Does not Comply" itemValue="compliesnot"/>
</h:selectOneMenu>
And the List property of bean is testValList where I want to add testValueC. So, on JSF page if I can have testValueC value, I'll add it to the list.
Thanks