上一错误把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)
=====================