[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Invoke getMaxInactiveInterval() from JSP

Posted on 2012-03-29
30
Medium Priority
?
2,476 Views
Last Modified: 2012-06-27
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?
0
Comment
Question by:BCSITS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 9
  • 7
  • +1
30 Comments
 
LVL 20

Expert Comment

by:chaitu chaitu
ID: 37785648
in jsp session and request comes like implicit objects.dont instantiate those objects.

just put like this.

<%=session.getMaxInactiveInterval()%>
0
 
LVL 20

Expert Comment

by:chaitu chaitu
ID: 37785652
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
 
LVL 20

Expert Comment

by:chaitu chaitu
ID: 37785655
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 47

Expert Comment

by:for_yan
ID: 37785658
This is a good example of access to session in JSP:
http://roseindia.net/jsp/jspsession/SessionManagement.shtml
0
 

Author Comment

by:BCSITS
ID: 37785659
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
 
LVL 20

Expert Comment

by:chaitu chaitu
ID: 37785675
in Default.jsp remove all other things and only put session object;

<%=session.getMaxInactiveInterval()%>

Open in new window

0
 
LVL 47

Expert Comment

by:for_yan
ID: 37785679
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
 

Author Comment

by:BCSITS
ID: 37785682
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
 
LVL 47

Expert Comment

by:for_yan
ID: 37785684
No, it should be implicitly defined with JSP, you should not instatntiae request of session explicitly in your code
0
 
LVL 20

Expert Comment

by:chaitu chaitu
ID: 37785686
"Doesn't that mean that object session needs to be defined first?"
not required.


have u done what i have asked you ?
0
 

Author Comment

by:BCSITS
ID: 37785688
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
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 37785691
<%session.getMaxInactiveInterval()%>


use scriptlet not experssion
0
 
LVL 20

Expert Comment

by:chaitu chaitu
ID: 37785696
dravidnsr,

yea you are correct.
0
 

Author Comment

by:BCSITS
ID: 37785701
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
 
LVL 20

Expert Comment

by:chaitu chaitu
ID: 37785704
semicolon;
<%session.getMaxInactiveInterval();

%>
0
 

Author Comment

by:BCSITS
ID: 37785711
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
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 37785712
May i KNow

what is this object ? is it java object

<%=jq_min%>
<%=jq_ui%>
<%=jq_idletimer%>
<%=jq_idletimeout%>
0
 
LVL 20

Expert Comment

by:chaitu chaitu
ID: 37785714
can you post your latest code
0
 

Author Comment

by:BCSITS
ID: 37785720
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
 
LVL 47

Expert Comment

by:for_yan
ID: 37785730
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
 
LVL 20

Assisted Solution

by:chaitu chaitu
chaitu chaitu earned 1000 total points
ID: 37785735
as i said remove all other things except put this in jsp file and see what happens.

<%

session.getMaxInactiveInterval();
%>
0
 
LVL 47

Expert Comment

by:for_yan
ID: 37785736
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
 
LVL 47

Expert Comment

by:for_yan
ID: 37785740
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
 
LVL 47

Expert Comment

by:for_yan
ID: 37785749
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
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 37785751
what you  want to?? do u want to really print the value or setting the timing intervel ??
0
 
LVL 47

Expert Comment

by:for_yan
ID: 37785756
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
 
LVL 47

Expert Comment

by:for_yan
ID: 37785766
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
 

Author Comment

by:BCSITS
ID: 37785772
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
 
LVL 47

Accepted Solution

by:
for_yan earned 1000 total points
ID: 37785775
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
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 37785810
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question