• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

problem when working with selectOneListbox

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
They weren't very bright, but they were very, very big. Ad contrast:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic