» »

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
It's like a gift you know,...it's like i can't control it...

DePutaMadre ::

Tudi jaz se pridružujem temu problemu....

noucamp90 ::

Platforme informacijskih sistemov FERI MB ?? =)))
It's like a gift you know,...it's like i can't control it...

DePutaMadre ::

ja :)

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 ...

TemaSporočilaOglediZadnje sporočilo
TemaSporočilaOglediZadnje sporočilo
»

[Java]Shranjevanje/Branje nastavitev za povezavo z podatkovno bazo

Oddelek: Programiranje
192644 (2418) KernelPanic
»

[Java] JSP

Oddelek: Programiranje
6667 (504) Spura
»

[C#] Simobilov Glasnik

Oddelek: Programiranje
134348 (1428) Mrch
»

tomcat - problem z encodingom

Oddelek: Programiranje
72350 (2264) kopernik
»

Java - JBoss - Servlet - getOutputStream() has already been called for this response

Oddelek: Programiranje
81065 (982) kopernik

Več podobnih tem