Search This Blog

Total Pageviews

ProgramResourceServlet Example Extending HttpServlet

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Enumeration;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class ProgramResourceServlet extends HttpServlet

   public void init() throws HttpServlet {

    public void doGet(HttpServletRequest req, HttpServletResponse res) throws Servlet Exception, IOException {
        handleServletRequest(req, res);

    public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
        handleServletRequest(req, res);

    public void handleServletRequest(HttpServletRequest req, HttpServletResponse res) throws IOException {

        PrintWriter out = res.getWriter();

        Enumeration<String> parameterNames = req.getParameterNames();

        while (parameterNames.hasMoreElements()) {

            String name = parameterNames.nextElement();

            String[] paramValues = req.getParameterValues(name);
            for (int i = 0; i < paramValues.length; i++) {
                String paramValue = paramValues[i];
                out.write("Param Value " + paramValue);

No comments:

gradlew : The term 'gradlew' is not recognized as the name of a cmdlet, function, script file , or operable program

The command gradlew was not found, but does exist in the current location.  Windows PowerShell does not load commands from the current locat...