如何在网页中显示omdb函数返回值

时间:2017-03-13 15:04:02

标签: java jsp servlets web-applications

我们可以存储从omdb函数searchOneMovie(moviename)返回的值,以便在单击按钮时可以在JSP页面中显示它作为输出吗?我正在开发一个Web应用程序,点击按钮我应该得到用户搜索的电影的详细信息,但是使用searchOneMovie()我在控制台中获取输出而不是在网页中。请告诉我们如何在JSP页面中显示searchOneMovie()值。

CODE:

public void search(HttpServletResponse response, String moviename) throws OmdbSyntaxErrorException, OmdbConnectionErrorException, OmdbMovieNotFoundException, IOException {
    Omdb o = new Omdb();
    try {
        PrintWriter out = response.getWriter();
        out.print(o.searchOneMovie(moviename));
    } catch (Exception ignore) {
    }
}

输出:此输出将在控制台上显示,但我想在网页中找到它,请帮忙。

 Mar 13, 2017 8:13:51 PM com.omdbapi.RestClient execute
 INFO: executing GET http://www.omdbapi.com/?t=star+wars HTTP/1.1
 Mar 13, 2017 8:13:52 PM com.omdbapi.Omdb resultToJson
 INFO: received {"Title":"Star Wars: Episode IV - A New     Hope","Year":"1977","Rated":"PG","Released":"25 May 1977","Runtime":"121 min","Genre":"Action, Adventure, Fantasy","Director":"George Lucas","Writer":"George Lucas","Actors":"Mark Hamill, Harrison Ford, Carrie Fisher, Peter Cushing","Plot":"Luke Skywalker joins forces with a Jedi Knight, a cocky pilot, a wookiee and two droids to save the galaxy from the Empire's world-destroying battle-station, while also attempting to rescue Princess Leia from the evil Darth Vader.","Language":"English","Country":"USA","Awards":"Won 6 Oscars. Another 50 wins & 28 nominations.","Poster":"https://images-na.ssl-images-amazon.com/images/M/MV5BYzQ2OTk4N2QtOGQwNy00MmI3LWEwNmEtOTk0OTY3NDk2MGJkL2ltYWdlL2ltYWdlXkEyXkFqcGdeQXVyNjc1NTYyMjg@._V1_SX300.jpg","Metascore":"92","imdbRating":"8.7","imdbVotes":"963,318","imdbID":"tt0076759","Type":"movie","Response":"True"}

0 个答案:

没有答案