从servlet获取jsp页面的Html [英] Getting Html of a jsp page from a servlet

查看:554
本文介绍了从servlet获取jsp页面的Html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个jsp页面,其中有动态数据。



我想从servlet中获取浏览器中显示的jsp页面的html。 / p>

我想将jsp的html存储在String变量中。



是否可以获取html来自servlet的jsp文件的源代码。
如果是的话。如何?

解决方案

使用commons http client,它有助于从java应用程序发出GET或POST请求。



您可以传递所有必需的数据,如身份验证参数或会话ID等。



根据您的要求,您可以获得使用相同的完全呈现的HTML源代码。



此处可以找到更多详细信息以及好的示例



< a href =http://hc.apache.org/httpclient-3.x/userguide.html\"rel =nofollow> http://hc.apache.org/httpclient-3.x/userguide.html


A jsp page in which dynamic datas are there.

I want to get the html of the jsp page which is shown in the browser , from the servlet.

I want to store the html of the jsp in a String variable.

is it possible to get the html source of the jsp file from a servlet. If yes . How?

解决方案

Use commons http client, which helps in making GET or POST requests from java application.

You can pass all the data required like authentication params or.. session id's etc.

As per your requirement you can get content of completely rendered HTML source using the same.

Much more details can be found here along with good examples

http://hc.apache.org/httpclient-3.x/userguide.html

这篇关于从servlet获取jsp页面的Html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆