The structure of the application is like this:
Encode.jsp
<%--
Document : encode
Created on : Sep 11, 2012, 12:12:41 PM
Author : Sunshine
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>lets do URL encoding!</h1>
<c:url value="http://localhost:8080/SimpleCookies/decode.jsp" var="decoderpage"/>
<a href="<c:out value="${decoderpage}"/>">click here</a>
</body>
</html>
decode.jsp
<%--
Document : decode
Created on : Sep 11, 2012, 12:12:53 PM
Author : Sunshine
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<%
String descriptor;
if(session.isNew())
descriptor="This is a new session";
else
descriptor="This is not a new session";
%>
<br>
<h1>Session description:</h1>
<%=descriptor%>
<br>
<hr>
<%
String id=session.getId();
%>
<br>
<h2>The session Id is:</h2>
<%=id%>
<br>
</body>
</html>
Document : decode
Created on : Sep 11, 2012, 12:12:53 PM
Author : Sunshine
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<%
String descriptor;
if(session.isNew())
descriptor="This is a new session";
else
descriptor="This is not a new session";
%>
<br>
<h1>Session description:</h1>
<%=descriptor%>
<br>
<hr>
<%
String id=session.getId();
%>
<br>
<h2>The session Id is:</h2>
<%=id%>
<br>
</body>
</html>
No comments:
Post a Comment