• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

print record in jsf

 
muntago Richard
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want print eg success on a webpage in jsf. i don't want to use

return="success.xhtml"

i tried using

System.out.println("success");

but it displays nothing on a web page
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18226
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't use System.out.println in any J2EE webapp, JSF or not. You don't know where it's going to go. For general logging, use a real logger.

Normally, I do navigate to a "success" page myself, although in some cases I may simply display the message on the current page. I can do that by either making the page reference a property that will be set with the message or by using the JSF internal message component. Either way, I'd return null to indicate that the existing page would be re-displayed (with the updated message).
 
muntago Richard
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it got printed within the tomcat in eclipse. it now working

thank you.

my final question





This prints ok if empnane is equal to Mutago. My question now is
.
How do i print error if empname is not equal to Mutago. I tried this




but it is not working




 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if(!empname.equals("Mutago")){

WP
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18226
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, I will repeat:

Don't use System.out.println in any J2EE webapp, JSF or not. You don't know where it's going to go. For general logging, use a real logger.

Just because YOUR (obsolete) copy of Tomcat "works" doesn't mean that what you are doing is safe or reliable. And in the specific case of Tomcat under Windows, the stdout/stderr streams are known offenders when it comes to having output vanish to who-knows-where without a trace.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic