Force a timeout in a JSP

Is there a config file or java method in app server that I can set a timeout for a jsp page and then send a message to the user saying they have to login again?

Hi,
the servlet timeout can be set in the web.xml file. You can write a Servlet filter that checks if a request is within a valid session and if not redirect the request to the login page.
Frank

Similar Messages

  • Updating session-timeout  value thru JSP

    Hi,
    I have a requirement that updates the Session time-out in the path Tomcat\conf\web.xml as given below.
    <!-- ==================== Default Session Configuration ================= -->
    <!-- You can set the default session timeout (in minutes) for all newly -->
    <!-- created sessions by modifying the value below. -->
    <session-config>
    <session-timeout>30</session-timeout>
    </session-config>
    For exanple ,I want to set the session-timeout as 50 thru some html page .The necessary updation into the fle should replace the existing session -timeout 30 with 50.
    The entire process should be done using jsp or servlets or thru general java program.
    Can anyone help me how to resolve this .
    Thanks
    VR

    Since the web.xml is loaded at startup of the server engine and affects the session-timeout of all sessions created in that invocation of the servlet engine I can't see how trying to update this file would help you.
    If you want to update the session timeout after the engine has started up then you must use the method on HttpSession.setMaxInactiveInterval(50).
    Hoep this helps.

  • Can I force a timeout myself on an RFC Call ?

    Hi experts,
    I apologize if this question shouldn't be new.
    The appropriate search terms are quite general and
    therefore throw out hundreds of entries that I didn't
    check completely.
    My question is:
    I want to call an RFC-Module and, regardless of the
    RFC destination settings in SM59 or any timeout settings
    in RZ10, cancel this call myself if I don't have an
    answer after - let's say - 10 seconds.
    Thanks in advance
    Andreas

    What is the RFC doing. If it is a select then you could do something like.
    do 10 times
    select blah blah
    endselect
    if sy-subrc eq 0.
    w_no_timeout = 'X'.
    exit.
    endif.
    call function 'RZL_SLEEP' for 1 second.
    enddo.
    I do not think you can do anything in your calling program as the processing will physically move over to teh RFC destination system.

  • JSP Session Timeout in multiple pages (iframes used)

    Hi,
    Here is my scenario. I have a JSP Page i.e. A.jsp in which I am setting a session timeout to 3 minutes. I also have another JSP included i.e. B.jsp in the same page (A.jsp) using the following code i.e.
    <IFRAME SRC="B.jsp" width="100%" height="800" frameborder="0" align="center">
             <!-- Alternate content for non-supporting browsers -->
    </IFRAME>I am also setting a session timeout to 1 minute in the B.jsp. Now if the session timeout in one of the pages i.e. A.jsp or B.jsp I want to route to a different page i.e. C.jsp.
    Now my problem is if the session timeouts in the B.jsp the C.jsp is shown inplace of the B.jsp page inside A.jsp. Means A.jsp still shows it's content at top and under it C.jsp is shown. I want to route to C.JSP page if a session timeouts in A.jsp or B.jsp and only show C.jsp.
    Any help is appreciated.
    Thanks

    Where exactly I put the javascript. Here is currently I am checking for the session timeout:
    String error = (String) request.getAttribute("Error");
        if (error != null)
            out.write("<center><strong>");
            out.write("<font color=\"Red\">");
            out.write(error);
            out.write("</font>");
            out.write("</strong></center>");
        response.setHeader("Cache-Control","no-cache"); //forces caches to obtain a new copy of the page from the origin server
        response.setHeader("Cache-Control","no-store"); //directs caches not to store the page under any circumstance
        response.setDateHeader("Expires", 0); //causes the proxy cache to see the page as "stale"
        response.setHeader("Pragma","no-cache"); //HTTP 1.0 backward compatibility
        String userName = (String) session.getAttribute("User");
        if (null == userName)
            request.setAttribute("Error", "Session has ended. Please login.");
            RequestDispatcher rd = request.getRequestDispatcher("C.jsp");
            rd.forward(request, response);
    ................The same code is in A.jsp and B.jsp. If I want to use the javascript to check if it's the top frame or not and redirect properly where exactly I need to put that code.
    Thanks

  • How to force a jsp page to reload an "include" file?

    Hi there,
    I'm using WebSphere 4.0.2 with the Java 1.3.1 API.
    Some of my JSP files includes another JSP file as follows:
    <%@include file="constants.jsp"%>The above line came from one of the files entitled "main.jsp".
    Other jsp files on our system can rewrite and update the values in constants.jsp.
    However, when they do so, main.jsp (and the other files that "include" constants.jsp) doesn't take on the new settings unless I either a) reboot the server or b) force a recompile of main.jsp
    Is there any way to have main.jsp pick up when constants.jsp is updated and use the new values without manual intervention?
    Thanks!

    You might want to use 'touch' task of ANT. it modifies the jsp page modification time thus forcing the pages to reload.

  • JSP Timeout in OBPM 10GR3

    Hi all,
    My JSP in OBPM 10GR3 is getting timed out quickly. How can I increase the timeout of my JSP?
    Because it shows on the UI workspace that "The task cannot be resumed".
    How can I increase the timeout of my JSP?

    There is probably one more reason why this may be happening. Again, I don't have a running 10g instance to verify this, but may be you can. Once a user clicks on the work item (or left menu in the case of a Global Create) in the inbox, and the dialog opens up, if you do a browser refresh, the popup will close, but probably , behind the scene, the screen-flow is not closed. Now , if you click on your global create again, you may get a Task cannot be resumed.
    Not sure, but try this, and the only way around may be to tell users not to refresh the screen when the popup is up, if they do and get a 'Task cannot be resumed' , they will have to log out and log back in.

  • Set timeout in JSP?

    Hi, is possible to set timeout in a JSP?? For instance, when the user clicks on the a hyperlink it will open a page and after a time interval, the page will auto close and call the same JSP function to open the same page but with different values in it...

    Hmm.. do u think it will work whereby the user will just need to click on a hyperlink once, then it will pass different value to a Javascript function each time. Coz the hyperlink that the user clicks will get the values from a text file (all the values retrieved are stored in a Vector.) which is passed to the Javascript function for loading an applet. As the applet will load some data out, hence, i need to wait till the applet finish loading, then i can call the same Javascript function again, but a different value...

  • Handling requests with a single JSP

    Is it possible to route all requests in a given folder to one JSP? I'd like requests like:
    /calendar/Home.ics
    to go to
    /calendar/index.jsp
    I know I can do this with a Servlet, but I'm trying to run an application-wide bean when someone calls one of the /calendar/*ics files.
    Thanks!
    Ben

    Thanks, I was able to figure the answer myself..
    I am writing a simple page to handle the loading of calendars in lieu of having webdav. I have a servlet handling the data load (from calendar to MySQL database). Then I have a JSP area that uses an application bean to hold the information from the database (database sometimes takes 30 sec to respond). Within webdav, it would only work with the servlet area, and I needed to take the updated calendar info and force a refresh in the JSP area to know that there was a change.
    Sorry for the odd details. If you are interested in something like that, just post here, and I'll make the code available on SourceForge when I'm done.
    Ben

  • Why wlappc ANT task forces aways the generation of the EJB classes ?

    I've got a problem with the ANT task "wlappc" witch interfaces Weblogic compilator.
    In fact, I would like to execute the ebj compilation only when needed (if the deployment descriptor or a class changed for example).
    It seems that this is the default behavior and the 'forcegeneration' option of the wlappc Ant task can change it (the doc is below).
    forceGeneration :
    Forces generation of EJB and JSP classes. Without this flag, the classes will not be regenerated unless a checksum indicates that it is necessary.
    So I wrote :
    <wlappc source="${descriptors}/CommandeEntities" output="${build}/CommandsEntities.jar" keepgenerated="true" verbose="true" forcegeneration="false">
         <classpath refid="ejb.classpath"/>
    </wlappc>
    but I got the folowing result :
    ejbjar:
    [wlappc] Warning, output location exists H:\devWv2\wv2\build\CommandesEntities.jar
    [wlappc] Created working directory: C:\DOCUME~1\vdoneva\LOCALS~1\Temp\appcgen_1221729775921_CommandesEntities
    [wlappc] 18 sept. 2008 11:22:59 weblogic.diagnostics.debug.DebugLogger debug
    [wlappc] FIN: [VersionHelper] Recompiling because no previous hashes found
    [wlappc] 18 sept. 2008 11:22:59 weblogic.diagnostics.debug.DebugLogger debug
    [wlappc] FIN: [EJBCompiler] Compliance Checker said bean was compliant
    [wlappc] 18 sept. 2008 11:22:59 weblogic.diagnostics.debug.DebugLogger debug
    [wlappc] FIN: [EJBCompiler] Generating Bean Sources
    [wlappc] 18 sept. 2008 11:22:59 weblogic.diagnostics.debug.DebugLogger debug
    [wlappc] FIN: [EJBCompiler] Generating source for ejb WCritereListeMulticritere
    [wlappc] 18 sept. 2008 11:22:59 weblogic.diagnostics.debug.DebugLogger debug
    [wlappc] FIN: [EJBCompiler] Generated the following sources for this EJB: [C:\DOCUME~1\vdoneva\LOCALS~1\Temp\appcgen_1221729775921_CommandesEntities\com\experian\wv2\db\WCritereListeMulticritere_u6449c_LocalHomeImpl.java, C:\DOCUME~1\vdoneva\LOCALS~1\Temp\appcgen_1221729775921_CommandesEntities\com\experian\wv2\db\WCritereListeMulticritere_u6449c_ELOImpl.java]
    [wlappc] 18 sept. 2008 11:22:59 weblogic.diagnostics.debug.DebugLogger debug
    [wlappc] FIN: [EJBCompiler] Generating Persistence Sources
    [wlappc] 18 sept. 2008 11:22:59 weblogic.diagnostics.debug.DebugLogger debug
    [wlappc] FIN: [EJBCompiler] Generating Bean Sources
    [wlappc] 18 sept. 2008 11:22:59 weblogic.diagnostics.debug.DebugLogger debug
    [wlappc] FIN: [EJBCompiler] Generating source for ejb Document
    [wlappc] 18 sept. 2008 11:23:00 weblogic.diagnostics.debug.DebugLogger debug
    [wlappc] FIN: [EJBCompiler] Generated the following sources for this EJB: [C:\DOCUME~1\vdoneva\LOCALS~1\Temp\appcgen_1221729775921_CommandesEntities\com\experian\wv2\db\Document_6vm6yi_LocalHomeImpl.java, C:\DOCUME~1\vdoneva\LOCALS~1\Temp\appcgen_1221729775921_CommandesEntities\com\experian\wv2\db\Document_6vm6yi_ELOImpl.java]
    [wlappc] 18 sept. 2008 11:23:02 weblogic.diagnostics.debug.DebugLogger debug
    [wlappc] FIN: [EJBCompiler] Generating Persistence Sources
    [wlappc] 18 sept. 2008 11:23:02 weblogic.diagnostics.debug.DebugLogger debug
    [wlappc] FIN: [EJBCompiler] Compiling EJB sources
    [wlappc] Note: Some input files use unchecked or unsafe operations.
    [wlappc] Note: Recompile with -Xlint:unchecked for details.
    [wlappc] 18 sept. 2008 11:23:10 weblogic.diagnostics.debug.DebugLogger debug
    [wlappc] FIN: [EJBCompiler] Recompilation completed
    [wlappc] 18 sept. 2008 11:23:10 weblogic.diagnostics.debug.DebugLogger debug
    [wlappc] FIN: [EJBCompiler] Rmic completed
    [wlappc] Compilation completed successfully.
    [jar] Updating jar: H:\devWv2\wv2\build\CommandesEntities.jar
    BUILD SUCCESSFUL
    All the classes witch hasn't changed has been checked and regenerated. The compliler says "Recompiling because no previous hashes found".
    But why ? It could be besause it creates a different working directory each time I execute this ant task ? Is this working directory configurable ?
    Would you have any idea of what's happening ?
    Thanks.

    You can find this in the 'org\apache\tools\ant\taskdefs\defaults.properties'
    file of %wl-home%\server\lib\ant\ant.jar
    --Sathish
    <Michael Lee> wrote in message news:[email protected]..
    I mean the definition of "wlappc" not the help for wlappc???thx.
    i.e.
    where can i find the sentence list below:
    <taskdef name="wlappc" classname="weblogic.ant.taskdefs.j2ee.Appc"/>
    I mean which files this "taskdef" is being in .

  • Newbie ques about timeout

    Actually is there a way to set the timeout on a JSP page? Say you invoke a SQL query that takes a long time to return.

    You can change the timeout of your current session with the 'setMaxInactiveInterval(...)' method in the HttpSession class, like this:
       int secondsTimeOut = 3600; // 1 hour timeout
       session.setMaxInactiveInterval(secondsTimeOut); // set the current session to timeout in 1 hour
    ...

  • How to clear session in JSP?

    I searched yahoo, and found that it seemed not easy to force invalid the session using jsp, compared to php just three lines:
    session_start();
    session_unset();
    session_destroy();
    How to acheive this using JSP? Must I follow these (quite complex) steps like this one?
    http://sdc.sun.co.jp/javasystem/technote/cluster/jsp.html
    Any simplier method?
    Thx.

    Not at all, it's very simple.
    <%
    session.removeAttribute("attributeName");
    %>
    This HttpSession API document shows all methods that can be called on the session object : http://java.sun.com/javaee/5/docs/api/javax/servlet/http/HttpSession.html

  • Does WAR updates JSP timestamps on Tomcat?

    I answered another forum post with an answer that I'm not certain is correct.
    For the sake of argument, if you have a Tomcat-based website up and running, and Tomcat has compiled the JSPs on that site, subsequent changes to any included files are not recognized unless Tomcat is forced to recompile the parent JSP. This is usually by updating the timestamp on the parent.
    It is possible to deploy a WAR file to a live copy of Tomcat, that is, you don't need to restart it.
    If the WAR file has say, hello.jsp and hello.jsp has the same timestamp as the currently used version, does deploying the WAR file cause Tomcat to think the new hello.jsp is a change to the original, and therefore must be recompiled?
    I realize this is actually fairly easy to test, but I'm hoping someone knows the answer offhand?

    On deploying the WAR Tomcat unpacks the WAR, thus when accessing the JSP it does not see that the actual JSP file has been replaced (as you stated the timestamp on that is identical).
    Therefore there are only 2 scenarios in which Tomcat would recompile the JSP on call:
    1) when/if Tomcat is configured to discard compiled JSPs on reloading a web application (this might be theoretical. I don't know if Tomcat offers that option)
    2) when/if Tomcat discards compiled JSPs when redeploying a webapp.
    This of course changes your question to: does Tomcat delete compiled JSPs when redeploying a webapp :)

  • URGENT - Forcing a custom locale in the BC4J/JBO framework

    Hi,
    How can I force a locale in the JSP/JBO framework, something similar to:
    alter session set nls_territory =
    or
    alter session set nls_date_format =
    I tried to get the SessionImpl and forced a new Locale, but it seems it is in the JBOimpl first set, so anything I tried had no success.
    Please please advise !
    TIA,
    Seb.

    But this doesn't solve the problem. Calling alter session will change how numbers and dates are rendered by the database, but the business components still store them as Numbers and Dates, rendering them in their own way. How do we change the way jbo.domain.Numbers and jbo.domain.Dates are rendered as String?

  • JSP recompilation problem - losing text fragments

    Hi,
    I'm working on Oracle JDeveloper 10G and Oracle App Server 10G (9.0.4). Have the same problem on both. The following JSP fragment:
    <tr<%= (idx.intValue()%2==0)?" class=bg3":"" %> height="30">
    is in a loop where idx is incremented by 1. The page compiles and runs fine initially. If it is changed, then OC4J recompiles it resulting that the even rows print properly
    <tr class=bg3 height="30">
    but the odd rows instead of printing
    <tr height="30">
    it only prints
    height="30">
    i.e. doesn't print the "<tr" and the empty string. If the project is re-build in JDeveloper, that fixes the situation. My problem is that now the same happened on the Oracle App Server deployment, and I cannot force it to compile the JSP properly.
    Any suggestions?
    Thanks.

    Well I found out how to get EL to be ignored:
    <%@ page contentType="text/html; charset=UTF-8" isELIgnored="true" %>
    but output is now
    +hello ${name}+
    when before it was
    hello
    *So the tag is receiving the template text, but it's not evaluating the ${name} parameter.*
    Reading the J2EE Tutorial, I don't think I'm doing anything wrong - but I obviously am! anyone shed any light, even a suggestion?
    I'm using Tomcat 5.5 and servlet 2.4
    "When used to specify a fragment attribute, the body of the jsp:attribute element can contain only static text and standard and custom tags; it cannot contain scripting elements"
    "JSP fragments can be parametrized via expression language (EL) variables in the JSP code that composes the fragment. _The EL variables are set by the tag handler, thus allowing the handler to customize the fragment each time it is invoked_"

  • Using Netbeans 5 and compiling a JSP obtain an error

    Dear All
    I'm using a JSP with this code
    &#65279;<%@ page contentType="text/html; charset=UTF-8" errorPage="../error/messageError.jsp" language="java"
         import = "java.security.Principal"
         import = "com.mycompany.myProduct.MyProductConfig"
         import = "com.mycompany.otherProduct.db.api.connection.TConnectionFactory"
         import = "com.mycompany.otherProduct.db.api.connection.TConnection"
         import = "com.mycompany.otherProduct.db.api.connection.TServerNotAvailableException"
         import = "com.mycompany.myProduct.user.login.User"
         import="java.util.*"
         import="javax.servlet.jsp.jstl.core.Config"
    %>
    <% // Setup session variables to display menus correctly
         session.setAttribute("title",...
    and I force the compilation of the JSP, obtaining this -->
    public void _jspService(HttpServletRequest request, HttpServletResponse response)
            throws java.io.IOException, ServletException {
        JspFactory _jspxFactory = null;
        PageContext pageContext = null;
        HttpSession session = null;
        ServletContext application = null;
        ServletConfig config = null;
        JspWriter out = null;
        Object page = this;
        JspWriter _jspx_out = null;
        PageContext _jspx_page_context = null;
        try {
          _jspxFactory = JspFactory.getDefaultFactory();
          response.setContentType("text/html; charset=UTF-8");
          pageContext = _jspxFactory.getPageContext(this, request, response,
                         "../error/messageError.jsp", true, 8192, true);
          _jspx_page_context = pageContext;
          application = pageContext.getServletContext();
          config = pageContext.getServletConfig();
          session = pageContext.getSession();
          out = pageContext.getOut();
          _jspx_out = out;
      out.write('���');
          out.write('\r');
          out.write('\n');
    // Setup session variables to display menus correctlyWhat happen with out.write in bold??
    I'm using jsdk 1.4.2_08
    Thanks for any help

    I have the same problem. im using Eclipse 3.1 and WL9.1.
    Any suggestions?

Maybe you are looking for