解决方案 »
- 求教JavaEE DataSouce中数据库名修改后,启动Tomcat后还一直会去找旧的数据库名
- Hibernate中使用annotation问题
- webservice axis2 如何用 log4j记录日志
- ssh2整合时候出现这样的错误
- 我面临着抉择,需要你们的救助,我的前辈们,我的兄弟们!!
- java 写的socket系统,做负载均衡
- 有深圳的朋友吗?请问深圳哪里有电子科技书店??
- Java和VC用SOCKET通信,连接失败,大家帮我看一下
- 500分 求解关于UDP数据报的接收问题
- 我的jndi有问题,谁能帮我看看
- struts2上传文件后如何令这些上传的文件在页面显示,并供别人下载?
- common-upload框架,出现java.io.FileNotFoundException?
/MyStoraneManage/stockIn_ajaxLoad.action加上整个路径试试看,
浏览器直接敲 url 地址看是否能够到后台?
浏览器工具调试是否有错误信息?
路径是没错
Struts Problem ReportStruts has detected an unhandled exception:Messages:
org.apache.commons.lang.exception.NestableRuntimeException
org/apache/commons/lang/exception/NestableRuntimeException
File: org/apache/catalina/loader/WebappClassLoader.java
Line number: 1,645
2.然后在ajax跳转的url中的action里下断点,如果能断下来,说明ajax提交请求没问题。
3.接下来就要看你后台action的处理逻辑了。
alert没有执行,直接提交表单的action=“stockIn_page.action”,调用action的page()列出数据库数据了,url没有写错,就是不执行onclick()
alert没有执行,直接提交表单的action=“stockIn_page.action”,调用action的page()列出数据库数据了,url没有写错,就是不执行onclick()
那这个问题很怪异,但是感觉不是个大问题呢,可能还是笔误
这是jsp,应该没问题吧
<form action="stockIn_page.action" method="post" name="pgform">
<table>
<tr>
<td><input type="text" name="stockin.inid" value="${stockin.inid}" size="5" /></td>
<th>商品编号</th>
<td><input type="text" name="stockin.gepc" value="${stockin.gepc}" size="10"/></td>
<th>客户编号</th>
<td><input type="text" name="stockin.guestid" value="${stockin.guestid}" size="10"/></td>
<td> <input class="btn btn-red" type="submit" onclick="submitform()"></td>
<td> <input class="btn btn-green" type="reset" onclick="javascript:document.pgform.reset()"></td>
</tr>
</table>
</span>
<hr/>
<table class="stylized full" id="t" >
<thead>
<tr>
<th width="3%">
<input type="checkbox" name="checkbox" id="checkbox" onclick="selectAllOrNo();"/></th>
<th>订单编号</th>
<th>商品编号</th>
<th>商品名称</th>
<th>经手人</th>
<th>客户</th>
<th>数量</th>
<th>是否处理</th>
<th>其他操作</th>
</tr>
</thead>
<c:forEach items="${page.data}" var="stockins" varStatus="c">
<tbody>
<tr onmouseover="this.style.backgroundColor='#FFF68F'" onmouseout="this.style.backgroundColor='#FAFAFA'" >
<td width="3%"><input type="checkbox" name="ck" id="ck" value="${stockins.id}"/></td>
<td><a href="/MyStoraneManage/stockIn_showStockInItemsByinid.action?inid=${stockins.inid}">${stockins.inid}</a></td>
<input name="in_id" id="in_id" value="${stockins.id}" readonly="readonly" type="hidden"/>
<td>${stockins.gepc}</td>
<td>${stockins.gname}</td>
<td>${stockins.uid}</td>
<td>${stockins.guestid}</td>
<td>${stockins.sumin}</td>
<td>
<c:if test="${stockins.flag==0}">未处理</c:if>
<c:if test="${stockins.flag==1}">已处理</c:if>
</td>
<td>
<c:if test="${stockins.flag==0}">
<a href="/MyStoraneManage/stockIn_delStockInId.action?id=${stockins.id}" class="btn" onclick="javascript:return alert_del()"><span class="icon icon-cancel"> </span>删除</a>
<a href="/MyStoraneManage/stockIn_getOneStockIn.action?id=${stockins.id}" class="btn"><span class="icon icon-add"> </span>编辑</a>
</c:if>
<c:if test="${stockins.flag==1}">
<button class="btn" onclick="clickbtnGet();"><span class="icon icon-ok"> </span>详情</button>
</c:if>
</td>
</tr>
</c:forEach>
</tbody>
<tfoot>
<tr>
<td colspan="9">
<div class="pager">
共<font color="blue">${page.totalcount}</font>条记录 每页<input value="${page.pagesize}" size="2" name="pSize" />条
第<font color="blue">${page.currentPage}</font>页/共<font color="blue">${page.totalPage}</font>页
<a href="stockIn_page.action?pnum=1&pSize=${page.pagesize}&stockin.inid=${stockin.inid}&stockin.gepc=${stockin.gepc}&stockin.guestid=${stockin.guestid}">第一页</a>
<a href="stockIn_page.action?pnum=${page.prePage}&pSize=${page.pagesize}&stockin.inid=${stockin.inid}&stockin.gepc=${stockin.gepc}&stockin.guestid=${stockin.guestid}" >上一页</a>
<a href="stockIn_page.action?pnum=${page.nextPage}&pSize=${page.pagesize}&stockin.inid=${stockin.inid}&stockin.gepc=${stockin.gepc}&stockin.guestid=${stockin.guestid}" >下一页</a>
<a href="stockIn_page.action?pnum=${page.totalPage}&pSize=${page.pagesize}&stockin.inid=${stockin.inid}&stockin.gepc=${stockin.gepc}&stockin.guestid=${stockin.guestid}" >最后一页</a>
转到<input name="pnum" value="${page.currentPage}" id="pnum" size="2" />
<button onclick="pgsel();" type="submit">GO</button>
</div>
</form>
</td>
</tr>
</tfoot>
</table>
4:08:59,095 ERROR ParametersInterceptor:38 - Developer Notification (set struts.devMode to false to disable this message):
Unexpected Exception caught setting 'stockin.gepc' on 'class com.lxl.storage.action.StockInAction: Error setting expression 'stockin.gepc' with value '[Ljava.lang.String;@1ec265c'
Error setting expression 'stockin.gepc' with value '[Ljava.lang.String;@1ec265c' - Class: ognl.OgnlRuntime
File: OgnlRuntime.java
Method: setProperty
alert没有执行,直接提交表单的action=“stockIn_page.action”,调用action的page()列出数据库数据了,url没有写错,就是不执行onclick()
那这个问题很怪异,但是感觉不是个大问题呢,可能还是笔误
笔误是不太可能啦现在在调用onclick()之前报以下类似错误
WARN OgnlValueStack:64 - Error setting expression 'stockin.guestid' with value '[Ljava.lang.String;@ca671a'
ognl.OgnlException: target is null for setProperty(null, "guestid", [Ljava.lang.String;@ca671a)
at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2326)但我要请求的action只有用到id作为参数而已
只能说明2点,第一 根本没找到这个方法;第二 或者说在这执行之前被别的js或什么先执行了,可能是根据ID或什么自动执行的js抢先执行了。
直接 alert("参数:"); 其他的先注释掉。
alert("参数:"+id);
//$.ajax({
//url:"/MyStoraneManage/stockIn_ajaxLoad.action",
//type:"POST",
//data:{id:id},
//dataType:"json",
//success:function(data){alert(data)}
//});
alert("发送请求);
}
改成这样了,还是不行,警告框也弹不出来
快被搞晕了
alert("参数:"+id);
//$.ajax({
//url:"/MyStoraneManage/stockIn_ajaxLoad.action",
//type:"POST",
//data:{id:id},
//dataType:"json",
//success:function(data){alert(data)}
//});
alert("发送请求);
}
改成这样了,还是不行,警告框也弹不出来
快被搞晕了
把这个onclick 代码也贴出来,
alert("参数:"+id);
//$.ajax({
//url:"/MyStoraneManage/stockIn_ajaxLoad.action",
//type:"POST",
//data:{id:id},
//dataType:"json",
//success:function(data){alert(data)}
//});
alert("发送请求);
}
改成这样了,还是不行,警告框也弹不出来
快被搞晕了
把这个onclick 代码也贴出来,
我把jsp贴出来,你们帮我看看吧
<script type="text/javascript">
$(document).ready(function(){
Administry.setup();
$("#tabs, #tabs2").tabs();
/* progress bar animations - setting initial values */
Administry.progress("#progress1", 10, 100);
Administry.progress("#progress2", 25, 100);
Administry.progress("#progress3", 50, 100);
/* <video> support for older browsers through flash player embedding */
Administry.videoSupport('video-flash', 'video/video.f4v', 320, 240);
});
function clickbtn(){
alert("参数:");
$.ajax({
url:"/MyStoraneManage/stockIn_ajaxLoad.action",
type:"POST",
data:{id:$('#ck').attr('value')},
dataType:"json",
success:function(data){alert(data)}
});
alert("发送请求);
}
function alert_del() {
var msg = "您真的确定要删除吗?\n\n请确认!";
if (confirm(msg)==true){
return true;
}
else return false;
}
function dictsel(){
window.location.href="/MyStoraneManage/stockIn_page.action";
}
function pgsel(){
document.pgform.submit();
}
function submitform()
{
document.pgform.action="/MyStoraneManage/stockIn_page.action";
document.pgform.submit();
}
//批量删除
function delchecked(){
//函数调用,获取选中id,所组成的字符串
ids = getSelectCheckboxValues();
if(ids !=null && ids != ""){
if(confirm("删除的数据将无法恢复,确认删除?")) {
window.location.href='stockIn_delChecked.action?ids='+ids;
}
}else{
alert("请至少选择一行!");
}
}
//选中id,组成的字符串
function getSelectCheckboxValues(){
//获取名称为ck的checkbox,形成数组
var objArray = document.getElementsByName('ck');
//定义返回结果
var result ='';
for (var i=0;i<objArray.length;i++){
//如果名称为ck的checkbox被选中了,就进行id拼接
if (objArray[i].checked==true){
result += objArray[i].value+",";
}
}
//返回拼接结果,之所以截取到 result.length-1,因为result结果最后一个字符是,
return result.substring(0, result.length-1);
}
//全选
function selAll(){
for(i=0;i<document.pgform.ck.length;i++){
if(!document.pgform.ck[i].checked){
document.pgform.ck[i].checked=true;
}
}
}
//取消
function noSelAll(){
for(i=0;i<document.pgform.ck.length;i++){
if(document.pgform.ck[i].checked){
document.pgform.ck[i].checked=false;
}
}
}
//checkbox选择全部,或不选择
function selectAllOrNo(){
n=n+1;
if(n%2==0){
selAll();
}else{
noSelAll();
}
}
//反选
function selOther(){
for(i=0;i<document.pgform.ck.length;i++){
if(document.pgform.ck[i].checked){
document.pgform.ck[i].checked=false;
}else{
document.pgform.ck[i].checked=true;
}
}
}
</script>
</style>
</head>
<body>
<div id="page">
<!-- Wrapper -->
<div class="wrapper">
<!-- Left column/section -->
<section class="column width6 first">
<h3>所有入库订单列表</h3>
<span class="subtitle">
<form action="stockIn_page.action" method="post" name="pgform">
<table>
<tr>
<th>订单编号</th>
<td><input type="text" name="stockin.inid" value="${stockin.inid}" size="5" /></td>
<th>商品编号</th>
<td><input type="text" name="stockin.gepc" value="${stockin.gepc}" size="10"/></td>
<th>客户编号</th>
<td><input type="text" name="stockin.guestid" value="${stockin.guestid}" size="10"/></td>
<td> <input class="btn btn-red" type="submit" onclick="submitform()"></td>
<td> <input class="btn btn-green" type="reset" onclick="javascript:document.pgform.reset()"></td>
</tr>
</table>
</span>
<hr/>
<table class="stylized full" id="t" >
<thead>
<tr>
<th width="3%">
<input type="checkbox" name="checkbox" id="checkbox" onclick="selectAllOrNo();"/></th>
<th>订单编号</th>
<th>商品编号</th>
<th>商品名称</th>
<th>经手人</th>
<th>客户</th>
<th>数量</th>
<th>是否处理</th>
<th>其他操作</th>
</tr>
</thead>
<c:forEach items="${page.data}" var="stockins" varStatus="c">
<tbody>
<tr onmouseover="this.style.backgroundColor='#FFF68F'" onmouseout="this.style.backgroundColor='#FAFAFA'" >
<td width="3%"><input type="checkbox" name="ck" id="ck" value="${stockins.id}"/></td>
<td><a href="/MyStoraneManage/stockIn_showStockInItemsByinid.action?inid=${stockins.inid}">${stockins.inid}</a></td>
<td>${stockins.gepc}</td>
<td>${stockins.gname}</td>
<td>${stockins.uid}</td>
<td>${stockins.guestid}</td>
<td>${stockins.sumin}</td>
<td>
<c:if test="${stockins.flag==0}">未处理</c:if>
<c:if test="${stockins.flag==1}">已处理</c:if>
</td>
<td>
<c:if test="${stockins.flag==0}">
<a href="/MyStoraneManage/stockIn_delStockInId.action?id=${stockins.id}" class="btn" onclick="javascript:return alert_del()"><span class="icon icon-cancel"> </span>删除</a>
<a href="/MyStoraneManage/stockIn_getOneStockIn.action?id=${stockins.id}" class="btn"><span class="icon icon-add"> </span>编辑</a>
</c:if>
<c:if test="${stockins.flag==1}">
<button class="btn" onclick="clickbtn();"><span class="icon icon-ok"> </span>详情</button>
</c:if>
</td>
</tr>
</c:forEach>
</tbody>
<tfoot>
<tr>
<td colspan="9">
<div class="pager">
共<font color="blue">${page.totalcount}</font>条记录 每页<input value="${page.pagesize}" size="2" name="pSize" />条
第<font color="blue">${page.currentPage}</font>页/共<font color="blue">${page.totalPage}</font>页
<a href="stockIn_page.action?pnum=1&pSize=${page.pagesize}&stockin.inid=${stockin.inid}&stockin.gepc=${stockin.gepc}&stockin.guestid=${stockin.guestid}">第一页</a>
<a href="stockIn_page.action?pnum=${page.prePage}&pSize=${page.pagesize}&stockin.inid=${stockin.inid}&stockin.gepc=${stockin.gepc}&stockin.guestid=${stockin.guestid}" >上一页</a>
<a href="stockIn_page.action?pnum=${page.nextPage}&pSize=${page.pagesize}&stockin.inid=${stockin.inid}&stockin.gepc=${stockin.gepc}&stockin.guestid=${stockin.guestid}" >下一页</a>
<a href="stockIn_page.action?pnum=${page.totalPage}&pSize=${page.pagesize}&stockin.inid=${stockin.inid}&stockin.gepc=${stockin.gepc}&stockin.guestid=${stockin.guestid}" >最后一页</a>
转到<input name="pnum" value="${page.currentPage}" id="pnum" size="2" />
<button onclick="pgsel();" type="submit">GO</button>
</div>
</form>
</td>
</tr>
</tfoot>
</table>
<span class="subtitle">
<input class="btn btn-red" type="button" value="全选" onclick="selAll();"/>
<input class="btn btn-green" type="button" value="反选" onclick="selOther();"/>
<input class="btn btn-blue" type="button" value="取消" onclick="noSelAll();"/>
<input class="btn btn-red" type="button" value="删除" onclick="delchecked();"/>
<input class="btn btn-green" type="button" value="增加" onclick="selOther();"/>
</span>
<hr/>
2:还原最简化,改成最简单的<button onclick="clickbtnGet()"> 看能不能执行alert。
alert("参数:"+id);
//$.ajax({
//url:"/MyStoraneManage/stockIn_ajaxLoad.action",
//type:"POST",
//data:{id:id},
//dataType:"json",
//success:function(data){alert(data)}
//});
alert("发送请求);
}
改成这样了,还是不行,警告框也弹不出来
快被搞晕了
把这个onclick 代码也贴出来,
我把jsp贴出来,你们帮我看看吧
<script type="text/javascript">
$(document).ready(function(){
Administry.setup();
$("#tabs, #tabs2").tabs();
/* progress bar animations - setting initial values */
Administry.progress("#progress1", 10, 100);
Administry.progress("#progress2", 25, 100);
Administry.progress("#progress3", 50, 100);
/* <video> support for older browsers through flash player embedding */
Administry.videoSupport('video-flash', 'video/video.f4v', 320, 240);
});
function clickbtn(){
alert("参数:");
$.ajax({
url:"/MyStoraneManage/stockIn_ajaxLoad.action",
type:"POST",
data:{id:$('#ck').attr('value')},
dataType:"json",
success:function(data){alert(data)}
});
alert("发送请求);
}
function alert_del() {
var msg = "您真的确定要删除吗?\n\n请确认!";
if (confirm(msg)==true){
return true;
}
else return false;
}
function dictsel(){
window.location.href="/MyStoraneManage/stockIn_page.action";
}
function pgsel(){
document.pgform.submit();
}
function submitform()
{
document.pgform.action="/MyStoraneManage/stockIn_page.action";
document.pgform.submit();
}
//批量删除
function delchecked(){
//函数调用,获取选中id,所组成的字符串
ids = getSelectCheckboxValues();
if(ids !=null && ids != ""){
if(confirm("删除的数据将无法恢复,确认删除?")) {
window.location.href='stockIn_delChecked.action?ids='+ids;
}
}else{
alert("请至少选择一行!");
}
}
//选中id,组成的字符串
function getSelectCheckboxValues(){
//获取名称为ck的checkbox,形成数组
var objArray = document.getElementsByName('ck');
//定义返回结果
var result ='';
for (var i=0;i<objArray.length;i++){
//如果名称为ck的checkbox被选中了,就进行id拼接
if (objArray[i].checked==true){
result += objArray[i].value+",";
}
}
//返回拼接结果,之所以截取到 result.length-1,因为result结果最后一个字符是,
return result.substring(0, result.length-1);
}
//全选
function selAll(){
for(i=0;i<document.pgform.ck.length;i++){
if(!document.pgform.ck[i].checked){
document.pgform.ck[i].checked=true;
}
}
}
//取消
function noSelAll(){
for(i=0;i<document.pgform.ck.length;i++){
if(document.pgform.ck[i].checked){
document.pgform.ck[i].checked=false;
}
}
}
//checkbox选择全部,或不选择
function selectAllOrNo(){
n=n+1;
if(n%2==0){
selAll();
}else{
noSelAll();
}
}
//反选
function selOther(){
for(i=0;i<document.pgform.ck.length;i++){
if(document.pgform.ck[i].checked){
document.pgform.ck[i].checked=false;
}else{
document.pgform.ck[i].checked=true;
}
}
}
</script>
</style>
</head>
<body>
<div id="page">
<!-- Wrapper -->
<div class="wrapper">
<!-- Left column/section -->
<section class="column width6 first">
<h3>所有入库订单列表</h3>
<span class="subtitle">
<form action="stockIn_page.action" method="post" name="pgform">
<table>
<tr>
<th>订单编号</th>
<td><input type="text" name="stockin.inid" value="${stockin.inid}" size="5" /></td>
<th>商品编号</th>
<td><input type="text" name="stockin.gepc" value="${stockin.gepc}" size="10"/></td>
<th>客户编号</th>
<td><input type="text" name="stockin.guestid" value="${stockin.guestid}" size="10"/></td>
<td> <input class="btn btn-red" type="submit" onclick="submitform()"></td>
<td> <input class="btn btn-green" type="reset" onclick="javascript:document.pgform.reset()"></td>
</tr>
</table>
</span>
<hr/>
<table class="stylized full" id="t" >
<thead>
<tr>
<th width="3%">
<input type="checkbox" name="checkbox" id="checkbox" onclick="selectAllOrNo();"/></th>
<th>订单编号</th>
<th>商品编号</th>
<th>商品名称</th>
<th>经手人</th>
<th>客户</th>
<th>数量</th>
<th>是否处理</th>
<th>其他操作</th>
</tr>
</thead>
<c:forEach items="${page.data}" var="stockins" varStatus="c">
<tbody>
<tr onmouseover="this.style.backgroundColor='#FFF68F'" onmouseout="this.style.backgroundColor='#FAFAFA'" >
<td width="3%"><input type="checkbox" name="ck" id="ck" value="${stockins.id}"/></td>
<td><a href="/MyStoraneManage/stockIn_showStockInItemsByinid.action?inid=${stockins.inid}">${stockins.inid}</a></td>
<td>${stockins.gepc}</td>
<td>${stockins.gname}</td>
<td>${stockins.uid}</td>
<td>${stockins.guestid}</td>
<td>${stockins.sumin}</td>
<td>
<c:if test="${stockins.flag==0}">未处理</c:if>
<c:if test="${stockins.flag==1}">已处理</c:if>
</td>
<td>
<c:if test="${stockins.flag==0}">
<a href="/MyStoraneManage/stockIn_delStockInId.action?id=${stockins.id}" class="btn" onclick="javascript:return alert_del()"><span class="icon icon-cancel"> </span>删除</a>
<a href="/MyStoraneManage/stockIn_getOneStockIn.action?id=${stockins.id}" class="btn"><span class="icon icon-add"> </span>编辑</a>
</c:if>
<c:if test="${stockins.flag==1}">
<button class="btn" onclick="clickbtn();"><span class="icon icon-ok"> </span>详情</button>
</c:if>
</td>
</tr>
</c:forEach>
</tbody>
<tfoot>
<tr>
<td colspan="9">
<div class="pager">
共<font color="blue">${page.totalcount}</font>条记录 每页<input value="${page.pagesize}" size="2" name="pSize" />条
第<font color="blue">${page.currentPage}</font>页/共<font color="blue">${page.totalPage}</font>页
<a href="stockIn_page.action?pnum=1&pSize=${page.pagesize}&stockin.inid=${stockin.inid}&stockin.gepc=${stockin.gepc}&stockin.guestid=${stockin.guestid}">第一页</a>
<a href="stockIn_page.action?pnum=${page.prePage}&pSize=${page.pagesize}&stockin.inid=${stockin.inid}&stockin.gepc=${stockin.gepc}&stockin.guestid=${stockin.guestid}" >上一页</a>
<a href="stockIn_page.action?pnum=${page.nextPage}&pSize=${page.pagesize}&stockin.inid=${stockin.inid}&stockin.gepc=${stockin.gepc}&stockin.guestid=${stockin.guestid}" >下一页</a>
<a href="stockIn_page.action?pnum=${page.totalPage}&pSize=${page.pagesize}&stockin.inid=${stockin.inid}&stockin.gepc=${stockin.gepc}&stockin.guestid=${stockin.guestid}" >最后一页</a>
转到<input name="pnum" value="${page.currentPage}" id="pnum" size="2" />
<button onclick="pgsel();" type="submit">GO</button>
</div>
</form>
</td>
</tr>
</tfoot>
</table>
<span class="subtitle">
<input class="btn btn-red" type="button" value="全选" onclick="selAll();"/>
<input class="btn btn-green" type="button" value="反选" onclick="selOther();"/>
<input class="btn btn-blue" type="button" value="取消" onclick="noSelAll();"/>
<input class="btn btn-red" type="button" value="删除" onclick="delchecked();"/>
<input class="btn btn-green" type="button" value="增加" onclick="selOther();"/>
</span>
<hr/>
测试最简的可以 ,
直接把class 换了,或者不用class,直接调用呗。
alert("参数:"+id);
//$.ajax({
//url:"/MyStoraneManage/stockIn_ajaxLoad.action",
//type:"POST",
//data:{id:id},
//dataType:"json",
//success:function(data){alert(data)}
//});
alert("发送请求);
}
改成这样了,还是不行,警告框也弹不出来
快被搞晕了
测试最简的可以 , 什么意思??