测试过了,希望能帮你
<%@ page language="java" pageEncoding="GBK"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<html:html lang="true">
<head>
<html:base />
<title>Test.jsp</title>
<script type="text/javascript">
function sele_fun(option_value){
var value;
if(option_value=="ByID"){
value="<input type=text style='width:200px' value='^_^'>";
}else if(option_value=="ByIdentity"){
value="<select><option>^_^</option><option>^_^</option><option>^_^</option></select>";
}else{
value="";
}
document.getElementById("op").innerHTML=value;
}
</script>
</head>
<body>
<html:select property="sel" onchange="sele_fun(this.value)">
<option value="...">...</option>
<option value="ByID">ByID</option>
<option value="ByIdentity">ByIdentity</option>
</html:select>
<P>
<div id="op"></div>
</body>
</html:html>
<%@ page language="java" pageEncoding="GBK"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<html:html lang="true">
<head>
<html:base />
<title>Test.jsp</title>
<script type="text/javascript">
function sele_fun(option_value){
var value;
if(option_value=="ByID"){
value="<input type=text style='width:200px' value='^_^'>";
}else if(option_value=="ByIdentity"){
value="<select><option>^_^</option><option>^_^</option><option>^_^</option></select>";
}else{
value="";
}
document.getElementById("op").innerHTML=value;
}
</script>
</head>
<body>
<html:select property="sel" onchange="sele_fun(this.value)">
<option value="...">...</option>
<option value="ByID">ByID</option>
<option value="ByIdentity">ByIdentity</option>
</html:select>
<P>
<div id="op"></div>
</body>
</html:html>
解决方案 »
- 关于 spring 结合 acegi 处理文件上传
- 求助:Jboss启动问题
- JAVA倒三角程序
- 使用EntityManager的getTransaction获取事务时抛出IllegalStateException
- JavaMail中如何判断邮件有附件的问题
- 关于Xstream包的问题!
- servlet上下文是不是就是webapps那个目录啊!?
- 复杂逻辑的困惑。。。请帮忙看看!
- 关于struts中<html:radio property='templateArray' value="a"/>里面的value的问题
- 请教高手:J2ee1.4中Datasource的 设置文件是哪一个?如何设置jdbcDataSource?
- 有关Soap传送\接收一个Soap消息的问题:在客户端如何接收服务器响应的Soap消息?
- 代码统计,谨以此纪念我的2006
<html:select property="p1" onchange="chg(this.value)">
//这里你可以添入byID和ByIdentity的选项
</html:select>
<html:text propert="p2" style="display:none"/>
<html:select property="p3" style="display:none">
//这里设置option选项
</html:select>
<script>
function chg(flag){
if(flag=='byId'){
formname.p2.style.display='';
formname.p3.style.display='none';
}
if(flag=='ByIdentity'){
formname.p2.style.display='none';
formname.p3.style.display='';
}
}
</script>我上面用的p1、p2、p3是指你Form里面的属性
formname是指你的Action所对应formbean名
"formname是指你的Action所对应formbean名"
对应的哪个formbean啊,是对应的form类名?还是struts-config.xml中<action name="">的name?还是在action类中定义的formbean的对象名?我都试过了,都不行啊
我运行你的代码为什么会报错呢
javax.servlet.ServletException: Cannot find bean under name org.apache.struts.taglib.html.BEAN