jsp页面的跳转不正常,没有跳到我指定的页面,不知道是什么问题呢?请指教下!
jsp页面
<script type="text/javascript">
var fileName="";
function sel(users){
fileName = users;
alert(fileName);
}
function dispatch(BNName){
if(BNName=="L"){
document.forms["mainForm"].action="041init.action";
alter("ss");
}
else {if(BNName=="B1"){
document.forms["mainForm"].action="042search.action?fileName="+fileName;
}
document.forms["mainForm"].submit();
return;
}
</script>
</head>
<body>
<form method="POST" name = "mainForm" >
<div align="center">
<table border="0" width="90%" cellspacing="0" cellpadding="8" >
<tr>
<td align="left" class="title_function">培训视频列表</td>
<td class="title_function"> <div align="right">
<input type="submit" value="新增" onclick="dispatch('L')" >
<input type="button" value="删除" onclick="dispatch('B1')">
</div></td>
</tr>
</table>
<table border="0" width="90%" >
<s:iterator value="#session.list" id="list">
<tr>
<td height="40" width="40">
<img src="${tfile.photo}" width="100" height="100" id="img" style="border: 1px solid #c3c3c3;"></td>
</tr>
<tr>
<td>
<input type=checkbox value="#list.fileName" name="checkbox" onclick="sel('${list.fileName}')">
<a href="042find.action?fileName=${photo}"> <s:property value="#list.fileName"/></a></td>
</tr>
</s:iterator>
xml文件
<struts>
<constant name="struts.i18n.encoding" value="UTF-8" />
<package name="TFile" extends="struts-default"><!-- 其他继承fxs -->
<!-- 登陆 -->
<action name="040find" class="TFileAction" method="select">
<result name="success">/040.jsp</result>
</action>
<action name="042find" class="TFileAction" method="findByName">
<result name="success">/042.jsp</result>
</action>
<action name="041init" class="TFileAction" method="init">
<result name="success">/041.jsp</result>
</action>
<action name="009save" class="TFileAction" method="save">
<result name="success" type="chain">
<param name="actionName">040find</param></result>
</action>
我的应该是从040页面跳到041页面进行添加,但是页面一直保持在040页面不动
jsp页面
<script type="text/javascript">
var fileName="";
function sel(users){
fileName = users;
alert(fileName);
}
function dispatch(BNName){
if(BNName=="L"){
document.forms["mainForm"].action="041init.action";
alter("ss");
}
else {if(BNName=="B1"){
document.forms["mainForm"].action="042search.action?fileName="+fileName;
}
document.forms["mainForm"].submit();
return;
}
</script>
</head>
<body>
<form method="POST" name = "mainForm" >
<div align="center">
<table border="0" width="90%" cellspacing="0" cellpadding="8" >
<tr>
<td align="left" class="title_function">培训视频列表</td>
<td class="title_function"> <div align="right">
<input type="submit" value="新增" onclick="dispatch('L')" >
<input type="button" value="删除" onclick="dispatch('B1')">
</div></td>
</tr>
</table>
<table border="0" width="90%" >
<s:iterator value="#session.list" id="list">
<tr>
<td height="40" width="40">
<img src="${tfile.photo}" width="100" height="100" id="img" style="border: 1px solid #c3c3c3;"></td>
</tr>
<tr>
<td>
<input type=checkbox value="#list.fileName" name="checkbox" onclick="sel('${list.fileName}')">
<a href="042find.action?fileName=${photo}"> <s:property value="#list.fileName"/></a></td>
</tr>
</s:iterator>
xml文件
<struts>
<constant name="struts.i18n.encoding" value="UTF-8" />
<package name="TFile" extends="struts-default"><!-- 其他继承fxs -->
<!-- 登陆 -->
<action name="040find" class="TFileAction" method="select">
<result name="success">/040.jsp</result>
</action>
<action name="042find" class="TFileAction" method="findByName">
<result name="success">/042.jsp</result>
</action>
<action name="041init" class="TFileAction" method="init">
<result name="success">/041.jsp</result>
</action>
<action name="009save" class="TFileAction" method="save">
<result name="success" type="chain">
<param name="actionName">040find</param></result>
</action>
我的应该是从040页面跳到041页面进行添加,但是页面一直保持在040页面不动
解决方案 »
- stuts2的配置文件中package的name属性是做什么用
- 高分求助使用apusic时找不到xxx的父类com.apusic.servlet.jsp.HttpJspPageImpl如何解决
- jsp+ms sql 2000 如何实现数据库的某个数据表的备份,还原,导入,导出,?
- Jsp 中小组开发一般用什么软件拼在一起??
- 1000元征集整站改版设计,高了还是低了?
- 这个错误是啥意思,我不太熟悉
- 如何给网站整站添加背景音乐?
- 锁定鼠标
- 最近csdn可能要重新进行版块划分,java版的兄弟们争取把web版的jsp并过来,顺便放放分!
- 关于session的存活时间的设定
- object is not an instance of declaring class有点烦。
- myeclipse debug 问题
<struts>
<constant name="struts.i18n.encoding" value="UTF-8" />
<package name="TFile" extends="struts-default"><!-- 其他继承fxs -->这个文件中缺少一个属性,在<package name="TFile" extends="struts-default"><!-- 其他继承fxs -->中加上 namespace="/"再试试。
alter("ss");
是alert("ss");把这个改一下试试,要么就是路径问题
document.forms["mainForm"].action="041init!init.action";
}
建议如果用struts2就应该遵循one page one app的规则一个页面一个action例如页面跳转,就简历一个页面跳转的action