1 package example; 2 3 import java.io.*; 4 5 import javax.annotation.*; 6 import javax.servlet.*; 7 8 public class TestServlet extends GenericServlet { 9 @Resource(name="beans/theater") 10 private Theater _theater; 11 12 public void service(ServletRequest req, 13 ServletResponse res) 14 throws IOException, ServletException 15 { 16 PrintWriter out = res.getWriter(); 17 18 out.println("<title>Resin/JAXB: " + _theater.getName() + "</title>"); 19 out.println("<h1>Resin/JAXB: " + _theater.getName() + "</h1>"); 20 21 for (Movie movie : _theater.getMovieList()) { 22 out.println("<h3>Movie: " + movie.getTitle() + "</h3>"); 23 24 if (movie.getStarList().size() > 0) { 25 out.println("Starring:"); 26 27 for (String star : movie.getStarList()) { 28 out.println("<li>" + star); 29 } 30 } 31 } 32 } 33 } 34 | Popular Tags |