wood burning stoves 2.0*
The moose likes JSF and the fly likes print record in jsf Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "print record in jsf" Watch "print record in jsf" New topic
Author

print record in jsf

muntago Richard
Ranch Hand

Joined: Nov 13, 2010
Posts: 82
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

Joined: Jun 25, 2001
Posts: 16140
    
  21

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).


Customer surveys are for companies who didn't pay proper attention to begin with.
muntago Richard
Ranch Hand

Joined: Nov 13, 2010
Posts: 82
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

Joined: Mar 28, 2012
Posts: 859

if(!empname.equals("Mutago")){

WP
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16140
    
  21

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: print record in jsf