Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is it possible? Take html source code from a jsp

 
matias casal
Ranch Hand
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, is it possible to take the html source code from a jsp with a function, or header ?
Thank you
 
Mark E Hansen
Ranch Hand
Posts: 650
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

 
matias casal
Ranch Hand
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
matias casal
Ranch Hand
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, thank you, but I didnt understand your answer.
have you got any tutorial about HttpClient ?
Thanks again!
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The HttpClient web site contains numerous examples.
 
Tomasz Szymanski
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
matias casal
Ranch Hand
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, I will read about this
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic