I've set up a dynamic web project using Eclipse EE and added a jsp page.
The page is set as the welcome page when the project is run on a server and shows an input box along with a submit button.
My question is how can I pass the value entered into the input box to my HelloServlet class on button click?
Does anyone have any advice on how I could about this?
The hello jsp page layout is as follows:
<%@ 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>Fibonacci Sequence</title>
</head>
<body>
<form action="HelloServlet">
<b>Fibonacci Sequence Length </b> <br>
<input type="text" name="fibNum"size="20px" style="font-size:30pt;height:60px" >
</form>
</body>
</html>
And this is the servlet class set up which extends HttpServlet:
public class HelloServlet extends HttpServlet {
int fibNum;
//parse input from hello.jsp input box
//and assign to fibNum variable
}