How to request and get a webpage using http request in jsp

前端 未结 2 2001
渐次进展
渐次进展 2021-01-23 13:49

How do I get an xml page (I mean an REST API from an web service), parse it and display it in my website, in jsp?

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-23 14:32

    You'll need to use a library to retrieve the content via HTTP (HttpClient, for example) and something to parse the response (SAX).

    Avoid using scriptlets for doing this, encapsulate your logic in classes and try creating custom tags, or better yet, try using something like Spring's MVC.

提交回复
热议问题