I have a question.
I have 3 jsp page. The first is a menu with 2 button. When I click the first button I want to open the second jsp page. When I click the second button I want to open the third jsp page.
Can you help me? I must use a servlet(it's not a problem, i know it)?
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form name="TrainerMenu" action="TrainerMenu" method="get">
<h1>Benvenuto in LESSON! Scegli l'operazione da effettuare:</h1>
<input type="button" value="Creazione Nuovo Corso" name="CreateCourse" />
<input type="button" value="Gestione Autorizzazioni"
name="AuthorizationManager" />
</form>
</body>
</html>
The page redirect is used to move the redirect response to another resource of the web page. Basically we can call the redirect pages using sendRedirect() method in the jsp on client-side request can be used within the server or outside of the server.
POST method This message comes to the backend program in the form of the standard input which you can parse and use for your processing. JSP handles this type of requests using getParameter() method to read simple parameters and getInputStream() method to read binary data stream coming from the client.
JSP handles form data processing by using following methods: getParameter():It is used to get the value of the form parameter. getParameterValues():It is used to return the multiple values of the parameters. getParameterNames()It is used to get the names of parameters.
The simplest way you can do this is to use java script.
For example, <input type="button" value="load" onclick="window.location='userpage.jsp'" >
You have several options, I'll start from the easiest:
1- Change the input buttons to links, you can style them with css so they look like buttons:
<a href="CreateCourse.jsp">Creazione Nuovo Corso</a>
instead of
<input type="button" value="Creazione Nuovo Corso" name="CreateCourse" />
2- Use javascript to change the action of the form depending on the button you click:
<input type="button" value="Creazione Nuovo Corso" name="CreateCourse"
onclick="document.forms[0].action = 'CreateCourse.jsp'; return true;" />
3- Use a servlet or JSP to handle the request and redirect or forward to the appropriate JSP page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With