Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- RequestDispatcher rd = request.getRequestDispatcher("/altaPerfil.jsp");
- rd.forward(request, response);
- <form action="altaPerfilServlet"
- name = "frmValidar"
- method='post' enctype='multipart/form-data' >
- Nick:
- <br />
- <input type="text" name="nick"
- id="nick" onkeypress="deshabilita()"
- value="${requestScope.nick}" />
- <input type=button name="botonValidar"
- id="botonValidar" value="Validar datos"
- onclick="validarNick()" />
- <!--Note: the javascript validarNick() verifies the nick field and if it is -->
- <!--not empty then it calls frmValidar.submit()-->
- FileItemFactory factory = new DiskFileItemFactory();
- ServletFileUpload upload = new ServletFileUpload(factory);
- List<FileItem> fields = upload.parseRequest(request);
- Iterator<FileItem> it = fields.iterator();
- <!--here i process all the FileItems and obtain their values-->
- <!--then i talk to a java app (which acts as a server, providing -->
- <!--the data and a series of classes) and obtain a boolean value(esValido)-->
- <!--that tells me if the nick is available(true) or taken(false)-->
- <!--finally: -->
- request.setAttribute("esValido", esValido);<!-- saving the boolean -->
- String nick=request.getParameter("nick");
- request.setAttribute("nick", nick);
- RequestDispatcher rd = request.getRequestDispatcher("/altaPerfil.jsp");
- rd.forward(request, response);
- <form method="post" action="servlet_url">
- No : <input type="text" name="no" value="${requestScope.no}"/>
- Name : <input type="text" name="name" value="${requestScope.name}"/>
- <input type="submit"/>
- </form>
- String no=request.getParameter("no");
- String name=request.getParameter("name");
- //other statements
- request.setAttribute("no",no);
- request.setAttribute("name",name);
- RequestDispatcher rd = request.getRequestDispatcher("/sample.jsp");
- rd.forward(request, response);
Add Comment
Please, Sign In to add comment