JAVA 错误
文档 1.严重: Dispatcher initialization failed 调度员初始化失败 提示 classes 下边的 struts.xml(删掉) 2.警告: Could not find action or result 找不到行为或结果 There is no Action mapped for action name attent. - [unknown location] 没有行动的动作名称映射出席。——[未知的地点)
3.Line 43 in XML document from class path resource [applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'calss'('class' is) is not allowed to appear in element 'bean'.
翻译: 这是什 么错 误 org.springframework.beans.factory.BeanCreationException 创 造豆 类 配的 名字 是
“sessionFactory 的 定 义 在 资 源 类 路 径 [applicationContext.xml]: 调 用 的 方 法 都 失 败 了 , 嵌 套 初 始 异 常 java.io.FileNotFoundException:阶级路径资源[hibernate.cfg.xml]不能解决,因为它不存在 URL 解决方法: 4.java.lang.IllegalArgumentException: attempt to create saveOrUpdate event with null entity
译:java.lang.IllegalArgumentException:企图制造 saveOrUpdate 事件与空的实体 解决方法; 表达式; ;来传参数 解决方法;页面上没有用 EL 表达式; 来传参数 ; 5.java.lang.StackOverflowError 译:java 堆栈异常 Action 的返回方法出错; 的返回方法出错;
could not initialize proxy - no Session
译:不能初始化代理- no-session 对象 不能初始化代理 解
public Origin getOriById(Integer id) {//获取ID return (Origin) this.pm.getSession().load(Origin.class, id); } 在 DaoImpl 类里边要用 get 来获取 public Origin getOriById(Integer id) {//获取ID return (Origin) this.pm.getSession().get(Origin.class, id); }
Messages: ? essages
解:
There is no Action mapped for namespace / and action name saveGen.
译:讯息:没有行动为命名空间映射,saveGen 动作名称。 7.查询数据出项乱码问题“SSH”; 提交修改后;jsp 页面出现乱码 提交修改后; (返回的页面和查询所有的页面是同一个页面) SercletActionContext.getResponse().getWriter.print(“falg”);
修改前的 //根据 Lname 名称查询 /*public String getlname(){ //HttpServletRequest request=ServletActionContext.getRequest(); // String lname=request.getParameter("lname"); try { List flag=this.originService.getLname(lname); pm.setData(flag); //ActionContext.getContext().put("pm", pm); //System.out.println("fewfe="+pm.getData().size()); //System.out.println(((Origin)pm.getData().get(0)).getLname()); // ServletActionContext.getResponse().getWriter().print("erewr3"); } catch (Exception e) { e.printStackTrace(); } //System.out.print("我是"+lname); return "success"; }*/ /*
ServletActionContext.getResponse().getWriter().print("erewr3"); 就这行代码 就这行代码*/ 提交修改后; 提交修改后;jsp 页面出现乱码 public String getlname(){ List flag=this.originServi
ce.getLname(lname); pm.setData(flag); return "success"; }
错误: Method execution failed: org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here 方法执行失败了: org.hibernate 。 HibernateException: 不 冬 眠 会 议 一 定 会 线 程 和 配 置 不 允 许 创 建 一 个 non-transactional 这里
Messages: Messages
? No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here org/springframework/orm/hibernate3/SpringSessionContext.java
File: File Line number: number
63
没有配置
El 表达式判断 表达式判断
${model.parent eq 'true'?'子模块':'父模块'} |
${item.gender eq 1?'男':'女'} | 男 女 Oracle 自动生成系统时间 ? 方法一( 类型的字段) 方法一(数据库不许要有时间 date 类型的字段) 找到 Vo、domain 包里边的类 、 Private Date Creared; (省去 Get 和 Set 方法 省去 方法)
public void setCreated(Date created) { this.created = new Date();//系统生成当前时间 } 方法二 找到 Action 里面的执行添加的方法 Private Role role;(省去 Get 和 Set 方法 方法) 省去 /* modth */ public String addRole(){//添加角色
this.role.setCreated(new Date());
this.service.saveRole(this.role); return "success"; } Png 格式的图片 在 IE 效果下的透明性问题(怎样解决? 效果下的透明性问题(怎样解决? 解决: 解决: 第一次添加完成后; 第一次添加完成后;在返回添加第二次就失败 添加完成后 ?
Stacktraces
org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions
收集非法交往 解决:没有给对象赋值; 的时候, 的方法;Dao 的实现类 Impl 使用 解决:没有给对象赋值;在获取 ID 的时候,分析 Id 是否有 Get 和 Set 的方法 什么方式取值( 方法取值的) 什么方式取值(get 和 load 方法取值的) public String getRoleById(){//获取修改前的id号 this.service.getRoleById(id); return "success";
}//源代码 public String getRoleById(){//获取修改前的id号 role = this.service.getRoleById(id); return "success"; }//修改后的
方法二:在Action方法上 @Scope("prototype")//转为原型 public class ZxdtAction { 方法三:获取 Id 值的时候 是否有 的方法;Dao 的实现类 Impl 使用什么方式取值(get 和 load 方法取值的) 使用什么方式取值( 方法取值的) 分析 Id 是否有 Get 和 Set 的方法 public Role getRoleById(Integer id) {//获取修改前的Id号 //
return (Role)this.pm.getSession().load(Role.class, id);// return (Role)this.pm.getSession().get(Role.class, id); } Get 与 load 区别 get()采用立即加载方式,而 load()采用延迟加载;
get()方法执行的时候,会立即向数据库发出查询语句, 而 load()方法返回的是一个代理(此代理中只有一个 id 属性),只有等真正使用该对象属性的时候,才会发 出 sql 语句 2.如果数据库中没有对应的记录,get()方法返回的是 null.而 load()方法出现异常 ObjectNotFoundException
第一点是:load 会抛出异常,get 会返回空,一般采用的 load 方法。第二点是:get 只返回实体对象实 例。而 load 返回的是代理类实体对象实例。第三点是:get 方法只能使用一级缓存。而 load 可以使用一 级和二级缓存。第四点是:都是通过 id 得到单个对象的方法。 修改的时候出现只能修改刚刚插入进去的那一条( 修改的时候出现只能修改刚刚插入进去的那一条(SSH) 出现只能修改刚刚插入进去的那一条 ) 的配置文件;继承; 在与 spring 的配置文件;继承;Scope=”prototype” // prototype 原型 出现WARN - Could not obtain connection to query metadata java.sql.SQLException: Io 异 常 : The Network Adapter could not establish the connection
解释:不能获得数据库元数据吗?无法创建适配器; 原因:数据库没有启动服务; 启动数据库服务就好了 ognl.OgnlException: target is null is for for setProperty(null, setProperty(null, "author", "author",
[Ljava.lang.String;@b7f2d0) 翻 译 : ognl.OgnlException: target [Ljava.lang.String;@b7f2d0) 解决:是否写类的 Get 和 Set 的方法 项目的被一个旧的项目占用了;查看 tomcat 安装目录下的工作工作空间没有没有更新(也就是没有和 MyEclipse 同步; could not initialize proxy - no Session 翻译:无法初始化代理;没有 Session 会话 解决方法:获取 ID 的方法 Dao 的实现类是以 load 的方法获取的;把他改成个体 错误前:public Yytd getYytdById(Integer id) { return (Yytd) this.pm.getSession().load(Yytd.class, id); } 错误后:public Yytd getYytdById(Integer id) { return (Yytd) this.pm.getSession().get(Yytd.class, id); } trim()的用法 public List getTitle(String title) { title = title.trim();//trim()如果为空的话;去掉空格 if(title == null || title.equals("")); return this.getTitle(null); String hql = "from Sswh where title = ?"; List list=