package ArmazenaCookies;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Enumeration;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class CookiesFormulario extends javax.servlet.http.HttpServlet {
static final long serialVersionUID = 1L;
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String[] dadosForm = new String[2];
Enumeration formulario = request.getParameterNames();
PrintWriter out = response.getWriter();
while(formulario.hasMoreElements()){
//armazena os dados em um array
for(int i=0; i < dadosForm.length; i++){
dadosForm[i] = (String)formulario.nextElement();
}//end for
}//end while
//gravar cookies
[b]PESSOAL AQUI DÁ O ERRO...ELE ACEITA SÓ STRING, COMO FAÇO[/b]
Cookie cookieForm = new Cookie("cookieForm",dadosForm);
cookieForm.setMaxAge(60);
cookieForm.setSecure(false);
cookieForm.setComment("formulario");
}//end method
}//end class
Você precisa transformar o seu array em String para colocar no array, e posteriormente transformar a String de volta no array.
Eu não pesquisei, mas pela classe Array você consegue formatar o Array em uma única String.
E pela classe StringTokenizer você consegue fazer o contrário. Ou então pelo método split da classe String.