Add httpsession-xml

Fixes #103
This commit is contained in:
Rob Winch
2015-01-14 11:40:49 -06:00
parent f5e3deafa9
commit ba07c1d562
15 changed files with 273 additions and 2 deletions

View File

@@ -0,0 +1,20 @@
package sample;
import javax.servlet.*;
import javax.servlet.annotation.*;
import javax.servlet.http.*;
import java.io.IOException;
@WebServlet("/session")
public class SessionServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String attributeName = req.getParameter("attributeName");
String attributeValue = req.getParameter("attributeValue");
req.getSession().setAttribute(attributeName, attributeValue);
resp.sendRedirect(req.getContextPath() + "/");
}
private static final long serialVersionUID = 2878267318695777395L;
}