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:

java.lang.IllegalArgumentException: Unsupported class file major version 60

- Check the stack trace and version of Java. - Update the correct Java Version to resolve the Exception.