I don't know why your JSP contains three input fields when you are only going to process one in the servlet. Why can't you do all three in one go? How does the servlet know which one you want to process (are they in three different forms)?
When you press your submit button, the servlet will be called to process the results. When it has finished, it should redirect back to the JSP including any calculation results as parameters. In the JSP, you should check to see if any result parameters are present and if so, display them.
When the JSP is first called (presumably from a link), the URL won't contain any result parameters, so none should be displayed.
If this is simply a case of performing a calculation based on the user input (ie. if it doesn't require server-side data), why not just do this with JavaScript? That way, the page won't change at all (apart from displaying the results of the calculation).
Main Topics
Browse All Topics





by: dualsoulPosted on 2003-11-10 at 00:21:21ID: 9712889
hm...why do you want to call your servlet 3 times?
i think it's more suitable to get all parameters from user -> call servlet, which will calcalate result -> reirect to result .jsp page, providing result info as JavaBean