Invoke getMaxInactiveInterval() from JSP

Hi All,

I am trying modify WebSphere Portal 6.0 Theme Default.jsp & head.jspf file to properly invoke a getMaxInactiveInterval() so that I could do setMaxInactiveInterval() afterwards.

Essentially What I am trying to achieve is.

1. Get the Max Inactive Interval of the session from getMaxInactiveInterval()

2. Pass the value to Java Script that will pop up a warning when the mouse/keyboard is idle for almost the same value of the getMaxInactiveInterval()

3. The warning will give user an option to keep the running session.

4. When user invoke that option, it will reset the MaxInactiveInterval value using setMaxInactiveInterval()

The Code related to this is as per below

head.jspf
<%@page import="javax.servlet.http.HttpServlet"%>
<%@page import="javax.servlet.http.HttpServletRequest"%>
<%@page import="javax.servlet.http.HttpServletResponse"%>
<%@page import="javax.servlet.http.HttpSession"%>


<%
String url = (request.getRequestURL()).toString();
String[] urlArray = url.split("/");
String portal = urlArray[4];
String protocol =urlArray[0];
String host = urlArray[2];
String jq_min="<script src='https://"+host+"/wps/java_script_js/jquery.min.js' type='text/javascript'></script>";
String jq_ui="<script src='https://"+host+"/wps/java_script_js/jquery-ui.min.js' type='text/javascript'></script>";
String jq_idletimer= "<script src='https://"+host+"/wps/java_script_js/jquery.idletimer.js' type='text/javascript'></script>";
String jq_idletimeout= "<script src='https://"+host+"/wps/java_script_js/jquery.idletimeout.js' type='text/javascript'></script>";
String keepalive_url= "'https://"+host+"/wps/java_script_js/keepalive.php'";
String intranex_url= "'https://"+host+"/wps/portal'";
String mp_timer_css= "<link href='https://"+host+"/wps/java_script_css/mp_timer.css' rel='stylesheet' type='text/css' />";
String jquery_ui_css= "<link href='https://"+host+"/wps/java_script_css/jquery-ui.css' type='text/css' rel='stylesheet' />";
String idle_sc="10";

if( protocol.equals("https:") == true ){
%>
<%=mp_timer_css%>
<%=jquery_ui_css%>
<style type="text/css">a.ui-dialog-titlebar-close { display:none }</style>
<%
}
%>

Open in new window



Default.jsp
<%@ include file="./head.jspf" %>

[b]<%
HttpServletRequest req = new HttpServletRequest();
HttpSession session = req.getSession();
%>

<%=session.getMaxInactiveInterval()%>[/b]

<%
if( (portal.equals("myportal") == true)&&(protocol.equals("https:")) ){
%>
<div id="dialog" title="Your session is about to expire!">
        <p> <span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 50px 0;"></span>You have been idle for too long,
        <br>Your session will expire in <span id="dialog-countdown" style="font-weight:bold"></span>&nbsp;seconds.</p>
        <p>Do you want to keep working on the session ?</p>
</div>

<div id="dialog_time_out" title="Your session has Expired !">
        <p>Please Click on the "Restart Session" button below</p>
</div>
<%=jq_min%>
<%=jq_ui%>
<%=jq_idletimer%>
<%=jq_idletimeout%>
<script type="text/javascript">
function closeWin() {
    window.open('', '_self', '');
    window.close();
}

// setup the dialog
$("#dialog").dialog({
        autoOpen: false,
        modal: true,
        width: 400,
        height: 200,
        closeOnEscape: false,
        draggable: false,
        resizable: false,
        buttons: {
                'Keep Working': function(){
                        $(this).dialog('close');
                }
        }
});

$("#dialog_time_out").dialog({
        autoOpen: false,
        modal: true,
        width: 400,
        height: 200,
        closeOnEscape: false,
        draggable: false,
        resizable: false,
        buttons: {
                'Restart Session': function(){
                window.open(<%=intranex_url%>);
                closeWin();
                }

        }
});

// cache a reference to the countdown element so we don't have to query the DOM for it on each ping.
var $countdown = $("#dialog-countdown");

// start the idle timer plugin
$.idleTimeout('#dialog', 'div.ui-dialog-buttonpane button:first', {
        idleAfter: <%=idle_sc%>,
        pollingInterval: 1,
        keepAliveURL: <%=keepalive_url%>,
        serverResponseEquals: 'OK',
        onTimeout: function(){
                $("#dialog").dialog("close");
                $("#dialog_time_out").dialog("open");
        },
        onIdle: function(){
                $("#dialog").dialog("open");
        },
        onCountdown: function(counter){
                $countdown.html(counter); // update the counter
        }
});
</script>
<%
}
%>

Open in new window





Everything works OK up until I put in

<%
HttpServletRequest req = new HttpServletRequest();
HttpSession session = req.getSession();
%>
<%=session.getMaxInactiveInterval()%>

Open in new window


Then I Get an Error Like below :
Cannot instantiate the type HttpServletRequest      .... How come?

Root Cause:

com.ibm.ws.jsp.JspCoreException: 
JSPG0049E: /themes/html/IT_Timer_V1.0_20032012/Default.jsp failed to compile : 
JSPG0091E: An error occurred at line: 35 in the file: /themes/html/IT_Timer_V1.0_20032012/Default.jsp
JSPG0093E: Generated servlet error from file: 
	/themes/html/IT_Timer_V1.0_20032012/Default.jsp 
	/opt/IBM/WebSphere/PortalExpress/AppServer/profiles/wp_profile/temp/PICAPORTSTG/WebSphere_Portal/wps/wps.war/themes/html/IT_Timer_V1.0_20032012/_Default.java : 1069 : Cannot instantiate the type HttpServletRequest	
	at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.translateJsp(AbstractJSPExtensionServletWrapper.java:556)	
	at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper._checkForTranslation(AbstractJSPExtensionServletWrapper.java:429)	
	at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.checkForTranslation(AbstractJSPExtensionServletWrapper.java:291)	
	at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:146)	
	at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:639)
	at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.handleRequest(DispatcherServiceImpl.java:93)
	at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.include(DispatcherServiceImpl.java:53)
	at com.ibm.wps.services.dispatcher.Dispatcher.include(Dispatcher.java:50)
	at com.ibm.wps.engine.templates.themes.Default.doDispatch(Default.java:294)
	at com.ibm.wps.engine.templates.themes.Default.render(Default.java:247)
	at com.ibm.wps.engine.templates.ThemeTemplate.render(ThemeTemplate.java:65)
	at com.ibm.wps.engine.phases.WPRenderPhase.processRendering(WPRenderPhase.java:509)
	at com.ibm.wps.engine.phases.WPBaseRenderPhase.execute(WPBaseRenderPhase.java:207)
	at com.ibm.wps.state.phases.AbstractRenderPhase.next(AbstractRenderPhase.java:106)
	at com.ibm.wps.engine.phases.WPAbstractRenderPhase.next(WPAbstractRenderPhase.java:97)
	at com.ibm.wps.engine.Servlet.callPorta(Servlet.java:861)
	at com.ibm.wps.engine.Servlet.doGet(Servlet.java:618)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)	at com.ibm.wps.engine.Servlet.doFilter(Servlet.java:1258)
	at com.ibm.wps.resolver.servlet.ContentHandlerCleanup.doFilter(ContentHandlerCleanup.java:648)
	at com.ibm.wps.resolver.servlet.AbstractFilter.doFilter(AbstractFilter.java:93)
	at com.ibm.wps.engine.Servlet.service(Servlet.java:1249)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1146)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1087)
	at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)
	at com.ibm.wps.engine.ExtendedLocaleFilter.doFilter(ExtendedLocaleFilter.java:113)
	at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
	at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
	at com.ibm.wps.resolver.friendly.servlet.FriendlySelectionFilter.doFilter(FriendlySelectionFilter.java:191)
	at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
	at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
	at com.ibm.wps.mappingurl.impl.URLAnalyzer.doFilter(URLAnalyzer.java:381)
	at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
	at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
	at com.ibm.wps.engine.VirtualPortalFilter.doFilter(VirtualPortalFilter.java:88)
	at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
	at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
	at com.ibm.wps.state.filter.StateCleanup.doFilter(StateCleanup.java:94)
	at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
	at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
	at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
	at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:848)
	at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:691)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:588)
	at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:526)
	at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3574)
	at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:269)
	at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:831)
	at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1478)
	at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:133)
	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:450)
	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:508)
	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:296)
	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:270)
	at com.ibm.ws.ssl.channel.impl.SSLConnectionLink.determineNextChannel(SSLConnectionLink.java:1037)
	at com.ibm.ws.ssl.channel.impl.SSLConnectionLink$MyReadCompletedCallback.complete(SSLConnectionLink.java:644)
	at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1818)
	at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
	at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
	at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
	at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)	at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:196)
	at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:751)
	at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881)
	at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1551)

Open in new window


Can somebody help?
BCSITSAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chaitu chaituCommented:
in jsp session and request comes like implicit objects.dont instantiate those objects.

just put like this.

<%=session.getMaxInactiveInterval()%>
0
chaitu chaituCommented:
apart from that HttpServletRequest is an interface so you cannot instaitae an interface.

as i said reuqest,session,config etc comes as implicit objects in jsp,you can use them directly.

http://docs.oracle.com/javaee/1.3/api/javax/servlet/http/HttpServletRequest.html
0
chaitu chaituCommented:
Default.jsp
<%@ include file="./head.jspf" %>

[b<%=session.getMaxInactiveInterval()%>[/b]

<%
if( (portal.equals("myportal") == true)&&(protocol.equals("https:")) ){
%>
<div id="dialog" title="Your session is about to expire!">
        <p> <span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 50px 0;"></span>You have been idle for too long,
        <br>Your session will expire in <span id="dialog-countdown" style="font-weight:bold"></span>&nbsp;seconds.</p>
        <p>Do you want to keep working on the session ?</p>
</div>

<div id="dialog_time_out" title="Your session has Expired !">
        <p>Please Click on the "Restart Session" button below</p>
</div>
<%=jq_min%>
<%=jq_ui%>
<%=jq_idletimer%>
<%=jq_idletimeout%>
<script type="text/javascript">
function closeWin() {
    window.open('', '_self', '');
    window.close();
}

// setup the dialog
$("#dialog").dialog({
        autoOpen: false,
        modal: true,
        width: 400,
        height: 200,
        closeOnEscape: false,
        draggable: false,
        resizable: false,
        buttons: {
                'Keep Working': function(){
                        $(this).dialog('close');
                }
        }
});

$("#dialog_time_out").dialog({
        autoOpen: false,
        modal: true,
        width: 400,
        height: 200,
        closeOnEscape: false,
        draggable: false,
        resizable: false,
        buttons: {
                'Restart Session': function(){
                window.open(<%=intranex_url%>);
                closeWin();
                }

        }
});

// cache a reference to the countdown element so we don't have to query the DOM for it on each ping.
var $countdown = $("#dialog-countdown");

// start the idle timer plugin
$.idleTimeout('#dialog', 'div.ui-dialog-buttonpane button:first', {
        idleAfter: <%=idle_sc%>,
        pollingInterval: 1,
        keepAliveURL: <%=keepalive_url%>,
        serverResponseEquals: 'OK',
        onTimeout: function(){
                $("#dialog").dialog("close");
                $("#dialog_time_out").dialog("open");
        },
        onIdle: function(){
                $("#dialog").dialog("open");
        },
        onCountdown: function(counter){
                $countdown.html(counter); // update the counter
        }
});
</script>
<%
}
%>

Open in new window

0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

for_yanCommented:
This is a good example of access to session in JSP:
http://roseindia.net/jsp/jspsession/SessionManagement.shtml
0
BCSITSAuthor Commented:
i have done exactly that before....

but then it came back with

Root Cause:
com.ibm.ws.jsp.JspCoreException: 
JSPG0049E: /themes/html/IT_Timer_V1.0_20032012/Default.jsp failed to compile : 
JSPG0091E: An error occurred at line: 34 in the file: /themes/html/IT_Timer_V1.0_20032012/Default.jspJSPG0093E: Generated servlet error from file: /themes/html/IT_Timer_V1.0_20032012/Default.jsp /opt/IBM/WebSphere/PortalExpress/AppServer/profiles/wp_profile/temp/PICAPORTSTG/WebSphere_Portal/wps/wps.war/themes/html/IT_Timer_V1.0_20032012/_Default.java : 1068 : session cannot be resolved
	at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.translateJsp(AbstractJSPExtensionServletWrapper.java:556)
	at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper._checkForTranslation(AbstractJSPExtensionServletWrapper.java:429)
	at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.checkForTranslation(AbstractJSPExtensionServletWrapper.java:291)
	at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:146)
	at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:639)
	at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.handleRequest(DispatcherServiceImpl.java:93)
	at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.include(DispatcherServiceImpl.java:53)
	at com.ibm.wps.services.dispatcher.Dispatcher.include(Dispatcher.java:50)
	at com.ibm.wps.engine.templates.themes.Default.doDispatch(Default.java:294)
	at com.ibm.wps.engine.templates.themes.Default.render(Default.java:247)
	at com.ibm.wps.engine.templates.ThemeTemplate.render(ThemeTemplate.java:65)
	at com.ibm.wps.engine.phases.WPRenderPhase.processRendering(WPRenderPhase.java:509)
	at com.ibm.wps.engine.phases.WPBaseRenderPhase.execute(WPBaseRenderPhase.java:207)
	at com.ibm.wps.state.phases.AbstractRenderPhase.next(AbstractRenderPhase.java:106)
	at com.ibm.wps.engine.phases.WPAbstractRenderPhase.next(WPAbstractRenderPhase.java:97)
	at com.ibm.wps.engine.Servlet.callPortal(Servlet.java:861)
	at com.ibm.wps.engine.Servlet.doGet(Servlet.java:618)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
	at com.ibm.wps.engine.Servlet.doFilter(Servlet.java:1258)

Open in new window

0
chaitu chaituCommented:
in Default.jsp remove all other things and only put session object;

<%=session.getMaxInactiveInterval()%>

Open in new window

0
for_yanCommented:
You acn access any parameter of session conveniently through JSTL:
look at this example:
http://jexp.ru/index.php/Java_Tutorial/JSTL/Session



<%@ taglib uri="http://java.sun.ru/jstl/core" prefix="c" %>
<html>
  <head>
    <title>Page Data Example</title>
  </head>
  <body>
    <h3>&#160;</h3>
    <table border="1" width="539">
      <tr>
        <td colspan="2" width="529" bgcolor="#0000FF">
          <b>
            <font color="#FFFFFF" size="4">HTTP
            Session(pageContext.session.)</font>
          </b>
        </td>
      </tr>
      <tr>
        <td width="210">Creation Time</td>
        <td width="313">&#160; 
        <c:out value="${pageContext.session.creationTime}" />
        </td>
      </tr>
      <tr>
        <td width="210">Session ID</td>
        <td width="313">&#160; 
        <c:out value="${pageContext.session.id}" />
        </td>
      </tr>
      <tr>
        <td width="210">Last Accessed Time</td>
        <td width="313">&#160; 
        <c:out value="${pageContext.session.lastAccessedTime}" />
        </td>
      </tr>
      <tr>
        <td width="210">Max Inactive Interval</td>
        <td width="313">&#160; 
        <c:out
        value="${pageContext.session.maxInactiveInterval}" />
        seconds</td>
      </tr>
      <tr>
        <td width="210">You have been on-line for</td>
        <td width="313">&#160; 
        <c:out
        value="${(pageContext.session.lastAccessedTime-pageContext.session.creationTime)/1000}" />
        seconds</td>
      </tr>
    </table>
  </body>
</html>

Open in new window

0
BCSITSAuthor Commented:
Thanks for_yan & chaituu

But when I invoke session straight away i get
1068 : session cannot be resolved

Doesn't that mean that object session needs to be defined first?
0
for_yanCommented:
No, it should be implicitly defined with JSP, you should not instatntiae request of session explicitly in your code
0
chaitu chaituCommented:
"Doesn't that mean that object session needs to be defined first?"
not required.


have u done what i have asked you ?
0
BCSITSAuthor Commented:
Hi Chaituu

Yes, i belive i have done that you said.

Please see Default.jsp

<%=session.getMaxInactiveInterval()%>

<%
if( (portal.equals("myportal") == true)&&(protocol.equals("https:")) ){
%>
<div id="dialog" title="Your session is about to expire!">
        <p> <span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 50px 0;"></span>You have been idle for too long,
        <br>Your session will expire in <span id="dialog-countdown" style="font-weight:bold"></span>&nbsp;seconds.</p>
        <p>Do you want to keep working on the session ?</p>
</div>

<div id="dialog_time_out" title="Your session has Expired !">
        <p>Please Click on the "Restart Session" button below</p>
</div>


<%=jq_min%>
<%=jq_ui%>
<%=jq_idletimer%>
<%=jq_idletimeout%>

<script type="text/javascript">

function closeWin() {
    window.open('', '_self', '');
    window.close();
}

// setup the dialog
$("#dialog").dialog({
        autoOpen: false,
        modal: true,
        width: 400,
        height: 200,
        closeOnEscape: false,
        draggable: false,
        resizable: false,
        buttons: {
                'Keep Working': function(){
                        $(this).dialog('close');
                }
        }
});

$("#dialog_time_out").dialog({
        autoOpen: false,
        modal: true,
        width: 400,
        height: 200,
        closeOnEscape: false,
        draggable: false,
        resizable: false,
        buttons: {
                'Restart Session': function(){
                window.open(<%=intranex_url%>);
                closeWin();
                }

        }
});

// cache a reference to the countdown element so we don't have to query the DOM for it on each ping.
var $countdown = $("#dialog-countdown");

// start the idle timer plugin
$.idleTimeout('#dialog', 'div.ui-dialog-buttonpane button:first', {
        idleAfter: <%=idle_sc%>,
        pollingInterval: 1,
        keepAliveURL: <%=keepalive_url%>,
        serverResponseEquals: 'OK',
        onTimeout: function(){
                $("#dialog").dialog("close");
                $("#dialog_time_out").dialog("open");
        },
        onIdle: function(){
                $("#dialog").dialog("open");
        },
        onCountdown: function(counter){
                $countdown.html(counter); // update the counter
        }
});

</script>
<%
}
%>

Open in new window


but i get

Root Cause:com.ibm.ws.jsp.JspCoreException: 
JSPG0049E: /themes/html/IT_Timer_V1.0_20032012/Default.jsp failed to compile : 
JSPG0091E: An error occurred at line: 35 in the file: /themes/html/IT_Timer_V1.0_20032012/Default.jsp
JSPG0093E: Generated servlet error from file: /themes/html/IT_Timer_V1.0_20032012/Default.jsp /opt/IBM/WebSphere/PortalExpress/AppServer/profiles/wp_profile/temp/PICAPORTSTG/WebSphere_Portal/wps/wps.war/themes/html/IT_Timer_V1.0_20032012/_Default.java : 1068 : session cannot be resolved	
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.translateJsp(AbstractJSPExtensionServletWrapper.java:556)	
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper._checkForTranslation(AbstractJSPExtensionServletWrapper.java:429)	
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.checkForTranslation(AbstractJSPExtensionServletWrapper.java:291)	
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:146)	
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:639)

Open in new window

0
Sathish David Kumar NArchitectCommented:
<%session.getMaxInactiveInterval()%>


use scriptlet not experssion
0
chaitu chaituCommented:
dravidnsr,

yea you are correct.
0
BCSITSAuthor Commented:
Hi All

Thanks for the Reply
Here is my latest Default.jsp

with <%session.getMaxInactiveInterval()%>


<%session.getMaxInactiveInterval()%>

<%
if( (portal.equals("myportal") == true)&&(protocol.equals("https:")) ){
%>
<div id="dialog" title="Your session is about to expire!">
        <p> <span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 50px 0;"></span>You have been idle for too long,
        <br>Your session will expire in <span id="dialog-countdown" style="font-weight:bold"></span>&nbsp;seconds.</p>
        <p>Do you want to keep working on the session ?</p>
</div>

<div id="dialog_time_out" title="Your session has Expired !">
        <p>Please Click on the "Restart Session" button below</p>
</div>


<%=jq_min%>
<%=jq_ui%>
<%=jq_idletimer%>
<%=jq_idletimeout%>

<script type="text/javascript">

function closeWin() {
    window.open('', '_self', '');
    window.close();
}

// setup the dialog
$("#dialog").dialog({
        autoOpen: false,
        modal: true,
        width: 400,
        height: 200,
        closeOnEscape: false,
        draggable: false,
        resizable: false,
        buttons: {
                'Keep Working': function(){
                        $(this).dialog('close');
                }
        }
});

$("#dialog_time_out").dialog({
        autoOpen: false,
        modal: true,
        width: 400,
        height: 200,
        closeOnEscape: false,
        draggable: false,
        resizable: false,
        buttons: {
                'Restart Session': function(){
                window.open(<%=intranex_url%>);
                closeWin();
                }

        }
});

// cache a reference to the countdown element so we don't have to query the DOM for it on each ping.
var $countdown = $("#dialog-countdown");

// start the idle timer plugin
$.idleTimeout('#dialog', 'div.ui-dialog-buttonpane button:first', {
        idleAfter: <%=idle_sc%>,
        pollingInterval: 1,
        keepAliveURL: <%=keepalive_url%>,
        serverResponseEquals: 'OK',
        onTimeout: function(){
                $("#dialog").dialog("close");
                $("#dialog_time_out").dialog("open");
        },
        onIdle: function(){
                $("#dialog").dialog("open");
        },
        onCountdown: function(counter){
                $countdown.html(counter); // update the counter
        }
});

</script>
<%
}
%>

Open in new window


but I still get

Root Cause:com.ibm.ws.jsp.JspCoreException: 
JSPG0049E: /themes/html/IT_Timer_V1.0_20032012/Default.jsp failed to compile : 
JSPG0091E: An error occurred at line: 35 in the file: /themes/html/IT_Timer_V1.0_20032012/Default.jsp
JSPG0093E: Generated servlet error from file: /themes/html/IT_Timer_V1.0_20032012/Default.jsp /opt/IBM/WebSphere/PortalExpress/AppServer/profiles/wp_profile/temp/PICAPORTSTG/WebSphere_Portal/wps/wps.war/themes/html/IT_Timer_V1.0_20032012/_Default.java : 1068 : session cannot be resolvedJSPG0091E: An error occurred at line: 35 in the file: /themes/html/IT_Timer_V1.0_20032012/Default.jsp
JSPG0093E: Generated servlet error from file: /themes/html/IT_Timer_V1.0_20032012/Default.jsp /opt/IBM/WebSphere/PortalExpress/AppServer/profiles/wp_profile/temp/PICAPORTSTG/WebSphere_Portal/wps/wps.war/themes/html/IT_Timer_V1.0_20032012/_Default.java : 1068 : Syntax error, insert ";" to complete Statement	
	at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.translateJsp(AbstractJSPExtensionServletWrapper.java:556)	
	at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper._checkForTranslation(AbstractJSPExtensionServletWrapper.java:429)

Open in new window

0
chaitu chaituCommented:
semicolon;
<%session.getMaxInactiveInterval();

%>
0
BCSITSAuthor Commented:
Hi Chaituu

Thanks for the Support on this...

I get the same msg session cannot be resolved      

Root Cause:com.ibm.ws.jsp.JspCoreException: JSPG0049E: /themes/html/IT_Timer_V1.0_20032012/Default.jsp failed to compile : JSPG0091E: An error occurred at line: 34 in the file: /themes/html/IT_Timer_V1.0_20032012/Default.jspJSPG0093E: Generated servlet error from file: /themes/html/IT_Timer_V1.0_20032012/Default.jsp /opt/IBM/WebSphere/PortalExpress/AppServer/profiles/wp_profile/temp/PICAPORTSTG/WebSphere_Portal/wps/wps.war/themes/html/IT_Timer_V1.0_20032012/_Default.java : 1068 : session cannot be resolved	
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.translateJsp(AbstractJSPExtensionServletWrapper.java:556)	
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper._checkForTranslation(AbstractJSPExtensionServletWrapper.java:429)

Open in new window

0
Sathish David Kumar NArchitectCommented:
May i KNow

what is this object ? is it java object

<%=jq_min%>
<%=jq_ui%>
<%=jq_idletimer%>
<%=jq_idletimeout%>
0
chaitu chaituCommented:
can you post your latest code
0
BCSITSAuthor Commented:
Hi Dravid

Those ase Strinsg specified in the head.jspf
I have posted it up at the start of this thread

Hi Chaituu

here is the latest code

<%session.getMaxInactiveInterval();%>

<%
if( (portal.equals("myportal") == true)&&(protocol.equals("https:")) ){
%>
<div id="dialog" title="Your session is about to expire!">
        <p> <span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 50px 0;"></span>You have been idle for too long,
        <br>Your session will expire in <span id="dialog-countdown" style="font-weight:bold"></span>&nbsp;seconds.</p>
        <p>Do you want to keep working on the session ?</p>
</div>

<div id="dialog_time_out" title="Your session has Expired !">
        <p>Please Click on the "Restart Session" button below</p>
</div>


<%=jq_min%>
<%=jq_ui%>
<%=jq_idletimer%>
<%=jq_idletimeout%>

<script type="text/javascript">

function closeWin() {
    window.open('', '_self', '');
    window.close();
}

// setup the dialog
$("#dialog").dialog({
        autoOpen: false,
        modal: true,
        width: 400,
        height: 200,
        closeOnEscape: false,
        draggable: false,
        resizable: false,
        buttons: {
                'Keep Working': function(){
                        $(this).dialog('close');
                }
        }
});

$("#dialog_time_out").dialog({
        autoOpen: false,
        modal: true,
        width: 400,
        height: 200,
        closeOnEscape: false,
        draggable: false,
        resizable: false,
        buttons: {
                'Restart Session': function(){
                window.open(<%=intranex_url%>);
                closeWin();
                }

        }
});

// cache a reference to the countdown element so we don't have to query the DOM for it on each ping.
var $countdown = $("#dialog-countdown");

// start the idle timer plugin
$.idleTimeout('#dialog', 'div.ui-dialog-buttonpane button:first', {
        idleAfter: <%=idle_sc%>,
        pollingInterval: 1,
        keepAliveURL: <%=keepalive_url%>,
        serverResponseEquals: 'OK',
        onTimeout: function(){
                $("#dialog").dialog("close");
                $("#dialog_time_out").dialog("open");
        },
        onIdle: function(){
                $("#dialog").dialog("open");
        },
        onCountdown: function(counter){
                $countdown.html(counter); // update the counter
        }
});

</script>
<%
}
%>

Open in new window

0
for_yanCommented:
I just tried this simplest JSP:
<html>
      <head>
            <title>Using a JavaBean</title>
      </head>
      <body>
      <%@ page language="java" import="cal.*" %>
      <jsp:useBean id="car" scope="session" class="CarBean" />


            <h2>Using a JavaBean</h2>
           Session time <%=session.getMaxInactiveInterval()%> <br>
      
      </body>
</html>

Open in new window


and got this output:

Using a JavaBean
Session time 1800 

Open in new window


SO this exactly:

  Session time <%=session.getMaxInactiveInterval()%>

works
0
chaitu chaituCommented:
as i said remove all other things except put this in jsp file and see what happens.

<%

session.getMaxInactiveInterval();
%>
0
for_yanCommented:
Put exactly:
<%=session.getMaxInactiveInterval()%>

and you should see the time

If you do not see the time then it happens becauuse of what you do next in JSP - whicvh causes error
But you also need this:
 <%@ page language="java"%>
on top
0
for_yanCommented:
No, without "=" you would nlot see any printout

<html>
      <head>
            <title>Using a JavaBean</title>
      </head>
      <body>
      <%@ page language="java" import="cal.*" %>
      <jsp:useBean id="car" scope="session" class="CarBean" />


            <h2>Using a JavaBean</h2>
           Session time <%session.getMaxInactiveInterval();%> <br>
      
      </body>
</html>

Open in new window


Output:

Using a JavaBean
Session time 

Open in new window

0
for_yanCommented:
This is absolutley simplest JSP page and it works for me:

<html>
      <head>
            <title>Using a JavaBean</title>
      </head>
      <body>
      <%@ page language="java" %>
     

            <h2>Using a JavaBean</h2>
           Session time <%=session.getMaxInactiveInterval()%> <br>
      
      </body>
</html>

Open in new window


Output:

Using a JavaBean
Session time 1800 

Open in new window


So the same should work for you, try this simplest variant first
0
Sathish David Kumar NArchitectCommented:
what you  want to?? do u want to really print the value or setting the timing intervel ??
0
for_yanCommented:
This oprints maxInactivity and also session ID:

<html>
      <head>
            <title>Using a JavaBean</title>
      </head>
      <body>
      <%@ page language="java" %>
     

            <h2>Using a JavaBean</h2>
           Session time <%=session.getMaxInactiveInterval()%> <br>
            Session id <%=session.getId()%> <br>
      
      </body>
</html>

Open in new window


Output:

Using a JavaBean
Session time 1800
Session id 5F1EFE36A30B238AABF6237270026702 

Open in new window

0
for_yanCommented:
You can also get last accessed time:

<html>
      <head>
            <title>Using a JavaBean</title>
      </head>
      <body>
      <%@ page language="java" %>
     

            <h2>Using a JavaBean</h2>
           Session time <%=session.getMaxInactiveInterval()%> <br>
            Session id <%=session.getId()%> <br>
             Session last accessed Time <%=session.getLastAccessedTime()%> <br>
      
      </body>
</html>

Open in new window


Output:

Using a JavaBean
Session time 1800
Session id 5F1EFE36A30B238AABF6237270026702
Session last accessed Time 1333086267503 

Open in new window

0
BCSITSAuthor Commented:
Hi All

Thanks for the support.
I think i found the culprit...

<%@ page session="false" buffer="none" %>
was at the top of the Default.jsp

Changed that to true
and i got the Session time

Thanks all

Thanks
0
for_yanCommented:
Great, you found it.
this is the last one - which calculates how mauch is left:

<html>
      <head>
            <title>Using a JavaBean</title>
      </head>
      <body>
      <%@ page language="java" %>
     

            <h2>Using a JavaBean</h2>
           Session time <%=session.getMaxInactiveInterval()%> <br>
            Session id <%=session.getId()%> <br>
             Session last accessed Time <%=session.getLastAccessedTime()%> <br>
             Current time <%=(new java.util.Date()).getTime()%> <br>
             Time left, msec: <%=(1800000-((new java.util.Date()).getTime()-session.getLastAccessedTime()))%> <br>
      
      </body>
</html>

Open in new window


Output:

Using a JavaBean
Session time 1800
Session id 5F1EFE36A30B238AABF6237270026702
Session last accessed Time 1333086505366
Current time 1333086622586
Time left, msec: 1682780 

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sathish David Kumar NArchitectCommented:
as i said remove all other things except put this in jsp file and see what happens.

<%

session.getMaxInactiveInterval();
%>

Open in new window


this solution given by me ?? but ............
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.