url.getContent() question

Hi
  I am trying to use url.getContent(). But the it does not reach
 System.out.println("here  333");
  I am running this in a servlet. Could anybody help me solve this.

Thanx


java.net.URL url = null;
    try {
       System.out.println("here  111");
      url = new java.net.URL("http://www.news.com/");
         System.out.println("here  222");
      Object foo = url.getContent();
         System.out.println("here  333");
    }
    catch (java.net.MalformedURLException ex) {
     System.err.println("Exception thrown - SetupServlet 1" + ex.getMessage());
    }
     catch (IOException e) {
                              System.err.println("Exception thrown - SetupServlet 1" + e.getMessage());
                        }
b3cfAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
So what *do* you get?
0
b3cfAuthor Commented:
It threw an unreachable exception.

I am trying the following, but no response for the last few minutes.
java.net.URL("http://localhost:8080/ChartsV2.0/jsp/index.jsp");

thanx
0
CEHJCommented:
Can you reach that in your browser?
0
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

b3cfAuthor Commented:
Sure.
0
b3cfAuthor Commented:
Not if I run thed code in my servlet though.
0
CEHJCommented:
What's the ultimate objective of this code?
0
b3cfAuthor Commented:
To precompile JSP pages when Tomcat starts.

I know Tomcat has to be started for this code to work.

If i have this code the following messages from Tomcat wont be displayed.

Oct 22, 2003 3:58:35 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on port 8080
Oct 22, 2003 3:58:35 PM org.apache.jk.common.ChannelSocket init
INFO: JK2: ajp13 listening on /0.0.0.0:8009
Oct 22, 2003 3:58:35 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/90  config=d:\jakarta-tomcat-4.1.27\conf\jk2.proper
ties
0
CEHJCommented:
Why not use the precompiler 'jspc'?

http://ant.apache.org/manual/OptionalTasks/jspc.html
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
b3cfAuthor Commented:
This way its easier to maintain the code.

thanx
0
CEHJCommented:
How could that be? Every time you add a new page you have to make a change to the servlet's source code and recompile it.
0
b3cfAuthor Commented:
No. I just get all the files under jsp that has .jsp extension and do it. I have hardcoded just for testing.

thanx
0
b3cfAuthor Commented:
Do you know how I could use javac ?

thanx
0
b3cfAuthor Commented:
Opps. I meant jspc.
0
CEHJCommented:
See the link i posted above. This is a serious way of doing things.
0
CEHJCommented:
:-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.