:jsf中后台bean给jsp传值很常见也很容易
例
SearchBean 中
public class SearchBean {
private String media_name=;
public String getMedia_name() {
return media_name;
}
public void setMedia_name(String media_name) {
dia_name = media_name;
}
}
facesconfigxml文件中配置bean
<managedbean>
<managedbeanname>serach</managedbeanname>
<managedbeanclass>adminSearchBean</managedbeanclass>
<managedbeanscope>request</managedbeanscope>
</managedbean>
JSP页面中使用
<h:outputText value=文件名称(必填) />
<h:inputText value=#{dia_name} ></h:inputText>
:jsp向后台bean传值
例
JSP页面中
<h:commandButton value=上传 actionListener=#{searchuploadFile} styleClass=button>
<f:attribute name=attrname value=#{visitoruserId} />
</h:commandButton>
在bean中
public void uploadFile(ActionEvent ae) throws Exception{
user_name = (String) aegetComponent()getAttributes()get(attrname);
}