代码快速度生成时undefined
kook 发布于105月前 11答/2098阅



[沙发] Jieven
NullPointerException 这种Java最基础的东西,自己Debug来排查原因吧!没有源码先进行开发者认证!
http://note.youdao.com/share/?id=2d8204409aa61385eb36c00c52486402&type=note
最佳
[地板] Jieven
解决了,是需要添加 arp.addMapping("song ", "ID", Song.class )
亮点
[地毯] Jieven
debug js 看看值为什么没有取到!
[4楼] kook
Uncaught ReferenceError: songs_update is not defined 
[5楼] Jieven
songs_update 应该是你自己改的 方法名,然后调用的地方没改所以 就找不到,
反正就是JS的问题,自己解决一下!
[6楼] kook
上一错误把songid改为id解决了,,新的错误,提示Songs songs = Songs.dao.findById(id);出错,空指针。

package com.oss.songs;

 
import com.jfinal.core.Controller;
 
import com.oss.model.Songs;


public class SongsController extends Controller {
	
	public void update() throws Exception {
		int id = getParaToInt(0);

		Songs songs = Songs.dao.findById(id);
		setAttr("songs", songs);

		render("/songs/update.html");
	}

}


03-31 10:15:42[ERROR]/songs/update/28
java.lang.NullPointerException
	at com.jfinal.plugin.activerecord.Model.findByIdLoadColumns(Model.java:654)
	at com.jfinal.plugin.activerecord.Model.findById(Model.java:615)
	at com.oss.songs.SongsController.update(SongsController.java:14)   ----------->		Songs songs = Songs.dao.findById(id);
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at com.jfinal.aop.Invocation.invoke(Invocation.java:73)
	at com.eova.interceptor.LoginInterceptor.intercept(LoginInterceptor.java:50)
	at com.jfinal.aop.Invocation.invoke(Invocation.java:67)
	at com.jfinal.core.ActionHandler.handle(ActionHandler.java:74)
	at com.jfinal.plugin.druid.DruidStatViewHandler.handle(DruidStatViewHandler.java:75)
	at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:72)


=====================

[7楼] kook
问题没解决,等你开放1.5的源码吧
[8楼] Jieven
http://note.youdao.com/share/?id=2d8204409aa61385eb36c00c52486402&type=note
源码已经开放了,认证以后就可以下载!
[9楼] Jieven
com.oss.songs.SongsController.update(SongsController.java:14) 
报错的是JFinal代码,和Eova源码也没有直接关系
要么就是你的贴的异常日志有问题!
[10楼] kook
Jieven非常热心,功底很强。问题解决了
arp.addMapping("song ", "ID", Song.class )
提交评论