You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Michael Ni <mi...@hotmail.com> on 2003/09/22 14:37:14 UTC
printing from java bean to jsp page
System.out.print from a java bean writes to the command prompt but how do i
write to a jsp page where inside that jsp page i call the java bean. must i
pass it in as a variable or can i write psuedo code such as
println(<html>blah</html>);
if so how.
mike
_________________________________________________________________
Get McAfee virus scanning and cleaning of incoming attachments. Get Hotmail
Extra Storage! http://join.msn.com/?PAGE=features/es
Re: Printing from java bean to jsp page
Posted by Christopher Williams <cc...@ntlworld.com>.
If you need to capture output from a bean, don't use System.out.print - that
goes to the system console or a log file. The "out" variable on a JSP page
is a java.io.Writer object (or at least it is deep down). You should set
this as a member variable of your bean class and write output through that.
Or, if you prefer, you could have the methods from which you want output
take a Writer object as an additional parameter. The output of your bean
will then be part of the output of your JSP page.
Kind regards,
Chris Williams.
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Printing from java bean to jsp page
Posted by Christopher Williams <cc...@ntlworld.com>.
If you need to capture output from a bean, don't use System.out.print - that
goes to the system console or a log file. The "out" variable on a JSP page
is a java.io.Writer object (or at least it is deep down). You should set
this as a member variable of your bean class and write output through that.
Or, if you prefer, you could have the methods from which you want output
take a Writer object as an additional parameter. The output of your bean
will then be part of the output of your JSP page.
Kind regards,
Chris Williams.