ravi san wrote:
My java code has lines like System.out.println and System.err.println. I am new to this java as well as jsp. Just trying to get the results back. If you want I can post the java code. Please
reply.
Thank you
System.out.print statements don't print to the HTML displayed page, they print to the Java console - for a
Servlet Container this output can either be ignored or printed to a special output text / log file. The JSP will provide a specific output stream you need to write to in order to display to the user. All of this is a really bad idea, though.
You should not have code like that in your JSP, at worst it should be in a normal Servlet (which can collect the output into variables, store those variables into a sufficiently small scope, and then forward control to the JSP for display).
The basic concept is your JSP should be display only. There is the ability to write Java code in JSP, but it is usually a bad idea. You use Servlets for control - servlets are like normal Java objects with methods for getting requests from web clients. The servlet can better handle the type of Java code you have (and error reporting), then when it is done call a JSP for displaying results. Even better than that might be a plain old java object (sometimes called POJO) which handles all the work, the Servlet creates it and passes into the JSP (assuming it would have 'get' methods for the parts that need to display in JSP). The benefit of this is you could
test it in a local environment where error reporting is easier to understand than a web application. You can then use it in the
JEE environment when you know it works. It also makes your JSP much simpler and easier to read (and better able to take advantage of JSTL tags and EL which you should eventually read about).
I suggest doing a lot more reading. Start here:
The Java EE Tutorial but getting a book on Java EE and reading it thoroughly is another good idea.