新手求教,谢谢各位。

异常信息:

严重: Exception occurred during processing request: Method "regist" failed for object action.UsersAction@3855cf59

ognl.MethodFailedException: Method "regist" failed for object action.UsersAction@3855cf59 [java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration]

.jsp内容:

<form name="registFrom" action="<%=path%>/users/Users_regist.action" method="post">

  <div class="mainBg">

  <div class="username"><span>用户名:</span>

  <input id="username" name="username" type="text" placeholder="请输入用户名" onblur="checkname();"> 

  <span id="checkbox"></span> 

  </div>

  <div class="name"><span>真实姓名:</span>

  <input id="name" type="text" placeholder="请输入姓名" name="name">

  </div>

  <div class="sex"><span>性&nbsp;&nbsp;&nbsp;别:</span>

  <label><input id="man" type="radio" name="sex" value="男" checked="checked">男</label>

  <label><input id="woman" type="radio" name="sex" value="女">女</label>

  </div>

  <div class="password"><span>密&nbsp;&nbsp;&nbsp;码:</span>

  <input id="password" type="password" placeholder="请输入密码" name="password">

  </div>

  <div class="qpassword"><span>确认密码:</span>

  <input id="qpassword" type="password" placeholder="确认密码" name="qpassword">

  </div> 

  <div class="phone"><span>手机号:</span>

  <input id=phone type="text" placeholder="请输入手机号" name="phonenum">

  </div>

  <div class="regist">

  <input id="regist" type="submit" value="注册">

  </div>

  </div>

  </form>

service层:

public boolean usersRegist(Users u) {

Transaction tx = null;

Session session = MyHibernateSessionFactory.getSessionFactory().getCurrentSession();

try{

tx = session.beginTransaction(); 

       session.save(u);

       tx.commit();

       return true;

}

catch(Exception ex){

ex.printStackTrace();

session.getTransaction().rollback();

return false;

}finally{

if(tx != null){

tx = null;

}

}

}

action层:

public class UsersAction extends SuperAction implements ModelDriven<Users>{

private static final long serialVersionUID = 1L;

private Users user = new Users();

public String regist(){

UsersDAO udao = new UsersDAOImpl();

if(udao.usersRegist(user)){

return "regist_success";

}else{

return "regist_failure";

}

}

public Users getModel() {

// TODO Auto-generated method stub

return user;

}

}

struts.xml配置:

<package name="users" namespace="/users" extends="default">

     <action name="*_*" class="action.{1}Action" method="{2}">

      <result name="regist_success">/users/Users_login_success.jsp</result>

      <result name="regist_failure">/users/Users_login.jsp</result>

     </action>

    </package> 


小菜鸟爱学习
浏览 1662回答 1
1回答

qq___571

jar包没没找到 放到lib目录下
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java
JavaScript