You can submit to the same page: file1.jsp and do the processing there. Take the data from the request. The first time you go to the page, the request will be empty so you can use that check. When you submit then you request will not by null:
file1.jsp
<form action="file1.jsp" >
<input type="text" name="data_1" />
</form>
When you submit to the same page:
String data1 = request.getParameter(data_1);
But the first time you go to the page there will not be any data_1 in the request so:
file1.jsp
String data1 = request.getParameter(data_1);
if (data1!=null) {
// calcuate data
// get answers
}
<body>
<%
if (data1!=null) {
%>
// show answers
<%
}
%>
<form action="file1.jsp" >
<input type="text" name="data_1" />
</form>
</body>
javaAddict
Nearly a Senior Poster
3,329 posts since Dec 2007
Reputation Points: 1,014
Solved Threads: 448