Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@page import="uts.wsd.*" import="java.util.*" contentType="text/html" pageEncoding="UTF-8"%>
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>Login Action</title>
- </head>
- <body>
- <% String filePath = application.getRealPath("WEB-INF/users.xml");%>
- <jsp:useBean id="diaryApp" class="uts.wsd.DiaryApplication" scope="application">
- <jsp:setProperty name="diaryApp" property="filePath" value="<%=filePath%>"/>
- </jsp:useBean>
- <%
- String password = request.getParameter("password");
- String email = request.getParameter("email");
- Users users = diaryApp.getUsers();
- User user = users.login(email, password);
- %>
- <%
- if (user != null) {
- session.setAttribute("user", user);
- %>
- <fieldset>
- <legend>loginAction.jsp</legend>
- <p>Login successful. Click <a href="index.jsp"> here</a> to return to the main page.</p>
- </fieldset>
- <% } else {%>
- <fieldset>
- <legend>loginAction.jsp</legend>
- <p>Password incorrect. Click <a href="login.jsp"> here</a> to try again.</p>
- <%}%>
- </fieldset>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement