I am new to JSP ans servlets. I have written simple jsp code to display registration form when clicked on "SIGN UP" button as below. signup.jsp looks like
<!DOCTYPE html>
<html>
<body>
<h2>Welcome </h2>
<img src="abcd.jpg" alt=" " style="width:500px;height:228px;">
<form name="main" method="get" action="login.jsp">
<input type="submit" name="ter" value="SIGN IN" >
</form>
</body>
</html>
When I run this signup.jsp is getting displayed with image and "SIGN IN" button. When I click on this button, login page is getting displayed on the same page where signup.jsp displayed. How can i modify the jsp code such that SIGN IN details will come in a fresh page instead on the same page. My login.jsp looks like
<%@ include file="index.jsp" %>
<hr/>
<h3>Login Form</h3>
<%
String profile_msg=(String)request.getAttribute("profile_msg");
if(profile_msg!=null){
out.print(profile_msg);
}
String login_msg=(String)request.getAttribute("login_msg");
if(login_msg!=null){
out.print(login_msg);
}
%>
<br/>
<form action="loginprocess.jsp" method="post">
Email:<input type="text" name="email"/><br/><br/>
Password:<input type="password" name="pass"/><br/><br/>
<input type="submit" value="login"/>"
</form>
can anyone suggest me how to write it using JSP only as I am completely new to java script or other technologies also.
This is how my servlet looks like:
@WebServlet("/SignInFunc")
@MultipartConfig
public class MySignInFunc extends HttpServlet {
/** * */
private static final long serialVersionUID = 1L;
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
RequestDispatcher rd = request.getRequestDispatcher("/login.jsp");
rd.forward(request, response);
}
}
when i click on Sign in, fields mentioned in login.jsp
are getting displayed on the same page. I want them on fresh page.