Forums Register Login

Is it possible? Take html source code from a jsp

+Pie Number of slices to send: Send
Hello, is it possible to take the html source code from a jsp with a function, or header ?
Thank you
+Pie Number of slices to send: Send
What do you mean by this? A JSP page is really just an HTML page with tags in it.

Perhaps if you could show what your expected result is, or explain more of what you're trying to do?

+Pie Number of slices to send: Send
My objective is to get the html source (<html><body>...</body></html>) with a function or something like that to put it on a mysql table.
+Pie Number of slices to send: Send
 

matias casal wrote:Hello, is it possible to take the html source code from a jsp with a function, or header ?
Thank you

.

Yes ..you can...Use java HttpClient .

you just have to set URL, method type (Get or Post) and respective parameters. If your page set cookie then you have to set cookie value. using this class you can get the HTML page of any application in Stream and then convert it to text and use as per your requirement. If you have to get any specific data from the result page then you can also HTML parse the page using HTMLEditorKit class.
+Pie Number of slices to send: Send
Oh, thank you, but I didnt understand your answer.
have you got any tutorial about HttpClient ?
Thanks again!
+Pie Number of slices to send: Send
The HttpClient web site contains numerous examples.
+Pie Number of slices to send: Send
Or you could simply use the RequestDispatcher.include method. Although "simply" might not be the best word, because I guess you would have to pass your own ServletResponse object that would let you capture the result (see the javax.servlet.ServletResponseWrapper class). But it still looks a bit simpler than HttpClient to me.
+Pie Number of slices to send: Send
Thank you, I will read about this
Put a gun against his head, pulled my trigger, now he's dead, that tiny ad sure bled
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 2190 times.
Similar Threads
How can I write jsp lib that removes html tag
viewable .jsp / .java source on my website
How to convert JSP into a txt or html file?
making source code viewable on my website
I need help with my very first jsp
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 01:15:07.