HTTP Status 500-
TypeException report
Message
Description The server encountered an internal error () that prevented it from fulfilling this request.
Exception
javax.servlet.ServletException: [Ljava.lang.Object;org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)javax.servlet.http.HttpServlet.service(HttpServlet.java:709)javax.servlet.http.HttpServlet.service(HttpServlet.java:802)com.zq.utils.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:24)
Root cause
java.lang.ClassCastException: [Ljava.lang.Object;com.zq.struts.user.action.UserAction.userLogin(UserAction.java:403)com.zq.struts.user.action.UserAction.doExecute(UserAction.java:118)com.zq.struts.action.BaseAction.execute(BaseAction.java:98)org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:106)org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)javax.servlet.http.HttpServlet.service(HttpServlet.java:709)javax.servlet.http.HttpServlet.service(HttpServlet.java:802)com.zq.utils.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:24)
Note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
The following content is taken from the Internet)
String SQL = "select {P. *} from Personreg P where P. name =: name and P. password =: password ";
The collection returned by the list () method of the preceding Query stores the elements of the object array, which only stores the Personreg object.
It should be if (iterator. hasNext ()){
Object [] row = (Object []) iterator. next ();
Personreg personreg = (Personreg) row [0];
System. out. println (personreg. getId ());
}
In addition, String hql = "from Personreg P where P. name =: name and P. password =: password ", here, because your statement uses an alias. attribute name, so you must specify the alias before. Otherwise, the syntax is incorrect. Or you can use String hql = "from Personreg where name =: name and password =: password ".