|
一、使用WeX5_V3.5,学习“WeX5视频教程\外卖案例视频教程操作\第四讲 开发我的信息页.mp4”时,按照视频操作,单击“保存”,提示
二、js代码
define(function(require){
var $ = require("jquery");
var justep = require("$UI/system/lib/justep");
var Model = function(){
this.callParent();
this.userid;
this.loadUser=true;
};
Model.prototype.modelLoad = function(event){
this.userid="userid1";
this.comp("userData").setFilter("filter1", "fID='"+this.uerid+"'");
};
Model.prototype.loadUserData = function(){
if(this.loadUser){
var userData=this.comp("userData");
userData.refreshData();
if(userData.getCount()==0){
userData.newData({
defaultValues:[{
"fID":this.userID,
"fName":"新用户"
}]
})
}
this.loadUser=false;
}
};
Model.prototype.ownContentActive = function(event){
this.loadUserData();
};
Model.prototype.carContentActive = function(event){
this.loadUserData();
};
Model.prototype.button8Click = function(event) {
this.comp("userData").saveData({
"onSuccess" : function() {
justep.Util.hint("保存成功");
}
})
};
Model.prototype.getImgUrl = function(imgUrl){
return require.toUrl("./img/"+imgUrl);
};
Model.prototype.buyBtnClick = function(event){
var frow=event.bindingContext.$object;
var frows=this.comp("carData").find(["fID"], [frow.getID()]);
if(frows.length == 0)
{
this.comp("carData").newData({
defaultValues : [ {
"fid" : frow.getID(),
"fname" : frow.val("fName"),
"fprice" : frow.val("fPrice"),
"fcount" : 1
} ]
})
}
else
{
frows[0].val("fcount",frows[0].val("fcount")+1);
}
};
Model.prototype.AddBtnClick = function(event){
var frow=event.bindingContext.$object;
frow.val("fcount",frow.val("fcount")+1);
};
Model.prototype.SubBtnClick = function(event){
var frow = event.bindingContext.$object;
if (frow.val("fcount") > 0)
frow.val("fcount", frow.val("fcount") - 1);
};
return Model;
});
三、控制台tomcat日志
2016-09-01 18:29:59 SQL执行失败,com.mysql.jdbc.JDBC4PreparedStatement@3ed509: INSERT INTO takeout_user (fID,fAddress,fName,fPhoneNumber) VALUES (null,'鹏龙','新用户','185')
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'fID' cannot be null
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:400)
at com.mysql.jdbc.Util.getInstance(Util.java:383)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:973)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3847)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3783)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2447)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2594)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2545)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1901)
at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1193)
at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
at com.justep.baas.data.DataUtils.saveData(Unknown Source)
at com.justep.baas.data.DataUtils.saveData(Unknown Source)
at com.justep.baas.action.CRUD.save(Unknown Source)
at foodorder.User__do.saveTakeout_user(User__do.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.justep.baas.action.Engine.execAction(Unknown Source)
at com.justep.baas.action.Engine.execAction(Unknown Source)
at com.justep.baas.servlet.BaasServlet.execService(Unknown Source)
at com.justep.baas.servlet.BaasServlet.service(Unknown Source)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:745)
|
-
|