=================================关键代码2=====================================
package com.ld.struts;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;import com.ld.hibernate.SessionFactory;public class LoginAction extends Action {
private static final long serialVersionUID = 1L; public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
try {
if (form instanceof LoginForm) {
LoginForm theForm = (LoginForm) form;
String title = theForm.getTitle();
String author = theForm.getAuthor();
String content = theForm.getContent(); if (title.equals("news") && author.equals("lxs")) {
//这里有问题呀
SessionFactory.writenews(title,author,content);
return new ActionForward("/welcome.do?type=true");
} else {
return new ActionForward("/welcome.do?type=false");
}
}
} catch (Exception e) {
//e.printStackTrace();
}
return null;
}
}
package com.ld.struts;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;import com.ld.hibernate.SessionFactory;public class LoginAction extends Action {
private static final long serialVersionUID = 1L; public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
try {
if (form instanceof LoginForm) {
LoginForm theForm = (LoginForm) form;
String title = theForm.getTitle();
String author = theForm.getAuthor();
String content = theForm.getContent(); if (title.equals("news") && author.equals("lxs")) {
//这里有问题呀
SessionFactory.writenews(title,author,content);
return new ActionForward("/welcome.do?type=true");
} else {
return new ActionForward("/welcome.do?type=false");
}
}
} catch (Exception e) {
//e.printStackTrace();
}
return null;
}
}
解决方案 »
- struts2 +jquery的ajax 怎么返回数据不做页面跳转
- spring MVC的技术问题
- 刷新数据查询结果时报错javax.servlet.ServletException...
- 我用structs2和hibernate3写的小程序总是出错!
- 两组特别大的数,怎么找出其中一组数在另一组数不存在的值?
- 当程序写好了时,怎么把程序做成软件,也就是exe文件,和配置服务器什么的。
- web service发布问题
- Redirect requested but followRedirects is disabled 有人遇到过吗?
- java读取oracle字符串生成XML乱码问题
- 我安装了j2ee sdk 1.4版,在运行tutorial 时总出错,请高手帮忙,我是j2ee的新手
- 开源即时通讯帮助?
- Spring +hibernate 能够查询却没有删除记录(晕)
主 题: struts+hibernate~~24小时结帖哦~~~
作 者: yun6573251 ()
等 级:
信 誉 值: 100
所属社区: Java 框架、开源
问题点数: 50
回复次数: 7
发表时间: 2006-2-9 15:45:39
用tomcat5.5有28个错误
用tomcat5.0有38个错误
Top
回复人: Little_qd(沉淀思想) ( ) 信誉:99 2006-2-9 17:21:59 得分: 15
Duplicate class/entity mapping com.ld.hibernate.News
重复映射News类是不是配置文件中已经有映射到news的类
Top
回复人: rickhunterchen(千山鸟飞绝) ( ) 信誉:100 2006-2-10 0:08:58 得分: 15
Web程序光看异常只能看个大概。建议Lz用调试,自己调试一下就会知道错误在哪了。
Top
回复人: liuyxit(我不是你的上帝...) ( ) 信誉:101 2006-2-10 0:25:15 得分: 10
2006-2-9 15:45:12 org.hibernate.cfg.Configuration configure
信息: configuring from resource: /hibernate.cfg.xml
2006-2-9 15:45:12 org.hibernate.cfg.Configuration getConfigurationInputStream
信息: Configuration resource: /hibernate.cfg.xml上面信息明显存在两个hibernate.cfg.xml文件
所以下面出现双重映射如果用eclipse的话,可在左边的树里按F5刷新一下,看是否存在两个hibernate的配置.
Top
回复人: yun6573251() ( ) 信誉:100 2006-2-10 13:06:36 得分: 0
楼上三位~~太感谢你们啦~~情人节要到了~祝你们开心~
Top
回复人: yangyijieyyj(小猪) ( ) 信誉:100 2006-2-10 15:11:16 得分: 10
%%%% Error Creating SessionFactory %%%%
org.hibernate.MappingException: Could not read mappings from resource: com/ld/hibernate/News.hbm.xml好像是没有找到News.hbm.xml这个映射,检查一下有没有
Top
回复人: yun6573251() ( ) 信誉:100 2006-02-10 15:34:00 得分: 0
谢谢各位呀~
Top
=================================================================================
//9i以上
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
//9i以下
<property name="dialect">org.hibernate.dialect.Oracle</property>还有其它相应的