In many cases, one servlet processes form data, then transfers control to another servlet or JSP to do some more processing or display a confirmation message on the screen. There are two ways of doing this, either the request can be forwarded or the response can be redirected to another servlet or page.
Notice how text displayed in the previous section's example matches the value of the value
attribute of the checkboxes that were clicked and not the labels displayed on the previous page. This might confuse the users. Let's modify the servlet to change these values so that they match the labels, then forward the request to another servlet that will display the confirmation message in the browser.
The new version of MultipleValueFieldHandlerServlet
is shown as follows:
package net.ensode.javaee8book.formhandling; import java.io.IOException; import java.util.ArrayList; import javax.servlet.ServletException; import javax.servlet...