严重: Servlet.service() for servlet default threw exception
java.lang.NullPointerException
at org.bookstore.action.UserAction.register(UserAction.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:404)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)UserAction类里是这样子 public String register()throws Exception{
System.out.println(usertable.getUsername());
UserTable usertable1=new UserTable();
usertable1.setUsername(usertable.getUsername());
usertable1.setAge(usertable.getAge());
usertable1.setPassword(usertable.getPassword());
usertable1.setSex(usertable.getSex());
userService.saveUserTable(usertable1);
return SUCCESS;
}
调试在 System.out.println(usertable.getUsername());
就出错UserTable类里值这样子public class UserTable implements java.io.Serializable { // Fields private Integer userid;
private String username;
private String password;
private String sex;
private Integer age;
private Set orderses=new HashSet(0);
java.lang.NullPointerException
at org.bookstore.action.UserAction.register(UserAction.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:404)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)UserAction类里是这样子 public String register()throws Exception{
System.out.println(usertable.getUsername());
UserTable usertable1=new UserTable();
usertable1.setUsername(usertable.getUsername());
usertable1.setAge(usertable.getAge());
usertable1.setPassword(usertable.getPassword());
usertable1.setSex(usertable.getSex());
userService.saveUserTable(usertable1);
return SUCCESS;
}
调试在 System.out.println(usertable.getUsername());
就出错UserTable类里值这样子public class UserTable implements java.io.Serializable { // Fields private Integer userid;
private String username;
private String password;
private String sex;
private Integer age;
private Set orderses=new HashSet(0);
解决方案 »
- Hibernate
- 菜鸟求助,JSP连接Access的问题
- 菜鸟关于学习JAVA EE的一个问题
- JAVA编写的固定资产管理系统谁有?
- osworkflow 多用户设置
- 我想用Struts实现一个简易留言板,数据库用的是Oracle,怎样解决分页问题最简单,最容易?(分快没了)
- JBoss启动不了!搞了好几天都搞不好!!!
- 请教J2EE Tutorial中关于Duke实例的部署问题!!!!
- 网上有没有什么现成的邮件系统啊(javamail做的),就像新浪或者搜狐邮件那样的
- 用到spring的Aspectj做日志处理,可死活都会调用2次???
- weblogic+myeclipse 数据库连接问题
- 数据库中怎么存放文件地址时\变成了.
usertable.getUsername()
usertable 在哪里实例的?
都没有setUsertable方法,这个肯定是空的