NutzCN Logo
问答 通过request转到前台,前台404
发布于 2122天前 作者 lihao411775814 1658 次浏览 复制 上一个帖子 下一个帖子
标签:
@IocBean
@At("/Student")
@Ok("json")
@Fail("http:500")
public class StudentModule {

	@Inject
	protected Dao dao;
	@At("/count")
	@Ok("jsp:jsp.index")
	public void count(HttpServletRequest request){
		List<Student> studentList=dao.query(Student.class,null);
		request.setAttribute("studentList", studentList);
	}
}
13 回复

前台通过http://localhost:8080/NutzDemo/Student/count访问404

进入口方法了吗?

???

@IocBean
@At("/Student")
@Ok("json")
@Fail("http:500")
public class StudentModule {

	@Inject
	protected Dao dao;
	@At("/count")
	public int count(HttpServletRequest request){
		List<Student> studentList=dao.query(Student.class,null);
		request.setAttribute("studentList", studentList);
		return 1;
	}
}

如果这样写的话,前台正常显示1

会debug不... 有没有进count方法

应该时进了啊,不然前台页面打印出了1

第一中那种request的写法,控制台打印除了sql语句的

不要"应该", debug看看有没有进

话说, 你是怎么得出 "不然前台页面打印出了1" 这个想法的?? spring mvc的思路??

他的前台页面就显示一个1,那个return把1返回到哪了?

我试过了,进count方法了

@Ok("jsp:jsp.index")

这个被吃掉了? 这个值对应的完整路径应该 /WEB-INF/jsp/index.jsp , 是不是放错地方了?

@wendal 问题解决了,谢谢,我忘记创建jsp文件夹了,之前学的spring mvc,现在有点混,有什么学习Nutz的好建议吗?

来自炫酷的 NutzCN

右上角, "新手入门" 走一遍

添加回复
请先登陆
回到顶部