Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Redirct page in Tilse with JSTL

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Redirect not work in this code,but this come print messages with (<c:out value=" "/>),its work,so help me how to redirect page in Tilse with JSTL

<%@ taglib prefix="tiles"uri="http://jakarta.apache.org/struts/tags-tiles" %>
<%@ taglib prefix="c"uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<sql:setDataSource var="dataSource" driver="sun.jdbc.odbc.JdbcOdbcDriver"url="jdbc:odbc:sql"user=""password=""/>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

</head>
<body text="wite">
<center>
<form method="post">
<table border="0">
<tbody align="left">
<tr><br/>
<td>Email ID</td>
<td><input type="text" name="email" size="40"></td>
<td width="60"></td>
<td>
Already a Register Member?<br/>
<center><input type="submit" value="Login Now" onclick="document.location.href='<c:url value="/pages/login.jsp" />';return false;"style="width:75pt; height:20pt; background:green;color:white; font-size:13pt;"></center>
</td>
</tr>
<tr>
<td valign="top">Password</td>
<td><input type="password" name="password" size="40"><br/>  <font size="2pt">Password must be atleast 6 characters</font></td>
</tr>
<tr>
<td>Confirm <br/>Password</td>
<td><input type="password" name="con_password" size="40"></td>
</tr>
<tr>
<td>FirstName</td>
<td><input type="text" name="fname" size="40"></td>
</tr>
<tr>
<td>LastName</td>
<td><input type="text" name="lname" size="40"></td>
</tr>
<tr>
<td>Password <br/>Question</td>
<td>
<select name="password_que"style="width:100%" >
<option> Select question</option>
<option value="Who was your childhood hero?" >Who was your childhood hero?</option>
<option value="What is your favourite pastime?" >What is your favourite pastime?</option>
<option value="What is your favourite sports?" >What is your favourite sports?</option>
<option value="What is your pet name?" >What is your pet name?</option>
<option value="Which is your favourite color?" >Which is your favourite color?</option>
</select>
</td>
</tr>
<tr>
<td>Password<br/>Answer</td>
<td><input type="text" name="password_ans" size="40"></td>
</tr>
<tr>
<td>Sex</td>
<td><input type="radio" name="sex" value="male">M<input type="radio" name="sex" value="female">F </td>
</tr>
<tr>
<td>City</td>
<td><select name="city" style="width:100%">
<option >Select city</option>
<option value="Ahmedabad" >Ahmedabad</option>
<option value="Allahabad" >Allahabad</option>
<option value="Aurangabad" >Aurangabad</option>
<option value="Bengalooru" >Bengalooru</option>
<option value="Chandigarh" >Chandigarh</option>
<option value="Chennai" >Chennai</option>
<option value="Delhi" >Delhi</option>
<option value="Faridabad" >Faridabad</option>
<option value="Ghaziabad" >Ghaziabad</option>
<option value="Gurgaon" >Gurgaon</option>
<option value="Hyderabad" >Hyderabad</option>
<option value="Indore" >Indore</option>
<option value="Kanpur" >Kanpur</option>
<option value="Kolkatta" >Kolkatta</option>
<option value="Latur" >Latur</option>
<option value="Lucknow" >Lucknow</option>
<option value="Ludhiana" >Ludhiana</option>
<option value="Mangalore" >Mangalore</option>
<option value="Mumbai" >Mumbai</option>
<option value="Nasik" >Nasik</option>
<option value="Noida" >Noida</option>
<option value="Pune" >Pune</option>
<option value="Raipur" >Raipur</option>
<option value="Vadodara" >Vadodara</option>
</select></td>
</tr>
<tr>
<td>Mobile No.</td>
<td><input type="text" name="mobile" size="40" ></td>
</tr>
<tr>
<td></td>
<td><input type="checkbox" name="accept" value="accept"><br/>  I accept the Terms and Conditions</td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Submit"style="width:75pt; height:20pt; background:green;color:white; font-size:13pt;">    
<input type="reset" value="Reset"style="width:75pt; height:20pt; background:green;color:white; font-size:13pt; "></td>
</tr>

</tbody>
</table>
</form>
<c:if test="${pageContext.request.method=='POST'}">
<c:catch var="exception">
<sql:update dataSource="${dataSource}" var="updatedTable">
insert into ARK.dbo.register values (?,?,?,?,?,?,?,?,?,?,?)
<sql:param value="${param.email}"/>
<sql:param value="${param.password}"/>
<sql:param value="${param.con_password}"/>
<sql:param value="${param.fname}"/>
<sql:param value="${param.lname}"/>
<sql:param value="${param.password_que}"/>
<sql:param value="${param.password_ans}"/>
<sql:param value="${param.sex}"/>
<sql:param value="${param.city}"/>
<sql:param value="${param.mobile}"/>
<sql:param value="${param.accept}"/>
</sql:update>
<c:if test="${updatedTable>=1}">
<c:redirect url="/WEB-INF/File/login.jsp"/>
</c:if>
</c:catch>
<c:if test="${exception!=null}">
<c:out value="Unable to insert data in database." />
</c:if>
</c:if>
</center>
</body>
</html>
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!