Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Servlets
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Liutauras Vilda
Paul Clapham
Sheriffs:
paul wheaton
Tim Cooke
Henry Wong
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Piet Souris
Bartenders:
Mike London
Forum:
Servlets
parsing url content into string
Marko Debac
Ranch Hand
Posts: 121
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
I am trying to do the same thing what I am doing with
jsp
import tag
<c:import var='abc' url='http://www.yahoo.com'/> <c :-o ut value="${abc}" />
within some class what I can invoke frome
servlet
: something like this
URL abc = new URL("http://yahoo.com");
But something is wrong?
Mirko Bonasorte
Ranch Hand
Posts: 244
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
c
ut also formats the result for html output (by default)
[ May 30, 2007: Message edited by: Mirko Bonasorte ]
Marko Debac
Ranch Hand
Posts: 121
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Ok, but, is there some way to take web page content source code, and put it into
String
in pure
java
, i.e. not using jstl import?
Mirko Bonasorte
Ranch Hand
Posts: 244
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
It would be a nice idea to watch inside the jakarta jstl implementation, class ImportSupport.
It uses URLConnection got from URL class.
Marko Debac
Ranch Hand
Posts: 121
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I can not find the solution.
Is there any other option, maybe some simple function where you enter url and she gives you out html source like String?
String abc = function(url); ???
Bear Bibeault
Sheriff
Posts: 67695
173
I like...
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You might also want to check out the
HttpClient project
. it makes such things very very easy.
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
Marko Debac
Ranch Hand
Posts: 121
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Bear, plese help me a little bit;
I have downloaded zip file commons-httpclient-3.1-rc1, extracted them, and input commons-httpclient-3.1-rc1.jar into project.
my code is:
import org.apache.commons.httpclient.methods.GetMethod; public class Main { public Main() { } public static void main(String[] args) { String url = "http://www.yahoo.com"; GetMethod get = new GetMethod(url); String letters = get.getResponseBodyAsString(); System.out.println(letters); } }
and I am getting error
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.apache.commons.httpclient.HttpMethodBase.<clinit>(HttpMethodBase.java:104)
Am I closer?
Bear Bibeault
Sheriff
Posts: 67695
173
I like...
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
HttpClient apparently requires the Commons Logging jar to be in the classpath.
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
Don't get me started about those stupid
light bulbs
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Effect of nillable=true
Custom Tag
about servlet-mapping
Servlets on Tomcat 4 (Standalone)
url matching doubt
More...