工作总结

设置延迟加载

setTimeout(“”,2000);//2s后加载
setTimeout(“window.opener.location.href=’${ctx}/oa/task/index.htm?type=todo&pmc=OA_TASK’;window.open(”,’_self’);window.close();”,2000);


400、405报错原因

浏览器直接访问url,报405。
get、post请求设置错误
表单字段和数据库字段不对应,如:


1.新增申请页面,value值没有的情况下,表单写${entity.project.impPlace}可能无法提交 2.name字段和数据库字段不对应

则报400。


form表单请求,ajax提交

form表单action=”url”,method 提交,提交按钮为button,
直接走form表单提交,不走js中的保存方法。a标签走保存方法,则可以使用ajax提交。

<!--form表单:-->
<form id="saveForm" name="saveForm" action="saveOutSide.htm" method="post">
<!--button按钮:-->
<button class="button" href="javascript:save()">保存</button>
<!--a标签:-->
<a href="javascript:save();" class="easyui-linkbutton">保存</a>
<!-input submit-->
<input type="submit" class="button" href="javascript:save()"value="保存"/>
<!--ajax请求:-->
if($("#inputForm").form("validate")) {
    $.ajax({ 
        url : "save.htm",
        type : "post",
        cache: false,
        async: false,
        data : $('#inputForm').serialize(),
        dataType : "json",
        success : function(resp) {
            if(resp.stat == 1) {                    
                if(type==1){
                    refresh(resp.data.id);
                }else if(type==2){
                    returnData = resp.data.id;
                    refresh(resp.data.id);
                }else{
                    returnData = resp.data.appId;
                }   
                $.messager.alert('温馨提示', resp.message, 'info');
            }else {
                $.messager.alert('温馨提示', '操作失败', 'info');
            }
        }
    });
}

报错:java - org.hibernate.TransientPropertyValueException: object references an unsaved transient instance - save the transient instance before flushing

级联问题:增加
targetEntity = Project.class, cascade = CascadeType.ALL

    @OneToOne(targetEntity = Project.class, cascade = CascadeType.ALL)
    @JoinColumn(name = "project_id")
    public Project getProject() {
        return project;
    }

    public void setProject(Project project) {
        this.project = project;
    }

数据库字段类型为timestamp,页面获取为string,保存报错

//增加注解@DateTimeFormat+格式
@DateTimeFormat(pattern="yyyy-MM-dd")
    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

浏览器status为canceled原因

status为canceled

$.ajax({
            url: "saveOutSide.htm",
            type: "post",
            cache: false,
            async: false,
            data: $("#saveForm").serialize(),
            dataType: "json",
            success: function (resp) {
                debugger;
                if (resp.stat == 1) {
                    if (type == 1) {
                        refresh(resp.data.id);
                    } else if (type == 2) {
                        returnData = resp.data.id;
                        refresh(resp.data.id);
                    } else {
                        returnData = resp.data.appId;
                    }
                    $.messager.alert('温馨提示', resp.message, 'info');
                } else {
                    $.messager.alert('温馨提示', '操作失败', 'info');
                }
            }
        });

ajax请求后台可以debug,且操作成功,不进success方法,查看浏览器 status为canceled,排查原因后发现,是跨域带来的问题,就是(一般是https)跟你发送请求时用的协议不一样,所以服务器为了安全,不允许你的请求到达服务器,就取消你的请求了。把两个协议改成一样就行了。因此,加上async: false,就可以了。


http://blog.csdn.net/s445320/article/details/50748975


一般表单的提交用的都是用button然后用ajax来提交,但是用button就不能触发HTML5的自带表单验证,用submit的话就又会直接提交表单。我百度了一下解决方法:

用submit来提交表单,然后在js中监听submit方法,用ajax提交表单最后阻止submit的自动提交。

 //ajax提交表单
    $("#inputForm").on("submit", function (ev) {
        $.ajax({
            url: "save.htm",
            type: "post",
            cache: false,
            async: false,
            data: $("#inputForm").serialize(),
            dataType: "json",
            success: function (resp) {
                if (resp.stat == 1) {
                    process(resp.data.appId);
                    refresh(resp.data.id);
                    alert(resp.message);
                } else {
                    alert('操作失败');
                }
            }
        });
        //阻止submit表单提交
        ev.preventDefault();
        //或者return false
        //return false;
    });

freemarker

1.循环list中的map
       //Java代码:  
    List list = new ArrayList();
    Map map1 = new HashMap();
    map1.put("phone", "13655555555");
    map1.put("email", "admin@vip.com");
    list.add(map1);
    Map map2 = new HashMap();
    map2.put("phone", "13888888888");
    map2.put("email", "china@vip.com");
    map2.put("address", "beijing");
    list.add(map2);

//test.ftl文件:
<#list list as map>
    <#list map?keys as itemKey>
         <#if itemKey="phone">
            Phone:${map[itemKey]}
         </#if>
         <#if itemKey="email">
            Email:${map[itemKey]}
         </#if>
    </#list>
</#list>
2.日期格式
<!--截取字符串长度 -->
<#if (userVO.cnname)?? &&     ((userVO.cnname)?length > 10) >  
    ${userVO.cnname?substring(0,10)}..   
<#else>  
    ${(userVO.cnname)!''}  
</#if>  
<!--显示boolean值 -->
<#assign foo=true/>  
${foo?string("yes", "no")}  
<!--格式化日期-->
${updated?string("yyyy-MM-dd HH:mm:ss")}    

海口上线问题总结

1.SecureCRT软件问题无法查看命令
2.服务器数据库与开发数据库不一致,需要改pom.xml。3.数据库需要更新,从开发数据库导出dmp然后备份生产环境数据库后,导入dmp文件

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值