Last active
November 10, 2018 15:05
-
-
Save kasundharmadasa/555a62e850e74c4fd2af80b1f17ad131 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.sample; | |
import com.sample.model.LiquorType; | |
import javax.servlet.RequestDispatcher; | |
import javax.servlet.ServletException; | |
import javax.servlet.annotation.WebServlet; | |
import javax.servlet.http.HttpServlet; | |
import javax.servlet.http.HttpServletRequest; | |
import javax.servlet.http.HttpServletResponse; | |
import java.io.IOException; | |
import java.util.List; | |
@WebServlet( | |
name = "selectliquorservlet", | |
urlPatterns = "/SelectLiquor" | |
) | |
public class SelectLiquorServlet extends HttpServlet { | |
@Override | |
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { | |
String liquorType = req.getParameter("Type"); | |
LiquorService liquorService = new LiquorService(); | |
LiquorType l = LiquorType.valueOf(liquorType); | |
List liquorBrands = liquorService.getAvailableBrands(l); | |
req.setAttribute("brands", liquorBrands); | |
RequestDispatcher view = req.getRequestDispatcher("result.jsp"); | |
view.forward(req, resp); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment