-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: doExecute() does not return error message
PostPosted: Mon Apr 19, 2004 9:46 am 
Beginner
Beginner

Joined: Wed Mar 24, 2004 8:43 am
Posts: 42
hi

public class Userlog extends ActionSupport implements CommandDriven {

String login;
public String doExecute() throws Exception{
try{

Configuration cfg=new Configuration().addClass(test.hibernate.data.User.class);
SessionFactory sf=cfg.buildSessionFactory();

Session sess=sf.openSession();
users = sess.find("select u from u in class test.hibernate.data.User"
+" where u.id='"+ id +"' and u.password='"+ password +"'");

if(users.size() == 0 || users.equals("")){
System.out.println(" error in logging");
login="ERROR";
}

else if(users!=null || !users.equals("")){
login="SUCCESS";

}
sess.close();


System.out.println(" login value is "+ login);
return login;

}catch(HibernateException e){
e.printStackTrace();
System.out.println("errrorrrrrrrrrr in the userlog java class");
return ERROR;
}



view properties file
userlogin.action=Userlog
userlogin.success=index.html
usewlogin.error=/WEB-INF/views/error.html


problem is
when we pass wrong values foe user id and pass word the system doesn't dispay error.html, but when we enter the id and pass word correctly the system logon sucessfully.


when the id and password are incorrect system displays
HTTP Status 404 - No view for result [error] exists for action [userlogin]


why the error.html doed not display?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 19, 2004 10:24 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
At first, don't use string concatenation to build your query, but use parameter placeholders and .setParameter()


Top
 Profile  
 
 Post subject: unable to display error.html page
PostPosted: Tue Apr 20, 2004 2:25 am 
Beginner
Beginner

Joined: Wed Mar 24, 2004 8:43 am
Posts: 42
hello friend

i still can't display that error.html page, can any one help me to solve the problem.( IS there any error in the logic)

regards
gimhan


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 20, 2004 3:45 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Use a debugger I'd suggest ...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.