Forum » Programiranje » Pomoč glede QueryString v JSP
Pomoč glede QueryString v JSP
noucamp90 ::
Rad bi naredil enostavno prijavno formo, ki te v primeru da ne vneseš vseh podatkov redirecta nazaj oz. na drugo formo, katera te preusmeri nazaj na prijavo. Vendar rad bi, da se prej vnešeni podatki ohranijo...v pijavi.
Hvala
Hvala
It's like a gift you know,...it's like i can't control it...
noucamp90 ::
Platforme informacijskih sistemov FERI MB ?? =)))
It's like a gift you know,...it's like i can't control it...
LeQuack ::
Zelo preprosta forma (v datoteki na primer login.jsp):
<%@ page language="java" contentType="text/html; UTF-8" pageEncoding="UTF-8"%> <% if(request.getMethod().equals("POST") && request.getParameter("login") != null) { if(request.getParameter("username") != null && request.getParameter("username").length() > 0 && request.getParameter("password") != null && request.getParameter("password").length() > 0) response.sendRedirect("http://www.google.si/#q=success"); else { request.setAttribute("user", request.getParameter("username")); request.setAttribute("pass", request.getParameter("password")); } } %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Login</title> </head> <body> <form action="" method="post"> <label>Username</label> <br /> <input type="text" name="username" value="${user}" /> <br /> <label>Pass</label> <br /> <input type="password" name="password" value="${pass}" /> <br /><br /> <input type="submit" name="login" value="Potrdi" /> </form> <br /> </body> </html>
Quack !
Zgodovina sprememb…
- spremenil: LeQuack ()
Vredno ogleda ...
Tema | Ogledi | Zadnje sporočilo | |
---|---|---|---|
Tema | Ogledi | Zadnje sporočilo | |
» | [Java]Shranjevanje/Branje nastavitev za povezavo z podatkovno bazoOddelek: Programiranje | 2644 (2418) | KernelPanic |
» | [Java] JSPOddelek: Programiranje | 667 (504) | Spura |
» | [C#] Simobilov GlasnikOddelek: Programiranje | 4348 (1428) | Mrch |
» | tomcat - problem z encodingomOddelek: Programiranje | 2350 (2264) | kopernik |
» | Java - JBoss - Servlet - getOutputStream() has already been called for this responseOddelek: Programiranje | 1065 (982) | kopernik |