WEB开发网
开发学院软件开发Java 如何在JSP中实现Forward 阅读

如何在JSP中实现Forward

 2007-12-23 12:35:55 来源:WEB开发网   
核心提示://File: index.jsp<Html><!--Copyright (c) 1999 The Apache Software Foundation.All rights reserved.--><% double freeMem = Runtime.getRuntime().fre
//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>

(出处:http://www.cncms.com)


Tags:如何 JSP 实现

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接