| Author |
problem when working with selectOneListbox
|
mohammad ghasemi hamed
Greenhorn
Joined: Jun 18, 2007
Posts: 1
|
|
hi all i have a problem when working with <h:selectOneListbox> or <h:selectOneMenu>. When i select one item and submit it, it just work well ,but after using another <h:selectOneListbox> or <h:selectOneMenu> in another page, and making two or three page navigation, the first page's <h:selectOneListbox> or <h:selectOneMenu> doesn't remember its selected value. ---------------------------------------------testHandler.java---------------- import javax.faces.component.*; import javax.faces.model.*; import java.util.*; public class testHandler { private List list = new LinkedList(); private Integer ival; private Object oval; public testHandler() { list.add(new SelectItem(new Integer(1), "1")); list.add(new SelectItem(new Integer(2), "two")); list.add(new SelectItem(new Integer(3), "three")); list.add(new SelectItem(new Integer(4), "four")); } public Object getOval() { return oval; } public void setOval(Object oval) { this.oval = oval; } public Integer getIval() { return ival; } public void setIval(Integer ival) { this.ival = ival; } public void setList(List list) { this.list = list; } public List getList() { return list; } } -------------------------------------------------------- -----file2.jsp--------------------------------- <%@ page contentType="text/html; charset=utf-8"%> <%request.setCharacterEncoding("utf8");%> <%@ page import ="VE.*"%> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x"%> <jsp:useBean id="bean2" scope="session" class="testHandler" /> <f:view> <h:form > <h:selectOneListbox id="s5" value="#{bean2.oval}" > <f:selectItems value="#{bean2.list}"/> </h:selectOneListbox> <h:commandButton value="save"/> </br> </h:form> <a href="file.faces">file</a> </f:view> ------------------------------------------ ------------------------------------------ ------------------file.jsp------------------------ <%@ page contentType="text/html; charset=utf-8"%> <%request.setCharacterEncoding("utf8");%> <%@ page import ="VE.*"%> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x"%> <jsp:useBean id="bean1" scope="session" class="testHandler" /> <f:view> <h:form > <h:selectOneListbox id="s5" value="#{bean1.oval}" > <f:selectItems value="#{bean1.list}"/> </h:selectOneListbox> <h:commandButton value="save"/> </br> </h:form> <a href="file2.faces">file2</a> </f:view> ----------------------------------- please HELP ME!!! THANK YOU [ June 18, 2007: Message edited by: mohammad ghasemi hamed ]
|
 |
 |
|
|
subject: problem when working with selectOneListbox
|
|
|