| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2894 人关注过本帖
标题:[原创]jsf+hibernate做的登陆和注册的简单实现
只看楼主 加入收藏
支离破碎
Rank: 6Rank: 6
等 级:贵宾
威 望:23
帖 子:737
专家分:0
注 册:2007-1-4
收藏
得分:0 
建议加入SPRING框架~~~~(最近也学了学JSF。。和原来我用过的Tapestry感觉差不多的。基于组件的。。)

人生漂泊無依,有如浮萍菱花,隨水飄流,你会在我这里停留吗?
[url=http://51mynet.]http://51mynet.[/url]
2007-01-16 13:18
无理取闹
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:53
帖 子:4264
专家分:0
注 册:2006-7-26
收藏
得分:0 

我刚刚才开始学习框架的东西
所以想把spring留到掌握hibernate后来学习
谢谢楼上建议


win32汇编
病毒 加密
目前兴趣所在
2007-01-16 13:35
想你的天空
Rank: 2
等 级:新手上路
威 望:5
帖 子:610
专家分:0
注 册:2004-12-30
收藏
得分:0 
private Transaction tx=session.beginTransaction();
public List<LUser> getByName(String username) {
String sql="from LUser user where username=:name";
Query query=session.createQuery(sql);
query.setParameter("name", username);
return query.list();


是不是缺少了个commit() ?

2007-01-16 15:08
无理取闹
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:53
帖 子:4264
专家分:0
注 册:2006-7-26
收藏
得分:0 
这个方法不需要commit();
如果有空你可以仔细看看我的代码
谢谢

win32汇编
病毒 加密
目前兴趣所在
2007-01-16 16:11
想你的天空
Rank: 2
等 级:新手上路
威 望:5
帖 子:610
专家分:0
注 册:2004-12-30
收藏
得分:0 
private Transaction tx=session.beginTransaction();
public List<LUser> getByName(String username) {
String sql="from LUser user where username=:name";
try{
Query query=session.createQuery(sql);
query.setParameter("name", username);
return query.list();
tx.commit();
}catch(HibernateException e)
{
e.printStackTrace();
rollback();
}


2007-01-17 09:27
想你的天空
Rank: 2
等 级:新手上路
威 望:5
帖 子:610
专家分:0
注 册:2004-12-30
收藏
得分:0 

2007-01-17 09:27
无理取闹
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:53
帖 子:4264
专家分:0
注 册:2006-7-26
收藏
得分:0 
谢谢了

win32汇编
病毒 加密
目前兴趣所在
2007-01-17 09:30
yudiao123
Rank: 1
等 级:新手上路
帖 子:49
专家分:0
注 册:2007-1-19
收藏
得分:0 
好!!

2007-01-21 18:00
shrimpy
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2006-4-24
收藏
得分:0 
严重: Class : org.shrimpy.view.UserBean not found.
java.lang.NoClassDefFoundError: org/hibernate/Session
at org.shrimpy.model.impl.LUserDAOImpl.<init>(LUserDAOImpl.java:14)
at org.shrimpy.service.impl.LUserServiceImpl.<init>(LUserServiceImpl.java:12)
at org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:311)
at org.apache.myfaces.config.LastVariableResolverInChain.resolveVariable(LastVariableResolverInChain.java:42)
at org.apache.myfaces.el.ValueBindingImpl$ELVariableResolver.resolveVariable(ValueBindingImpl.java:574)
at org.apache.commons.el.NamedValue.evaluate(NamedValue.java:124)
at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:140)
at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:383)
at javax.faces.component.UIOutput.getValue(UIOutput.java:77)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:416)
at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)
2007-2-17 2:57:54 org.apache.catalina.core.ApplicationDispatcher invoke
严重: Servlet.service() for servlet jsp threw exception
javax.faces.el.EvaluationException: Cannot get value for expression '#{userBean.username}'
at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:402)
at javax.faces.component.UIOutput.getValue(UIOutput.java:77)
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getStringValue(RendererUtils.java:217)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:135)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:53)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:495)
at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:363)
at org.apache.jsp.index_jsp._jspx_meth_h_inputText_0(index_jsp.java:181)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:416)
at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.faces.FacesException: java.lang.NoClassDefFoundError: org/hibernate/Session
at org.apache.myfaces.shared_impl.util.ClassUtils.newInstance(ClassUtils.java:279)
... 44 more
Caused by: java.lang.NoClassDefFoundError: org/hibernate/Session
at org.shrimpy.model.impl.LUserDAOImpl.<init>(LUserDAOImpl.java:14)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.apache.myfaces.shared_impl.util.ClassUtils.newInstance(ClassUtils.java:274)
... 52 more
2007-2-17 2:57:54 org.apache.myfaces.shared_tomahawk.config.MyfacesConfig getStringInitParameter
信息: No context init parameter 'org.apache.myfaces.ADD_RESOURCE_CLASS' found, using default value org.apache.myfaces.renderkit.html.util.DefaultAddResource
2007-2-17 2:57:54 org.apache.myfaces.shared_tomahawk.config.MyfacesConfig getBooleanInitParameter
信息: No context init parameter 'org.apache.myfaces.CHECK_EXTENSIONS_FILTER' found, using default value true
2007-2-17 2:57:54 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet Faces Servlet threw exception
javax.faces.FacesException: Cannot get value for expression '#{userBean.username}'
at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:435)
at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.faces.el.EvaluationException: Cannot get value for expression '#{userBean.username}'
at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:402)
at javax.faces.component.UIOutput.getValue(UIOutput.java:77)
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getStringValue(RendererUtils.java:217)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:135)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:53)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:75)
(ServletExternalContextImpl.java:416)
... 20 more
Caused by: javax.faces.FacesException: java.lang.NoClassDefFoundError: org/hibernate/Session
at org.apache.myfaces.shared_impl.util.ClassUtils.newInstance(ClassUtils.java:279)
at org.apache.myfaces.shared_impl.util.ClassUtils.newInstance(ClassUtils.java:265)
at org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:50)
at org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:311)
at org.apache.myfaces.config.LastVariableResolverInChain.resolveVariable(LastVariableResolverInChain.java:42)
at org.apache.myfaces.el.ValueBindingImpl$ELVariableResolver.resolveVariable(ValueBindingImpl.java:574)
at org.apache.commons.el.NamedValue.evaluate(NamedValue.java:124)
at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:140)
at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:383)
... 44 more
Caused by: java.lang.NoClassDefFoundError: org/hibernate/Session
at org.shrimpy.model.impl.LUserDAOImpl.<init>(LUserDAOImpl.java:14)
at org.shrimpy.service.impl.LUserServiceImpl.<init>(LUserServiceImpl.java:12)

at org.apache.myfaces.shared_impl.util.ClassUtils.newInstance(ClassUtils.java:274)
... 52 more

为什么eclipse控制台会出现这样的错误的??
2007-02-17 03:02
快速回复:[原创]jsf+hibernate做的登陆和注册的简单实现
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.033388 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved