Jsp Forward Demo : JSP Forwarding « JSP « Java






Jsp Forward Demo

//File: index.jsp
<html>
<!--
  Copyright (c) 1999 The Apache Software Foundation.  All rights 
  reserved.
-->

<% 
   double freeMem = Runtime.getRuntime().freeMemory();
   double totlMem = Runtime.getRuntime().totalMemory();
   double percent = freeMem/totlMem;
   if (percent < 0.5) { 
%>

<jsp:forward page="one.jsp"/>

<% } else { %>

<jsp:forward page="two.html"/>

<% } %>

</html>

//File: one.jsp
<html>
<!--
  Copyright (c) 1999 The Apache Software Foundation.  All rights 
  reserved.
-->

<body bgcolor="white">
<font color="red">

VM Memory usage < 50%.
</html>

//File: two.html

<html>
<!--
  Copyright (c) 1999 The Apache Software Foundation.  All rights 
  reserved.
-->

<body bgcolor="white">
<font color="red">

VM Memory usage > 50%.
</html>


           
       








JspForward.zip( 89 k)

Related examples in the same category

1.Use Forward In Jsp
2.Servlet Forward Jsp