3
回答
jfinal一个问题,不知道算不算BUG,

@JFinal

也不知道是不是我没弄明白,上代码:

Model层:

@SuppressWarnings("serial")
public class FjxcUsers extends Model<FjxcUsers>{
	/**
	 * 全局共享的,只能用于数据库查询,不能用于数据承载对象
	 */
	public static final FjxcUsers dao=new FjxcUsers();
	
	
	public FjxcGs getFjxcgs(){
		if(get("gsId")==null)return new FjxcGs().set("gsName", "asfasf");
		return FjxcGs.dao.findById(get("gsId"));
	}
}
Controller层:
FjxcUsers users=new FjxcUsers().login(getPara("loginId","a"),getPara("loginPwd","a"));
		if (users!=null) {
			users.set("gsName", users.getFjxcgs().getStr("gsName"));
}

异常:

2013-05-29 15:33:36
[ERROR]-[Thread: qtp19368402-21]-[com.jfinal.core.ActionHandler.handle()]: /main/login?loginId=&loginPwd=
com.jfinal.plugin.activerecord.ActiveRecordException: The attribute name is not exists: gsName
	at com.jfinal.plugin.activerecord.Model.set(Model.java:79)
	at com.f.jxc.controller.MainController.login(MainController.java:25)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at com.jfinal.core.ActionInvocation.invoke(ActionInvocation.java:55)
	at com.jfinal.core.ActionHandler.handle(ActionHandler.java:73)
	at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:72)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:453)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:560)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
	at org.eclipse.jetty.server.Server.handle(Server.java:365)
	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)
	at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:926)
	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:988)
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635)
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
	at java.lang.Thread.run(Thread.java:619)


其中users.set("gsName", users.getFjxcgs().getStr("gsName"));当中是有值的,断点看过了。。但是不知道为什么报错……



举报
chi_95
发帖于5年前 3回/2K+阅
顶部