| | |
JSTL compare string
Please support our JSP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved
![]() |
•
•
Join Date: Aug 2005
Posts: 1
Reputation:
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.
JSP Syntax (Toggle Plain Text)
<%@ 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
JSP Syntax (Toggle Plain Text)
<%@ 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!!!!!!
Awn, I think he may already sorted or give up on this problem. Post is 3 year OLD!!!!!!!!
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
![]() |
Similar Threads
- How to compare string value (Java)
- 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++)
- 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: retrieve request parameter of 1 frame to another
- Next Thread: JSP: Problem with Integer Values, not assigning type correctly
| Thread Tools | Search this Thread |
apache backbutton combobox connection database development directorystructure dynamicpagetitles eclipse frames glassfish imagetodatabse imageupload internet java javaee javascript jsf jsp jsppagetitles levels mvc2 mvcmodel2 network parameters passing ping printinserverinsteadofclient redirect request.getparameter response servlet servletdopost()readxml sessions software ssl state_saving_method stocks sun tomcat tutorial video web






