开发者

How to call web services into jsp page

I have a web services written in java usin开发者_如何学Gog jersey framework when i call it it will return me a xml. But i want to use it in a jsp page for example i have a web service getCoutry() when i call it, it will return me xml as like.

my url is: http://localhost:8080/countries-ws/resources/admin/getCountry?id=1

<conList>
<cid>1</cid>
<iso>AD</iso>
<iso3>AND</iso3>
<name>ANDORRA</name>
<numcode>20</numcode>
<printableName>Andorra</printableName>
</conList>

And i want to use it in a select tag of jsp page. I don't know how to use it please help me guys. Thanks


Call the webservice from your servlet . set the result in request/session or appropriate scope as attribute and forward this to jsp. on jsp access it using JSTL as simple as that

Update:

URL yahoo = new URL("http://www.yahoo.com/");
BufferedReader in = new BufferedReader(
            new InputStreamReader(
            yahoo.openStream()));

String inputLine;

while ((inputLine = in.readLine()) != null)
    System.out.println(inputLine);

in.close();
  • Reference
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜