Results 1 to 2 of 2
  1. #1
    BOJANM is offline Member
    Join Date
    Mar 2011
    Posts
    7
    Rep Power
    0

    Default help with redirect

    here is code
    PHP Code:
    <%@ page language="java" contentType="text/html; charset=UTF-8"
    	pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>	
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Система за управление на магазин</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <style type="text/css">
    /*----------Text Styles----------*/
    .ws6 {
    	font-size: 8px;
    }
    
    .ws7 {
    	font-size: 9.3px;
    }
    
    .ws8 {
    	font-size: 11px;
    }
    
    .ws9 {
    	font-size: 12px;
    }
    
    .ws10 {
    	font-size: 13px;
    }
    
    .ws11 {
    	font-size: 15px;
    }
    
    .ws12 {
    	font-size: 16px;
    }
    
    .ws14 {
    	font-size: 19px;
    }
    
    .ws16 {
    	font-size: 21px;
    }
    
    .ws18 {
    	font-size: 24px;
    }
    
    .ws20 {
    	font-size: 27px;
    }
    
    .ws22 {
    	font-size: 29px;
    }
    
    .ws24 {
    	font-size: 32px;
    }
    
    .ws26 {
    	font-size: 35px;
    }
    
    .ws28 {
    	font-size: 37px;
    }
    
    .ws36 {
    	font-size: 48px;
    }
    
    .ws48 {
    	font-size: 64px;
    }
    
    .ws72 {
    	font-size: 96px;
    }
    
    .wpmd {
    	font-size: 13px;
    	font-family: 'Arial';
    	font-style: normal;
    	font-weight: normal;
    }
    
    /*----------Para Styles----------*/
    DIV,UL,OL /* Left */ {
    	margin-top: 0px;
    	margin-bottom: 0px;
    }
    </style>
    <%! private static String htmlEscape(String text) {
    		if (text == null) {
    			return "";
    		}
    		StringBuilder escapedText = new StringBuilder();
    		for (int i = 0; i < text.length(); i++) {
    			char ch = text.charAt(i);
    			if (ch == '<')
    				escapedText.append("&lt;");
    			else if (ch == '>')
    				escapedText.append("&gt;");
    			else if (ch == '&')
    				escapedText.append("&amp;");
    			else if (ch == '\"')
    				escapedText.append("&quot;");
    			else
    				escapedText.append(ch);
    		}
    		String result = escapedText.toString();
    		return result;
    	}%>
    </head>
    
    <body background="images/bubblegreen.jpg">
    
    <div id="text1"
    	style="position: absolute; overflow: hidden; left: 218px; top: 255px; width: 55px; height: 25px; z-index: 1">
    <div class="wpmd">
    <div><font class="ws12">Name </font>:</div>
    </div>
    </div>
    
    <div id="text2"
    	style="position: absolute; overflow: hidden; left: 218px; top: 299px; width: 77px; height: 24px; z-index: 2">
    <div class="wpmd">
    <div><font class="ws12">Password</font></div>
    </div>
    </div>
    
    <div id="text3"
    	style="position: absolute; overflow: hidden; left: 342px; top: 200px; width: 168px; height: 20px; z-index: 4">
    <div class="wpmd">
    <div><font class="ws12">Pls Loggin or Register</font></div>
    <div><BR>
    </div>
    </div>
    </div>
    
    <div id="text4"
    	style="position: absolute; overflow: hidden; left: 599px; top: 565px; width: 196px; height: 32px; z-index: 7">
    <div class="wpmd">
    <div><font class="ws12">Всички права запазени!</font></div>
    </div>
    </div>
    
    <div id="text5"
    	style="position: absolute; overflow: hidden; left: 205px; top: 90px; width: 422px; height: 27px; z-index: 8">
    <div class="wpmd">
    <div><font class="ws18">Система за управление на магазин</font></div>
    </div>
    </div>
    
    <form name="form1" method="POST" action="loginservlet" enctype="utf-8"
    	style="margin: 0px">
    <div id="formtext1"
    	style="position: absolute; left: 343px; top: 254px; z-index: 0">
    	<input name="name" type="text" maxlength=20 value="${sessionScope.name}"/></div>
    <c:if test="${param.name eq 'missing'}" >
    <span class="ws14" >
    *Required field
    </span>
    </c:if>
    <div id="formtext2"
    	style="position: absolute; left: 343px; top: 299px; z-index: 3">
    	<input name="password" type="password" maxlength=10 value="${sessionScope.name}"/></div>
    <c:if test="${param.name eq 'missing'}" >
    <span class="ws14" >
    *Required field
    </span>
    </c:if>
    
    
    <c:if test="${param.name eq ' ' and param.password eq ' '}" >
    <c:set var="name" value="${param.name}" scope="session" />
    <c:set var="password" value="${param.password}" scope="session" />
    </c:if>
    <div id="formbutton1"
    	style="position: absolute; left: 343px; top: 352px; z-index: 5"><input
    	name="login" type="submit" value="login"></div>
    <div id="formbutton2"
    	style="position: absolute; left: 430px; top: 352px; z-index: 6"><input
    	name="register" type="submit" value="register"></div>
    </form>
    
    <c:redirect url="index.jsp" >
    <c:if test="${param.name eq ' '}" >
    <c:param name="name" value="missing" />
    </c:if>
    <c:if test="${param.password eq ' '}" >
    <c:param name="password" value="missing" />
    </c:if>
    </c:redirect>
    </body>
    </html>

    why redirect not work ?

  2. #2
    akiravelmont is offline Member
    Join Date
    Mar 2011
    Location
    bangalore
    Posts
    61
    Rep Power
    0

    Default

    in redirect url place the '/' before the jsp file
    <c:redirect url="/index.jsp" >

Similar Threads

  1. How to redirect to a specified location from a jsp
    By sasi.tati in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 11-03-2010, 08:54 AM
  2. setRequestProperty() after redirect
    By mrs_sheep in forum Networking
    Replies: 0
    Last Post: 04-09-2010, 06:59 PM
  3. URL Redirect from one TLD to another
    By R@hul in forum Web Frameworks
    Replies: 0
    Last Post: 12-20-2009, 06:10 AM
  4. Redirect IP to 127.0.0.1?
    By Bill89 in forum Advanced Java
    Replies: 12
    Last Post: 12-13-2009, 11:40 AM
  5. How can I redirect in servlet?
    By Heather in forum Java Servlet
    Replies: 1
    Last Post: 07-14-2007, 05:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •