create Selector with doGet mode

Asked

Viewed 38 times

0

Can you help me do this exercise? I need to create a way doGet and then create another file to be the output of my Save the problem and I have no idea how I do this junction between the two... follows the code

package br.com.servlets;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


    public class ServletName extends HttpServlet {

    /**
     * 
     */
    private static final long serialVersionUID = 7475043552851895502L;


    @Override
    public void doGet(HttpServletRequest request, HttpServletResponse response) {

        char primeiroNome = request.getParameter('primeiro').value;
        char segundoNome = request.getParameter('segundo').value;

        var resultado = primeiroNome + " " + segundoNome;

        if(primeiroNome == "" || segundoNome == ""){
                alert("os campos devem ser preenchidos!");
        }else{
            alert(resultado);
        }
    }
}
  • As well "create another file" you are referring to the answer of the get request ?

  • that same friend.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.