我是个刚接触struts2的菜鸟,现在有一个很急的问题摆在我的前面:在struts2中实现下面的html代码,都需要用到哪几个标签,谢谢各位大大:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title> </title>
<script>
function toRight(){
var index = document.getElementById("s1").selectedIndex;
if(index!=-1){
var obj = document.getElementById("s1").options[index];
document.getElementById("s1").remove(index);
document.getElementById("s2").add(obj);
}
}
function toLeft(){
var index = document.getElementById("s2").selectedIndex;
if(index!=-1){
var obj = document.getElementById("s2").options[index];
document.getElementById("s2").remove(index);
document.getElementById("s1").add(obj);
}
}
</script>
</head>
<body>
<table>
<tr>
<td height="100px" width="100px"> <select id="s1" style="width:100%" size="8">
<option value="1">1 </option>
<option value="2">2 </option>
<option value="3">3 </option>
<option value="4">4 </option>
<option value="5">5 </option>
</select> </td>
<td width="10px"> <input type="button" value="-->" onClick="toRight()"> <br>
<input type="button" value=" <--" onClick="toLeft()"> </td>
<td width="100px"> <select id="s2" style="width:100%" size="8">
<option value="6">6 </option>
<option value="7">7 </option>
<option value="8">8 </option>
<option value="9">9 </option>
<option value="10">10 </option>
</select> </td>
</tr>
</table>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title> </title>
<script>
function toRight(){
var index = document.getElementById("s1").selectedIndex;
if(index!=-1){
var obj = document.getElementById("s1").options[index];
document.getElementById("s1").remove(index);
document.getElementById("s2").add(obj);
}
}
function toLeft(){
var index = document.getElementById("s2").selectedIndex;
if(index!=-1){
var obj = document.getElementById("s2").options[index];
document.getElementById("s2").remove(index);
document.getElementById("s1").add(obj);
}
}
</script>
</head>
<body>
<table>
<tr>
<td height="100px" width="100px"> <select id="s1" style="width:100%" size="8">
<option value="1">1 </option>
<option value="2">2 </option>
<option value="3">3 </option>
<option value="4">4 </option>
<option value="5">5 </option>
</select> </td>
<td width="10px"> <input type="button" value="-->" onClick="toRight()"> <br>
<input type="button" value=" <--" onClick="toLeft()"> </td>
<td width="100px"> <select id="s2" style="width:100%" size="8">
<option value="6">6 </option>
<option value="7">7 </option>
<option value="8">8 </option>
<option value="9">9 </option>
<option value="10">10 </option>
</select> </td>
</tr>
</table>
</body>
</html>
解决方案 »
- struts的多模块
- 请教一个hibernate分页调用数据的问题
- 搞J2EE的 是否去学下.NET,了解下`
- 字符串打印问题?求教!
- tomcat5.5.17部署Web应用后,不能访问。
- SVNKIT 多次执行repository.getDir()报错svn:E175002:connection refused by the server
- 有什么工具可以方便的从servlets和JSP页面中方便的访问COM接囗?
- 关于j2ee中事务处理的问题,请各位大哥指教!
- 第一次玩JBOSS,看了资料说下载后运行run.bat就可以了,但是...各位帮我看一下吧
- jb与weblogic开发ejb
- hibernate+c3p0 连接as400 db2 锁表问题
- 有关Jprofiler5.1.4的问题
楼主参考一下我的blog,struts2标签大全
http://blog.csdn.net/lihan6415151528/archive/2008/10/16/3085468.aspx
你可以从这里知道详细答案!
<option value="1">1 </option>
<option value="2">2 </option>
<option value="3">3 </option>
<option value="4">4 </option>
<option value="5">5 </option>
</select>和<select id="s2" style="width:100%" size="8">
<option value="6">6 </option>
<option value="7">7 </option>
<option value="8">8 </option>
<option value="9">9 </option>
<option value="10">10 </option>
</select> 用s:select标签<input type="button" value="-->" onClick="toRight()"> 和<input type="button" value=" <--" onClick="toLeft()"> 用s:submit实现
你说的这功能是javaScript实现吧,跟struts标签有什么关系下面的表单可以换,记得把主题改成simple,要不不好自己布局
<s:optiontransferselect
label="Favourite Cartoons Characters"
name="leftSideCartoonCharacters"
leftTitle="Left Title"
rightTitle="Right Title"
list="{'1', '2', '3', '4', '5'}"
multiple="true"
headerKey="headerKey"
headerValue="--- Please Select ---"
emptyOption="true"
doubleList="{'6', '7', '8', '9', '10'}"
doubleName="rightSideCartoonCharacters"
doubleHeaderKey="doubleHeaderKey"
doubleHeaderValue="--- Please Select ---"
doubleEmptyOption="true"
doubleMultiple="true"
/>试试吧
我的意思是用struts2的标签来实现那些js实现的功能:)
struts有一些和HTML相似的标签可以用,
可以用s:select,
还有 就是楼上的,
或者是s:itrator