•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 402,750 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,457 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 29082 | Replies: 2 | Solved
![]() |
•
•
Join Date: Aug 2005
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
hi, :p
i am trying to achieve a registration page in JSP. i am using tag library to do this.
c tag library and Sql tag library.
code describe dabove is register.jsp which send info to postregister.jsp. which described below
it is transfering same data 2 times. so i do not understand what to do to compare password and confirm password.
any help would be greateful!!!!!!
i am trying to achieve a registration page in JSP. i am using tag library to do this.
c tag library and Sql tag library.
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:if test="${param.submitted}">
<c:if test="${empty param.name}" var="noname" />
<c:if test="${empty param.pw}" var="nopw" />
<c:if test="${empty param.cpw}" var="nocpw" />
<c:if
test="${not (noname or nopw or nocpw or requestScope.takenName)}">
<c:set value="${param.name}" var="name" scope="request" />
<c:set value="${param.pw}" var="pw" scope="request" />
<c:set value="${param.cpw}" var="cpw" scope="request" />
<jsp:forward page="postregister.jsp"/>
</c:if>
</c:if>
<html>
<head>
</head>
<body bgcolor="CFECEC" >
<form method="post" name="frmRegister">
<input type="hidden" name="submitted" value="true"/>
<script type="text/javascript">
<!--
function add_onclick() {
var TRUE = new Boolean("True")
var FALSE = new Boolean("False")
blnError = FALSE
strError = "The following problems were found in your registration form: \n\n"
if (frmRegister.name.value == "")
{
blnError = TRUE
strError = strError + " - You must provide a Login Name\n"
};
if (frmRegister.pw.value == "")
{
blnError = TRUE
strError = strError + " - You must provide a Password\n"
};
if (frmRegister.cpw.value == "")
{
blnError = TRUE
strError = strError + " - You must confirm your Password\n"
};
if (frmRegister.pw.value != frmRegister.cpw.value)
{
blnError = TRUE
strError = strError + " - Your Password does not match\n"
};
if (blnError == TRUE)
{
strError = strError + "\nPlease correct these mistakes and try again."
alert(strError)
}
else
{
frmRegister.submit()
};
}
//-->
</SCRIPT>
<p align="left"><b> Register <hr> </p>
<p align="center"><b>Please complete the following registration form</b> <hr><br><br>
<img src="dmu.jpg" alt="DMU University" align="left">
<img src="dmu.jpg" alt="DMU University" align="right">
<table BORDER="0" ALIGN="CENTER" VALIGN="TOP" CELLPADDING=2 CELLSPACING=0>
<tr>
<td><Strong>Username</strong></td>
<td><input type="text" name="name" value="<c:out value="${param.name}" />"
/>
</td>
</tr>
<tr>
<td><Strong>Password</strong></td>
<td> <input type="password" name="pw" value="<c:out value="${param.pw}"/>"
/>
<tr>
<td><Strong>Confirm password</strong></td>
<td> <input type="password" name="cpw" value="<c:out value="${param.cpw}"/>"
/>
<tr><td> </td>
<td><input type="submit" value="register"LANGUAGE=javascript onclick="return add_onclick()" />
</td>
</tr>
</table>
<img src="dmu.jpg" alt="DMU University" align="left">
<img src="dmu.jpg" alt="DMU University" align="right">
</form>
</body>
</html>
code describe dabove is register.jsp which send info to postregister.jsp. which described below
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:choose>
<c:when test ="${param.pw == param.cpw}">
<sql:setDataSource
dataSource= "jdbc/ma123"
scope="session"/>
<sql:transaction isolation="serializable">
<sql:query var="result" >
select username from rptable where username=?
<sql:param value="${requestScope.name}" />
</sql:query>
<sql:update>
insert into rptable(username,password) VALUES (?,?);
<sql:param value="${requestScope.name}" />
<sql:param value="${requestScope.pw}" />
</sql:update>
</sql:transaction>
</c:when>
<c:otherwise>
<c:redirect url="register.jsp" >
</c:redirect>
</c:otherwise>
</c:choose>
<%----
<c:set var="user" scope="session" value="${requestScope.name}" />
---%>
<jsp:forward page="login.jsp"/>
<%----
it trasfering same data 2 times in database.
---%>
it is transfering same data 2 times. so i do not understand what to do to compare password and confirm password.
any help would be greateful!!!!!!
![]() |
•
•
•
•
•
•
•
•
DaniWeb JSP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- how to compare a string to null... (C++)
- Compare String with Strings (Visual Basic 4 / 5 / 6)
- no matching function for call to 'strcmp(std::string&, std::string&)' (C++)
- How to compare string value (Java)
- Question about comparing a string with a character (C++)
- Help with String Comparison (C++)
- string comparison in VB.net (VB.NET)
Other Threads in the JSP Forum
- Previous Thread: Jsp page to insert data
- Next Thread: jsp exception



Linear Mode