我还是个新手。我想做到的效果就是页面加载的时候就把新闻从数据库读去出来,就是一打开网页就显示出新闻的那种效果,所以想到加载的时候跳转到一个action去,
大家是怎么做的呢?
大家是怎么做的呢?
解决方案 »
- mysql + jsp+tomcat 中文乱码问题?
- 通过一个ip如何获取,此ip下的所有网站???
- 关于JFreeChart图片显示不了,在线请教
- 分页问题,急!!!请教高手!(100分)
- java如何取得UNIX时间 如 1162017434
- 请教一个sql语句转成hql的问题
- 微博的@人 技术怎么实现的啊?
- 文本区如何进行编辑?现在文本区不支持VALUE属性!
- 编译中的这种错误如何解释!Unable to compile class for JSPNote
- applet的打印问题
- java.lang.IllegalArgumentException: No bean specified
- struts2、hibernate 写的注册程序为什么不对?
此时if (((String) request.getSession().getAttribute("username")) == null如果成立的话,
那岂不是一直这么前后台反反复复
web.xml里的设置:
<welcome-file-list>
<welcome-file>findAll.do</welcome-file>
</welcome-file-list>
action里的跳转测试:
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
// TODO Auto-generated method stub
request.setAttribute("msg", "跳转成功");
return mapping.findForward("fail");
}
struts里的配置,是不是input的问题?:
<action
input="/index.jsp"
path="/findAll"
scope="request"
type="com.yourcompany.struts.action.FindAllAction">
<forward name="ok" path="/index.jsp" />
<forward name="fail" path="/msg.jsp" />错误如下:
type Status reportmessage /CDepartmentWeb(WebRoot的名称)/description The requested resource (/CDepartmentWeb/) is not available.
<welcome-file>findAll.do </welcome-file>
</welcome-file-list>
welcome-file-list不支持findAll.do这种路径映射,这里面只能是一个html、jsp等已经存在的文件你可以先谢一个jsp文件,比如index.jsp,然后
<welcome-file-list>
<welcome-file>index.jsp </welcome-file>
</welcome-file-list>
然后再index.jsp中写转发,比如:
<meta http-equiv="refresh" content="2; URL=<%=request.getContextPath() %>/person/queryPerson.action">
延迟两秒后转发
或者直接写response.sendRedirect("/xxx.do"); 等
群号:75785340欢迎加入
我把50多万条记录 放到session里面的时候 出现了同样的错误
findAll.do 从该代码中看出 你应该是读取出了全部记录吧
是不是 可以先 top 20 条
呵呵 本人也是小雏鸟 见笑啦~-~