package servlet; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import uiBeans.ComboBox; public class ServletValintaWithBean extends HttpServlet { private static final long serialVersionUID = 1L; private static final String CONTENT_TYPE = "text/html"; //Initialize global variables public void init() throws ServletException { } //Process the HTTP Get request public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String valinnat[] = {"kissa","koira","kana"}; ComboBox cb = new ComboBox("valinta",valinnat); cb.setValittu(request); response.setContentType(CONTENT_TYPE); PrintWriter out = response.getWriter(); out.println(""); out.println("
Valinta = " + cb.getValittu() + "
"); out.println(""); out.println(""); } //Clean up resources public void destroy() { } }