This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hello EveryBody.. I am using javamail to send an e-mail with attachment. This attachment is an html which is the output of jsp. So can anyone tell me how to get/save the html output of jsp in a file.I am using Tomcat-apache server. I tried with java.net package using sockets to connect to jsp,and downloading the output to a file.But it works partially.. ie.it can not download from inner directories of server where I used to store jsps.. So tell me the way how to save html output of jsp into a file. Thanks
have u used URLConnection in java.net.* package e.g URL myUrl= new URL("http://www.xyz.com/dir1/file.jsp"); URLConnection myUrlConnection = myUrl.openConnection(); then u can get hold of input stream of this connection by InputStream muInput = myUrlConnection.getInputStream(); once u ve input stream u can wrap it in higher level streams like BufferReader and retrive HTML if u ve tried this then inform me if u achieve it some other way regards Ghazanfar Qureshi
Joined: Nov 22, 2008
Thanks .. But.. I have already tried this problem using URLConnection..But.. It allows me to go upto index.html of our server..but not inside that..like.. "Http://some.com/dir1/xyz.jsp" It does not go beyond "Http://some.com/" gives contentlength zero..but it has some output in html..