- 浏览: 677910 次
- 性别:
- 来自: 北京
最新评论
-
mushiyu123:
...
iText官方教程 -
sf_dream:
楼主,你那个放到没有安装jdk的电脑上可以运行不?
eclipse导出jar文件再将它转换成exe可执行文件详解 -
zqb666kkk:
哥们 没图了 弄个附件 文档 供我们下载吧
PowerDesigner 使用教程(很具体,很实用) -
dhkswh:
楼主写的代码超级多错...不过总算看懂了,楼主是class.A ...
java swing 弹出对话框与父窗口传值实例
jquery--ajax实例(配置是重点)
package org.lsy.test.ajax.action; import java.io.PrintWriter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts2.ServletActionContext; import org.lsy.test.ajax.service.AjaxService; import org.lsy.test.ajax.service.AjaxServiceImpl; import org.rd.framework.common.container.ContainerManager; import org.rd.framework.struts.action.BodyListAction; import org.rd.framework.struts.action.CommonAction; import org.rd.framework.util.ContextUtil; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; public class CompareDateAction extends CommonAction { // private AjaxService ajaxService = (AjaxService)ContainerManager.getComponent(AjaxService.AJAX_BEAN_ID); private AjaxServiceImpl ajaxService = new AjaxServiceImpl(); private String result; public String execute() throws Exception{ return SUCCESS; } public String isRightDate() throws Exception{ //ContextUtil.put("dd","df", ContextUtil.SCOPE_SESSION); // ActionContext ctx = ActionContext.getContext(); // HttpServletRequest req=(HttpServletRequest)ctx.get(ServletActionContext.HTTP_REQUEST); // HttpServletResponse resp=(HttpServletResponse)ctx.get(ServletActionContext.HTTP_RESPONSE); HttpServletRequest req=ServletActionContext.getRequest(); HttpServletResponse resp=ServletActionContext.getResponse(); resp.setContentType("text/xml"); req.setCharacterEncoding("UTF-8"); resp.setCharacterEncoding("UTF-8"); PrintWriter pw = resp.getWriter(); String whichdate= ""; String datefrom = ""; String dateto = ""; if(req.getParameter("datefrom")!=null){ datefrom=req.getParameter("datefrom").toString(); } if(req.getParameter("dateto")!=null){ dateto=req.getParameter("dateto").toString(); } if(req.getParameter("whichdate")!=null){ whichdate=req.getParameter("whichdate").toString(); } //"[{'jj':'jjaa'}]" if(datefrom.trim().equals("")||dateto.trim().equals("")){ pw.println("Y"); }else if(ajaxService.isRightDate(datefrom, dateto)){ pw.println("Y"); }else{ if(whichdate.trim().equals("from")){ pw.println("N1"); }else if(whichdate.trim().equals("to")){ pw.println("N2"); } } return NONE; } public String getResult() { return result; } public void setResult(String result) { this.result = result; } }
package org.lsy.test.ajax.service; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import org.rd.framework.dao.impl.CommonServiceImpl; public class AjaxServiceImpl extends CommonServiceImpl implements AjaxService{ /** * 判断第一个日期是否小于等于第二个日期 */ public boolean isRightDate(String datefrom,String dateto){ boolean flag=false; SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); Date date1=null; Date date2=null; try { date1=sdf.parse(datefrom); date2=sdf.parse(dateto); } catch (ParseException e) { e.printStackTrace(); } System.out.println("date1--"+date1.getTime()+"--date2--"+date2.getTime()); flag=(date1.getTime()<=date2.getTime()); return flag; } }
package org.lsy.test.ajax.service; import java.util.List; import org.lsy.test.work.model.Work; public interface AjaxService { public static final String AJAX_BEAN_ID = "ajaxService"; public boolean isRightDate(String datefrom,String dateto); }
<%@ page contentType="text/html; charset=UTF-8"%> <%@ taglib uri="/WEB-INF/crm_taglist.tld" prefix="crm"%> <%@ taglib uri="/WEB-INF/component.tld" prefix="cx"%> <%@ taglib uri="/struts-tags" prefix="s"%> <%@ page import="java.util.*,org.lsy.test.work.model.Work"%> <% String path = request.getContextPath(); String basepath=request.getScheme()+"://"+ request.getServerName()+":"+request.getServerPort()+ request.getContextPath()+"/"; %> <input type="hidden" id="basepath" value="<%=basepath %>" /> <script src="<%=basepath %>work/jquery-1.7.1.min.js"></script> <%-- --%> <!-- data start --> <script src="<%=basepath %>work/ui/jquery.ui.core.js"></script> <script src="<%=basepath %>work/ui/jquery.ui.widget.js"></script> <script src="<%=basepath %>work/ui/jquery.ui.datepicker.js"></script> <link rel="stylesheet" href="<%=basepath %>work/themes/base/jquery.ui.all.css"> <link rel="stylesheet" href="<%=basepath %>work/demos/demos.css"> <!-- data end --> <!-- tabs start --> <link rel="stylesheet" href="<%=basepath %>work/themes/base/jquery.ui.all.css"> <script src="<%=basepath %>work/ui/jquery.ui.tabs.js"></script> <!-- tabs end --> <script> $(function() { $( "#reviewdate" ).datepicker({ showOn: "button", buttonImage: "<%=basepath %>work/demos/images/calendar.gif", buttonImageOnly: true }); $( "#reviewdate" ).datepicker( "option", "dateFormat", 'yy-mm-dd'); }); $(function() { $( "#reviewdatefrom" ).datepicker({ showOn: "button", buttonImage: "<%=basepath %>work/demos/images/calendar.gif", buttonImageOnly: true }); $( "#reviewdatefrom" ).datepicker( "option", "dateFormat", 'yy-mm-dd'); }); $(function() { $( "#reviewdateto" ).datepicker({ showOn: "button", buttonImage: "<%=basepath %>work/demos/images/calendar.gif", buttonImageOnly: true }); $( "#reviewdateto" ).datepicker( "option", "dateFormat", 'yy-mm-dd'); }); ////////////////////////////////////////// $(function() { $( "#tabsquery" ).tabs({ collapsible: true }); }); ////////////////////////////////////////// ////////////////////////////////////////// </script> <% List res=new ArrayList(); if(session.getAttribute("worklist")!=null){ res=(ArrayList)session.getAttribute("worklist"); } %> <input type="hidden" id="thelen" value="" /> <input type="hidden" id="" value="" /> <input type="hidden" id="" value="" /> <table> <tr width="100%"> <td width="50%"> <table border="1"> <tr> <td> <form id="lsy_test_work" name="lsy_test_work" method="post" action=""> <!-- 查询区 start --> <div class="demo"> <div id="tabsquery"> <ul> <li><a href="tabsquery-1">关闭查询区</a></li> </ul> <div id="tabsquery-1"> <p><strong>打开查询区</strong>11</p> <p>22 <table> <tr> <td> 作业标题:<input type="text" id="worktitle" value=""/><br> 老师:<input type="text" id="teacher" value=""/><br> 课程名称:<input type="text" id="course" value=""><br> 学生姓名:<input type="text" id="student" value=""><br> 批改日期:从<input type="text" id="reviewdatefrom" value=""><br> 到:<input type="text" id="reviewdateto" value=""><br> <br> <input type="button" onclick="querywork()" value="查询"/> </td> </tr> </table> </p> </div> </div> </div><!-- End demo --> <!-- 查询区 end --> </form> </td> </tr> <tr> <td> <table id="maindatatable" border="1"> <tr> <th>作业标题</th> <th>老师 </th> <th>课程名称</th> <th>内容</th> <th>学生姓名</th> <th>班级名称</th> <th>id</th> </tr> <% if(res!=null){ for(int i=0;i<res.size();i++){ Work ww=(Work)res.get(i); %> <tr onclick="f1(<%=i+1%>)"> <td><%=ww.getWorktitle() %></td> <td><%=ww.getTeacher() %></td> <td><%=ww.getCourse() %></td> <td><%=ww.getWorkcontent() %></td> <td><%=ww.getStudent() %></td> <td><%=ww.getClassname() %></td> <td><%=ww.getId() %></td> </tr> <%} }%> </table> </td> </tr> </table> </td> <td> <table> <form name="addform" id="addform" action="<%=path%>/work/addwork.action" method=post> <table> <tr> <td width="30%" align="right">作业标题:</td> <td><input type="text" id="eworktitle" name="work.worktitle" value=""></td> <td width="30%" align="right">老师:</td> <td><input type="text" id="eteacher" name="work.teacher" value=""></td> </tr> <tr> <td width="30%" align="right">课程名称:</td> <td><input type="text" id="ecourse" name="work.course" value=""></td> <td width="30%" align="right">内容:</td> <td><input type="text" id="eworkcontent" name="work.workcontent" value=""></td> </tr> <tr> <td width="30%" align="right">学生姓名:</td> <td><input type="text" id="estudent" name="work.student" value=""></td> <td width="30%" align="right">班级名称:</td> <td><input type="text" id="eclassname" name="work.classname" value=""></td> </tr> <tr> <td width="30%" align="right">批改日期:</td> <td><input type="text" id="reviewdate" value=""></td> <td width="30%" align="right"></td> <td></td> </tr> <tr> <td width="30%" align="right"></td> <td><input type="button" id="exinzeng" onclick="addwork()" value="新增"></td> <td><input type="button" id="exinzeng" onclick="delwork()" value="删除"></td> <td><input type="button" id="eedit" onclick="editwork()" value="提交修改"></td> </tr> <input type="hidden" id="eid" value="" /> </table> </form> </table> </td> </tr> </table> <% String actiontype=""; if(request.getAttribute("actiontype")!=null){ actiontype=(String)request.getAttribute("actiontype"); } %> <input type="hidden" id="actiontype" value="<%=actiontype %>" /> <script> //var basepath=$("#basepath").val(); var basepath=document.getElementById("basepath").value; //alert(basepath); var len = $("#maindatatable tr td").length; var thelen=len/6; function f1(rownum){ //alert("dddddd"); var str="#maindatatable tr:eq("+rownum+")"; document.getElementById("eid").value=$("#maindatatable tr:eq("+rownum+")").children().eq(6).html(); document.getElementById("eworktitle").value=$("#maindatatable tr:eq("+rownum+")").children().eq(0).html(); document.getElementById("eteacher").value=$("#maindatatable tr:eq("+rownum+")").children().eq(1).html(); document.getElementById("ecourse").value=$("#maindatatable tr:eq("+rownum+")").children().eq(2).html(); document.getElementById("eworkcontent").value=$("#maindatatable tr:eq("+rownum+")").children().eq(3).html(); document.getElementById("estudent").value=$("#maindatatable tr:eq("+rownum+")").children().eq(4).html(); document.getElementById("eclassname").value=$("#maindatatable tr:eq("+rownum+")").children().eq(5).html(); //alert($("#maindatatable tr:eq(1)").children().eq(1).html()); //alert($("#maindatatable tr:eq(1)").children().eq(2).html()); //alert($("#maindatatable tr:eq(1)").children().eq(3).html()); //alert($("#maindatatable tr:eq(1)").children().eq(4).html()); //alert($("#maindatatable tr:eq(1)").children().eq(5).html()); //alert($("#maindatatable tr:eq(1)").children().eq(6).html()); //alert($(this).html()); //alert($(this).text()); } function addwork(){ var eworktitle=document.getElementById("eworktitle").value; var eteacher=document.getElementById("eteacher").value; var ecourse=document.getElementById("ecourse").value; var eworkcontent=document.getElementById("eworkcontent").value; var estudent=document.getElementById("estudent").value; var eclassname=document.getElementById("eclassname").value; /*var url=basepath+"work/addwork.do?worktitle="+eworktitle+ "&teacher="+eteacher+ "&course="+ecourse+ "&workcontent="+eworkcontent+ "&student="+estudent+ "&classname="+eclassname;*/ //document.getElementById("tt").value=url; //window.location.href=url; document.addform.submit(); } function delwork(){ var worktitle=document.getElementById("eworktitle").value; var teacher=document.getElementById("eteacher").value; var course=document.getElementById("ecourse").value; var student=document.getElementById("estudent").value; var workcontent=document.getElementById("eworkcontent").value; var classname=document.getElementById("eclassname").value; var id=document.getElementById("eid").value; var url=basepath+"work/delwork.action?worktitle="+worktitle+ "&teacher="+teacher+ "&course="+course+ "&student="+student+ "&workcontent="+workcontent+ "&classname="+classname+ "&id="+id; //alert("del--"+url); window.location.href=url; } function editwork(){ var worktitle=document.getElementById("eworktitle").value; var teacher=document.getElementById("eteacher").value; var course=document.getElementById("ecourse").value; var student=document.getElementById("estudent").value; var workcontent=document.getElementById("eworkcontent").value; var classname=document.getElementById("eclassname").value; var id=document.getElementById("eid").value; var url=basepath+"work/editwork.action?worktitle="+worktitle+ "&teacher="+teacher+ "&course="+course+ "&student="+student+ "&workcontent="+workcontent+ "&classname="+classname+ "&id="+id; window.location.href=url; } function querywork(){ var worktitle=document.getElementById("worktitle").value; var teacher=document.getElementById("teacher").value; var course=document.getElementById("course").value; var student=document.getElementById("student").value; var url=basepath+"work/querywork.action?worktitle="+worktitle+ "&teacher="+teacher+ "&course="+course+ "&student="+student; //alert("查询--"+url); window.location.href=url; } var actiontype=document.getElementById("actiontype").value; if(actiontype=='otherquery'){ var url=basepath+"work/querywork.action"; window.location.href=url; } //////////////////////////////////////////////// $(document).ready(function(){ //hideCol(1);//隐藏第二列 //$('table td').find('td:eq(1)').hide(); //$('table tr').find('td:eq(1)').hide(); //$('#maindatatable td').find('td:eq(0)').hide(); //$('#maindatatable tr').find('td:eq(0)').hide(); var len = $("#maindatatable tr td").length; var thelen=len/6; //var len = $("#mm tr td").length; //alert(len/6); //alert("表行数"+thelen); $("#thelen").val(thelen); $("#reviewdatefrom").change( function () { var date1=$("#reviewdatefrom").val(); var date2=$("#reviewdateto").val(); var url=basepath+"ajaxutil/isrightdate.action?datefrom="+date1+ "&dateto="+date2+"&whichdate=from"; alert($("#reviewdatefrom").val()+"\r"+url); jQuery.ajax( { url:url, type:'post', async:false, dataType: 'text', //data:'sql='+'hkhkhhhkhk', success:function(result){ //var tt=eval('('+result+')'); var ff=$.trim(result); if('Y'==ff){ }else if(ff=='N1'){ alert("批改日期范围不正确"); $("#reviewdatefrom").val(""); }else if(ff=='N2'){ alert("批改日期范围不正确"); $("#reviewdateto").val(""); } } }); });//end blur $("#reviewdateto").change( function () { var date1=$("#reviewdatefrom").val(); var date2=$("#reviewdateto").val(); var url=basepath+"ajaxutil/isrightdate.action?datefrom="+date1+ "&dateto="+date2+"&whichdate=to"; alert($("#reviewdateto").val()+"\r"+url); $.post(url, function(result){ var ff=$.trim(result); if('Y'==ff){ }else if(ff=='N1'){ alert("批改日期范围不正确"); $("#reviewdatefrom").val(""); }else if(ff=='N2'){ alert("批改日期范围不正确"); $("#reviewdateto").val(""); } } ,'text');//end get });//end blur });//end ready ///////////////////////////////////////// </script>
struts:
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <package name="ajaxutil" extends="struts-default" namespace="/ajaxutil"> <!-- ajaxutil begin --> <action name="isrightdate" class="org.lsy.test.ajax.action.CompareDateAction" method="isRightDate"> </action> <!-- ajaxutil end --> </package> </struts>
spring:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"> <bean id="workService" parent="transactionProxyTemplate"> <property name="target"> <bean class="org.lsy.test.ajax.service.AjaxServiceImpl"> <property name="sessionFactory"> <ref bean="sessionFactory"/> </property> </bean> </property> <property name="proxyInterfaces"> <value>org.lsy.test.ajax.service.AjaxService</value> </property> </bean> </beans>
相关推荐
这是一个学习jquery-ajax的实例,实例中应用到了bean -json的转化, 页面上应用到了jqury如何解析返回的json数据。
jQuery-Ajax实例应用 介绍jquery-ajax中几种主要方法的应用
spring整个流程配置测试正常,前台JSP页面使用jQuery中的Ajax提交至后台的简单实例项目。导入到myeclipse中,部署在tomcat后直接运行即可。
支持上传多个文档Ajax 开发实例, Chrome上传多个没问题,但IE上传会出现错误 序列化类型为“System.Collections.Generic.LinkedListNode`1[[ViewDataUploadFilesResult, App_Web_5x24fddx, Version=0.0.0.0, ...
其中包含6款Ajax分页Demo,文字分页、图片分页都可以。具有一定特效、很炫。基本已经满足各种web分页开发了。
可以轻松实现可编辑表格,还可以自己通过AJAX同步更新到后台
jquery ajax实例点击按钮触发Ajax loading jquery ajax实例点击按钮触发Ajax loading jquery ajax实例点击按钮触发Ajax loading
jQuery Form Plugin能够让你简洁的将以HTML形式提交的表单升级成采用AJAX技术提交的表单。 插件里面主要的方法, ajaxForm和ajaxSubmit,能够从form组件里采集信息确定如何处理表单的提交过程。 两个方法都支持众多的...
内容索引:脚本资源,jQuery,jQueryUI,滑动门,选项卡 jquery-ui.custom实例集,是一个运用jquery可视化ui设计的应用实例集,实例集中包括大家常用的滑动门、折叠菜单、图层控制、选项卡、进度条、提示窗口、拖动条...
基于JQuery框架的AJAX实例代码 $.ajax $.post $.get 三种方式传递参数
今天给大家分享一下,如何使用Ajax异步获取手机号码归属地,代码中使用了淘宝的接口,保证了归属地数据的及时更新。
PHP jQuery 可拖动的Ajax购物车实例,带有提示功能的商品展示 ,用鼠标拖动商品到购物车中,即可选中商品,购物车程序可根据 拖入的产品数量进行统计,自动给出价格。同时对不满意的商品, 可随时从购物车中移除...
jQuery Ajax 实例 全解析; jQuery Ajax 实例 全解析;
在VS环境下使用。C#代码。这是我总结的js和JQUERY使用ajax调用webservice和ashx(一般处理程序)的代码。还有使用AjaxPro第三方控件的使用的练习。
jquery 文本框 自动补全 ajax autocomplete 完整实例
jquery中ajax的用法实例 关于Jquery异步刷新的代码实例
Vs2005C#下使用Jquery实现的Ajax简单实例
ajax jquery demo 实例 很多很好很强大
基于jquery的ajax功能,对ASP网站的数据库进行无刷新操作,包括对数据库内容进行添加,删除,修改,分页