On Thu, 1 Apr 2004 21:43:47 -0700, Vinay <[EMAIL PROTECTED]> wrote:

>Hi,
>
> I want to determine the RAM(memory) on the user's system, and then
>display the appropriate web page to the user. I just want to know how to
>do it with JSP.
>
> Can anyone help me out?
>
>Vinay
>
> ==========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-
INTEREST".
>For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
>
>Some relevant archives, FAQs and Forums on JSPs can be found at:
>
> http://java.sun.com/products/jsp
> http://archives.java.sun.com/jsp-interest.html
> http://forums.java.sun.com
> http://www.jspinsider.com

There are methods available in java.lang.Runtime class to get memory
details.

Sample snippet:

<%
Runtime rt = Runtime.getRuntime();
long totalMemory = rt.totalMemory();
System.out.println("Total memory allocated to VM: " + rt.totalMemory());
System.out.println("Memory currently available: " + rt.freeMemory());
%>

based on the total memory, forward the user to appropriate page.

For ex,

<%
if(totalMemory <= size1) {
%>
<jsp:forward page="page1.jsp"/>
<%} else if(totalMemory <= size2){
%>
<jsp:forward page="page2.jsp"/>
<%}%>

You may want to check free Memory to forward instead of total memory.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

Reply via email to