这是ClubBoard表
public class ClubBoard implements java.io.Serializable {
private Integer BId;
private Company company;
private String BName;
private Set clubSections = new HashSet(0);
这是ClubSection表
public class ClubSection implements java.io.Serializable {
private Integer SId;
private ClubBoard clubBoard;
private String SName;
private Integer SClickCount;
private Integer STopicCount;
private Set clubTopics = new HashSet(0);有2个这样的方法:
查出第一级下拉框里面的数据
public List<ClubBoard> findAll() {
String hql="select clubBoard from ClubBoard clubBoard";
return this.getSession().createQuery(hql).list();}
查出第二级下拉框里面数据方法
public List<ClubSection> findAlls() {
String hql="select clubSection from ClubSection clubSection";
return this.getSession().createQuery(hql).list();}我想在页面怎么样显示据第一级下拉框里面的一条数据查出第二级下拉框里面所有数据{不用JavaStript}第一级下拉框
<select id="clubBoard" name="clubBoard" onChange="showCS(this.value)">
<option value=0>---请选择---</option>
<%
for(ClubBoard clubBoard:clubBoardList){
out.print("<option value='"+clubBoard.getBId()+"'>"+clubBoard.getBName()+"</option>");}
%>
</select>第二级下拉框
<select name="clubSection" id="clubSection">
<option value=1>---请选择---</option>
<%
for(ClubSection clubsection:clubSectionList){
out.print("<option value='"+clubsection.getSId()+"'>"+clubsection.getSName()+"</option>");}
%>
</select>
谢谢大侠们!!!!在线等着急用!!!!!!!!!!!!!!!!
public class ClubBoard implements java.io.Serializable {
private Integer BId;
private Company company;
private String BName;
private Set clubSections = new HashSet(0);
这是ClubSection表
public class ClubSection implements java.io.Serializable {
private Integer SId;
private ClubBoard clubBoard;
private String SName;
private Integer SClickCount;
private Integer STopicCount;
private Set clubTopics = new HashSet(0);有2个这样的方法:
查出第一级下拉框里面的数据
public List<ClubBoard> findAll() {
String hql="select clubBoard from ClubBoard clubBoard";
return this.getSession().createQuery(hql).list();}
查出第二级下拉框里面数据方法
public List<ClubSection> findAlls() {
String hql="select clubSection from ClubSection clubSection";
return this.getSession().createQuery(hql).list();}我想在页面怎么样显示据第一级下拉框里面的一条数据查出第二级下拉框里面所有数据{不用JavaStript}第一级下拉框
<select id="clubBoard" name="clubBoard" onChange="showCS(this.value)">
<option value=0>---请选择---</option>
<%
for(ClubBoard clubBoard:clubBoardList){
out.print("<option value='"+clubBoard.getBId()+"'>"+clubBoard.getBName()+"</option>");}
%>
</select>第二级下拉框
<select name="clubSection" id="clubSection">
<option value=1>---请选择---</option>
<%
for(ClubSection clubsection:clubSectionList){
out.print("<option value='"+clubsection.getSId()+"'>"+clubsection.getSName()+"</option>");}
%>
</select>
谢谢大侠们!!!!在线等着急用!!!!!!!!!!!!!!!!
无刷新的页面调用
你先学一下这个吧说的简单点
你的东西就是做一个关联查询而已用Ajax就很好了去学习学习吧
我你说的这个问题我前不久都做过了 呵呵
ICMP Type
</td>
<td class="common_td_text_left" align="center">
<ww:select name="newFlowCustomAnalysis.icmpType" value="newFlowCustomAnalysis.icmpType" list="TEMP_ICMP_TYPE"
listValue="value" listKey="key" theme="simple" emptyOption="true" id="newFlowCustomAnalysis.icmpType" onchange="getIcmpCode()" />
</td> <td align="center" class="common_td_lable" >
ICMP Code
</td>
<td class="common_td_text_left" width="25%" >
<ww:select name="newFlowCustomAnalysis.icmpCode" listValue="value" list="TEMP_ICMP_CODE"
listKey="key" value="newFlowCustomAnalysis.icmpCode" theme="simple" emptyOption="true"
id="newFlowCustomAnalysis.icmpCode" />
</td>--------------------------------------------------------------------
function getIcmpCode() {
var enList = new Array();
var enListOne = new Array();
var icmpCodeid=(document.getElementById("newFlowCustomAnalysis.icmpType").value);
var xmlhttp = createxmlhttprequest();
var post="/flowIcmpAnalysis/getIcmpCode.action?icmpCodeid=" + icmpCodeid +"&" + Math.random();
xmlhttp.open("GET", post, true);
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4)
{
if (xmlhttp.status == 200)
{
if (xmlhttp.responseText.length > 0)
{
var infos = xmlhttp.responseText;
if (infos.length > 0)
{
var a = infos.substring(1, infos.length - 1);
var b = a.split(", ");
for (var i = 0; i < b.length; i++) { var c = b[i].split("=");
enList.push(c[1]);
enListOne.push(c[0]); } }
doList(enList, enListOne);
} }
}
}
xmlhttp.send(null);
} function doList(enList, enListOne) {
var select = document.getElementById("newFlowCustomAnalysis.icmpCode");
select.length = 0;
select.options.add(new Option());
for (var i = 0; i < enList.length; i++) {
select.options.add(new Option(enList[i], enListOne[i]));
}
}
function createxmlhttprequest(){
var xmlhttp = false;
try
{
xmlhttp = new ActiveXObject('Msxm12.XMLHTTP');
}
catch(e)
{ try
{
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
}
catch(e)
{
try
{
xmlhttp = new XmlHttpRequest();
}
catch(e)
{ }
}
}
return xmlhttp;
}---------------------------------------------------
页面是用框架标签写的 你看看吧 希望对你有帮助