I have a strange problem to solve. My servlet reads the source code for the JSP from the database, and writes it to a file, which the user can later hit. Before writing the JSP to a file, the servlet has to 'hit' the JSP, to make sure that the JSP gets compiled with no errors. sendRedirect and forward do not work in this scenario, because the control has to return to the servlet after 'hitting' the JSP. Can any one suggest me a soluation? I am basically looking for some sort of 'curl(a unix command)' that I can use in my servlet. Any suggestions? -Akram.
I can think of two possibilities: 1) dig into the Tomcat code and find out how to duplicate the effect of "hitting" the page by direct execution of the JSP page compiler. 2) address the page through a URLConnection to the localhost. Bill
Akram, I think what Bill means is this. Open an URL connection and get the InputStream object and read the contents. I tested with a java application. You can include this code in servlet also. When you run "java Test1" you will get
at the DOs command prompt.
regds maha anna
Joined: Mar 13, 2001
Thanks Maha. I didn't consider this possible at all. But, thanks to Bill and you, I have the solution.