jsp:usebean on jsf page

Can I use jsp:usebean tag on JSF page?Thanks
[58 byte] By [islandhopea] at [2007-11-27 5:22:03]
# 1
Which problems are you occurring then?
BalusCa at 2007-7-12 11:47:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

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

islandhopea at 2007-7-12 11:47:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
You can use it in a JSF page, but you cannot mix it with JSF (not in that way, the FacesServlet/FacesContext is not going to see the useBean). Define the useBean as a managed bean in the faces-config.xml, then you can use it in the JSF context.
BalusCa at 2007-7-12 11:47:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Thanks...but I don't know how to define useBean as a managed bean in the faces-config.xml. In fact I'm new in JSF. Could you help me do that?Thanks
islandhopea at 2007-7-12 11:47:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
It's the same way as you've definied the #{rawmaterialqcdetails}. What exactly do you want to achieve anyway?
BalusCa at 2007-7-12 11:47:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6

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

islandhopea at 2007-7-12 11:47:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...