Session Timout JSP Page Forward

Hi All,
I am currently working on a JSP site and want to add a JSP page forward that takes place when the user's session times out after a period of inactivity.
I have created a servlet that implements HttpSessionBindingListener and has methods in place for valueBound and valueUnboud. The methods are getting called as they should, however because there isn't an HttpResponse object I cannot do a response.forward....
So my question: Is the HttpSessionBindingListener the correct interface to be implementing to accomplish my goal? If so, how do I forward the user to the login page? If not, what should I use and how do I forward the user to the login page?
Thanks for your time and help.
Aaron

valueUnbound method? Arent you using a Model
View Controller type architecture? The servlet
is mainly used to to handle logic and navigate
to the appropriate view(your java server pages).
The code I supplied should be placed in the service
method of your servlet.. then it can handle the
request and determine where to go from there. Your
servlet should have three methods, the doPost, the
doGet, and the service method. The doPost and Get
should pass the request and response objects on to
the service method. Any other logic should be handled
in other classes that you create. The service method
basically decides what the next page should be.
Hope this helps..

Similar Messages

  • Session in JSP page

    Hi all,
    i built a web application now i want to use session in JSP pages to remember some variable such as password and entered date because i need them in later pages and i also don't want to send them via HTML hidden field. I actually don't know how to use session. Can anyone please just tell me how to create a session and store a variable and also how to retrieve the data from the session.
    Another thing is guys can anyone tell me please that say i am user and i selected some items from a HTML select list and i submitted that and logged off the system now when i login later again i want to see those choices selected by default , i know it might have been done by sessions can anyone please tell me.
    THANKS VERY MUCH

    This is the way u can set and retrieve values from session
    <% session.setAttribute("key","value"); %>
    <% String user=(String)session.getAttribute("user");
    %>
    regards
    Shanu

  • Problem catching handle ejb session in jsp pages

    Hello,
    i'm trying to develop an ejb application.
    I have created an ejb session stateful in a second ejb stateless :
    InitialContext ic = new InitialContext();
    UserSessionHome home = (UserSessionHome)ic.lookup("UserSessionHome");
    UserSession conn = home.create(login,mdp);
    Then I have to retrieve this ejb session stateful in a jsp page in order to remove it or to call some others functions developped in the bean interface.
    I think that the solution for this problem are the ejb handles.
    But i don't know how and where I can store them.
    Can you help me?
    Thanx
    Sophie

    You put them in the HttpSession. For "how," read the API docs.

  • Html select change to make JSP page forward keeping the exsting field value

    Hello, All,
    I am trying to make the change of a selection box in HTML form to reload the page and populate the second selection box based on the value in the first selection box. The content of the second selection box is from database....
    i used a javascript funtion and called it by the onChange(), the onChange redirect the page to the same page. However all my previous input is lost and the second selection box is not populated based on the first selection box.
    The question is how do I keep the current input and reload the page based on the change of a selection box?
    Please help..
    Thanks..
    Here is the code
    <script language=javascript type="text/javascript">
    function forward(){
    location.href="trdCapDetail.jsp";
    </script>
    <select name=vehicle onChange="forward()">
    <%for(int i = 0; i < Vehicle.getAll().size(); i++){
         Vehicle vehicle = (Vehicle)(Vehicle.getAll().elementAt(i));     
         out.write("<option value=" + vehicle.getKey()+" >" + vehicle.getCode() + "</option>");
    %>

    Ok two things.
    1 - you need to submit the value which was selected.
    2 - you need to repopulate the select box with it.
    1 - you need to submit the value which was selected.
    You do this by either appending the parameter to the url, or calling form.submit().
    <script language=javascript type="text/javascript">
    // either set parameter on url manually
    function forward(control){
    var param = control.value;
    location.href="trdCapDetail.jsp?vehicle=" + param;
    // or submit the form:
    function forward(control){
      control.form.submit();
    <% pageContext.setAttribute("vehicles", Vehicle.getAll() ) ; %>
    <form name="myForm" action="trdCapDetail.jsp"> 
      <select name="vehicle" onchange="forward(this)">
          <c:forEach var="vehicle" items="${vehicles}">
            <option value="<c:out value="${vehicle.key}"/>"> <c:out value="${vehicle.code}"/> </option>
          </c:forEach>
       </select>   
    </form>2: populating the control
    One way is to use javascript again:
    <c:if test="${not empty param.vehicle}">
      <script language="javascript">
        document.myForm.vehicle.value = "<c:out value="${param.vehicle}"/>";
      </script>
      </c:if>
    // or scriptlet code if you must
    <%
    String selectedVehicle = request.getParameter("vehicle");
    if (selectedVehicle != null){  %>
      <script language="javascript">
        document.myForm.vehicle.value = "<%= selectedVehicle%>";
      </script>
    <%
    %>The other way to keep the current input is to generate the string "selected" inside the option tag for the selected item. In your loop, check if the current id equals the submitted id, and print "selected" if it is.
    Hope this helps,
    evnafets

  • Session Login and Logout in jsp page

    hi
    i am developing jsp page
    i completed except logout.jsp page
    my login page is in Jsp format and then business Logic in servlet and then get method & set method in bean.java
    i have login and then it sucess page there i have singout button
    if i sign out it should go to login page
    how to do
    how to make session invalidate
    how to get session id
    i have one more doubt i should check session invalidate each jsp page
    regarding session login and logout in jsp
    if anybody knows please give me a piece of code regarding login and logout
    Regards
    Akshatha

    This is part of your filter class now you need login.jsp page
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link rel="Stylesheet" type="text/css" href="/PAS/css/site.css"/>
        <title>Automation System | Login Page</title>
    </head>
    <body>
    <div align="center">
        <h1>Photint Automation System</h1>
    </div>
    <br/><br/><br/>
    <center>
        <table border="1" cellpadding="0" cellspacing="0" width="40%" bgcolor="FFFFFFFF">
            <thead>
                <tr>
                    <th align="left" height="30"> <h3>    Login</h3></th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>
                        <div align="center">
                            <form name="LOGIN" action="/PAS/LoginServlet" method="POST">
                                <table border="0">
                                    <tbody>
                                        <tr>
                                            <td height="15"></td>
                                            <td height="15"></td>
                                            <td height="15"></td>
                                            <td height="15"></td>
                                        </tr>
                                        <tr>
                                            <td height="30"></td>
                                            <td align="right" height="30">User Name : </td>
                                            <td align="left"  height="30"><input type="text" name="USERNAME" value="" size="35"  /></td>
                                            <td height="30"></td>
                                        </tr>
                                        <tr>
                                            <td height="30"></td>
                                            <td align="right" height="30">Password : </td>
                                            <td align="left"  height="30"><input type="password" name="PASSWORD" value="" size="35"  /></td>
                                            <td height="30"></td>
                                        </tr>
                                        <tr>
                                            <td height="50"></td>
                                            <td height="50"></td>
                                            <td align="center" height="50"><input type="submit" value="Login" name="Login" />  <input type="reset" value="Reset" name="Reset" /></td>
                                            <td height="50"></td>
                                        </tr>
                                    </tbody>
                                </table>
                            </form>
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>
    </center>
    <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
    <br/><br/><br/>
    <center>Copyright &copy; 2009 Photint FZ LLC</center>
    <center>Powered by Ali Jamali</center>
    <center>Version : 1.0</center>
    </body>
    </html>And you need loginServlet.java
    package com.ali.util.filter;
    import com.ali.entity.user.UserEntity;
    import com.ali.util.HibernateUtil;
    import java.io.IOException;
    import javax.servlet.RequestDispatcher;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    public class LoginServlet extends HttpServlet {
        private static final long serialVersionUID = 1L;
        protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            String username = request.getParameter("USERNAME");
            String password = request.getParameter("PASSWORD");
            if (username == null || username.length() == 0) {
                System.err.println(" Username textfeild is empty ..... !");
                RequestDispatcher dispatcher = request.getRequestDispatcher("Pages/user/LogIn.jsp");
                dispatcher.forward(request, response);
                return;
            if (UserRegistry.isUserLoggedIn(username)) {
                System.out.printf("User [%s] is already logged in. \n", username);
                RequestDispatcher dispatcher = request.getRequestDispatcher("Pages/user/LogIn.jsp");
                dispatcher.forward(request, response);
                return;
            UserEntity user = null;
            try {
                user = (UserEntity) HibernateUtil.load(UserEntity.class, username);
                if (user == null || !user.getPassword().equals(password)) {
                    RequestDispatcher dispatcher = request.getRequestDispatcher("Pages/user/LogIn.jsp");
                    dispatcher.forward(request, response);
                    System.err.println(" Password or username is not valid ..... !");
                    return;
            } catch (Exception e) {
                e.printStackTrace();
                RequestDispatcher dispatcher = request.getRequestDispatcher("Pages/user/LogIn.jsp");
                dispatcher.forward(request, response);
                return;
            HttpSession session = request.getSession();
            System.err.println(request.getRemoteAddr());
            session.setAttribute("username", user.getFirstName());
            session.setAttribute("userType", user.isAdmin());
            UserRegistry.logInUser(username);
            response.sendRedirect("/PAS/index.jsp");
    }finally is you need to just one user can be online at time or need to know how many user & who is online you should at this class also
    package com.ali.util.filter;
    import java.util.ArrayList;
    import java.util.List;
    public class UserRegistry {
        private static final List loggedInUsers = new ArrayList();
        public static void logInUser(String username) {
            loggedInUsers.add(username);
        public static void logoutUser(String username) {
            if (isUserLoggedIn(username)) {
                loggedInUsers.remove(username);
        public static boolean isUserLoggedIn(String username) {
            return loggedInUsers.contains(username);
    }If you have any more Q. or any comment , Most welcome
    Thanks
    Ali Jamali

  • How to use Session scope in jsp page

    Hello, I have login form, where user provides username and password. Then click on submit, it will forward to validation.jsp. Where it will check in database make sure username and password exit. Now i can also retrive accountid of perticular user. I want to put that username and accountid in session scope. so all other pages can use that username and accountid. How can i do that. I'm new at this, so please provide me example too. Here is my code for login.jsp and validation.jsp..
    Validation.jsp
    <%@ page import="java.util.*" %>
    <%@ page import="java.sql.*" %>
    //String name = request.getParameter( "username" );//
    //session.setAttribute( "accountID",accountID );//
    <%
    String connURL = "jdbc:oracle:thin:@orca.csc.ncsu.edu:1521:ORCL";
         Connection conn = null;
         Statement stmt = null;
         ResultSet rs = null;
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    conn = DriverManager.getConnection(connURL, "vapatel","pjdas");
    stmt = conn.createStatement();
    String user=request.getParameter("userName");
    String password=request.getParameter("password");
    boolean entrance=false;
    stmt.excuteQuery("SELECT AccountID From Password WHERE USERNAME='"+user+"'");
    rs = stmt.executeQuery("SELECT * FROM Password WHERE USERNAME='"+user+"' AND PASSWORD='"+password+"'");
    while(rs.next()){
    String dbUser = rs.getString("USERNAME");
    String dbPassword= rs.getString("PASSWORD");
    if ((user.equals(dbUser)) && (password.equals(dbPassword))){
    entrance=true;
    if (entrance==true){%>
    <jsp:forward page="form.jsp"/>
    <%}
    else{%>
    <jsp:forward page="login.jsp"/>
    <%}
    %>

    hi,
    to put something into session scope in a jsp page use:
    session.setAttribute("counter", Integer.toString(5));to retrieve is from a jsp page use:
    String counterAttribute = (String)session.getAttribute("counter");

  • Forwarding to a new jsp page from one jsp  EXCEPTION occured....Help me out

    When i was trying to forward control to invalidSession page from a JSP
    if someone tries to log in without entering password....he must be directed to invalidsession page...
    but this is giving exception on line 6...
    The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: An exception occurred processing JSP page /pages/regError.jsp at line 6
    3: <%@page session="true"%>
    4: <% if(session.getAttribute("password")==null)
    5: {%>
    6: <jsp:forward page="/pages/invalidSession.jsp" />
    7: <%}
    8: %>
    9: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    Stacktrace:
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         web2.Login.processRequest(Login.java:68)
         web2.Login.doPost(Login.java:95)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    root cause
    org.apache.jasper.JasperException: javax.servlet.ServletException: File "/pages/index.jsp" not found
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:696)
         org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:667)
         org.apache.jsp.pages.regError_jsp._jspService(regError_jsp.java:60)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         web2.Login.processRequest(Login.java:68)
         web2.Login.doPost(Login.java:95)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

    From the stack trace it is written:
    org.apache.jasper.JasperException:
    javax.servlet.ServletException:
    File "/pages/index.jsp" not foundYou have to check for path of index.jsp.
    Edited by: ngpgeeta on Jan 20, 2009 8:01 AM

  • Accessing session attribute in output jsp page

    Hi i am not getting any output in jsp page...
    i am getting just heading
    i think some problem with Session attribute..
    if so how to access session been in jsp page
    my code is here
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%--
    The taglib directive below imports the JSTL library. If you uncomment it,
    you must also add the JSTL library to the project. The Add Library... action
    on Libraries node in Projects view can be used to add the JSTL 1.1 library.
    --%>
    <%--
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    --%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Tauvex Search Output</title>
    </head>
    <body>
    Tauvex Search Output
    <table>
    <c:forEach items="${myDataList}" var="myData">
    <tr>
    <td>${myData.Fitsfilename}</td>
    <td>${myData.RA_START}</td>
    <td>${myData.RA_END}</td>
    <td>${myData.DEC_START}</td>
    <td>${myData.DEC_END}</td>
    <td>${myData.telescope}</td>
    <td>${myData.STARTOBS}</td>
    <td>${myData.ENDOBS}</td>
    <td>${myData.FILTER}</td>
    </tr>
    </c:forEach>
    </table>
    <%--
    This example uses JSTL, uncomment the taglib directive above.
    To test, display the page like this: index.jsp?sayHello=true&name=Murphy
    --%>
    <%--
    <c:if test="${param.sayHello}">
    <!-- Let's welcome the user ${param.name} -->
    Hello ${param.name}!
    </c:if>
    --%>
    </body>
    </html>
    plz reply soon
    thanks a lot

    this is what i set in servlet
    request.setAttribute("myDataList", myDataList);
    request.getRequestDispatcher("someJspFile.jsp").forward(request, response);
    how can i access that session attribute in jsp

  • JSP page and the pageContext.forward() method

    I am running JSP pages on a coldfusion site so that a CF page (i.e. login.cfm) hosts my login.jsp page. I want to reload the JSP page without having to reload the cfm page each time. pageContext.forward() does do this, however, it only forwards on to a new page. I want to be able to reload a page with the new URL parameters (e.g. when there is an error, login.jsp will reload and give the user an error). What is a method to reload the page with the proper URL variables?
    The following code does not work:
    pageContext.forward("login.jsp?operation=user_edit&jsessionid=" + f_URLEncode(session.getId()));
    Because it runs from the login.jsp page (the forward command only goes to a new page)

    Just to clarify...
    I log into your site. The first page shown is the CF page. The CF page automatically redirects me to the JSP page. Then what, exactly?
    Does the login page automatically determine my URL, attempt to validate it, and if it doesn't work, it reloads the page?
    The reason I ask is because there is a difference between the resulting HTML page and the JSP class file that generates that HTML page. Generally speaking, most web servers, particularly Tomcat, do not recompile the JSP class file, they just simply pass the parameters to the existing class file, and a new HTML page is generated.
    So technically speaking, every time you visit the login.jsp page, you will get a brand new HTML page. The contents of that page are the same because you presumably pass the same parameters to the class which hasn't changed. But in other words, no, you can't forward to an "old" page that was previously generated by the class - each time the web server calls that class, it creates a "new" page.
    Or are you saying that every time you attempt to forward to the login.jsp page, the system erronously calls the CF page instead?

  • Issue in applying SSL selectively to Login JSP Page--Session getting lost.

    Hi,
    I am facing some issues with SSL configuration on my web site running on tomcat 5.5. I am using jdk 1.5 and form based authentication with JAAS framework.
    The SSL configuration is working perfectly when applied to complete web site, but starts giving problem when applied selectively to some JSP pages. At present I am trying to apply SSL just on the login page.
    When the login screen loads up, the URL in the browser has a protocol "*https*", as expected, but it doesn't gets changed to "*http*" once the user has successfully logged in. Why is the automatic change from https to http not ocurring?
    Also I want to know which is the default page, tomcat will direct the logged in user to, once successfully authenticated using form based login; Is there any way to change this default page to some other page. It looks like that tomcat automatically directs to index.html , once the user has been successfully authenticated, but I am not so sure. My index.html page is having 4 frames; the source of these frames are different JSP pages, which are not under SSL.
    My aim is to apply SSL just on login.jsp so that password doesn't travel in clear text. Once the user is authenticated he should see index.html and the address bar's URL should change it's protocol from https to http.
    Please, find below the code in my web.xml
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>CWA Application</web-resource-name>
    <url-pattern>/about.jsp</url-pattern>
    <url-pattern>/admin_listds.jsp</url-pattern>
    <http-method>DELETE</http-method>
    <http-method>GET</http-method>
    <http-method>POST</http-method>
    <http-method>PUT</http-method>
    </web-resource-collection>
    <auth-constraint>
    <role-name>*</role-name>
    </auth-constraint>
    <user-data-constraint>
    <transport-guarantee>NONE</transport-guarantee>
    </user-data-constraint>
    </security-constraint>
    <security-constraint>
    <web-resource-collection>
    <url-pattern>/*login.jsp*</url-pattern>
    <http-method>GET</http-method>
    <http-method>POST</http-method>
    </web-resource-collection>
    <auth-constraint>
    <role-name>*</role-name>
    </auth-constraint>
    <user-data-constraint>
    <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
    </security-constraint>
    <login-config>
    <auth-method>FORM</auth-method>
    <realm-name>CWA Application</realm-name>
    <form-login-config>
    <form-login-page>/login.jsp</form-login-page>
    <form-error-page>/login.jsp?error=true</form-error-page>
    </form-login-config>
    </login-config>
    <welcome-file-list>
    <welcome-file>login.jsp</welcome-file>
    </welcome-file-list>
    My login. jsp has below code:
    <form name="login" method="POST" action='<%= response.encodeURL(*"j_security_check*") %>' >
    <tr>
    <td width="100%">
    <table width="260" border="0" cellspacing="0" cellpadding="1">
    <tr>
    <td align="left" valign="top" rowspan="4"><img src="images/space.gif" width="15" height="5"></td>
    <td align="right" class="login-user" nowrap ><p>User name: </p></td>
    <td align="left" valign="top"><input maxLength="64" name="j_username" size="20"></td>
    </tr>
    <tr>
    <td align="right" nowrap class="login-user"><p>Password: </p>
    </td>
    <td align="left" valign="top">
    <input maxLength=\"64\" tabindex="2" type="password" name="j_password" size="20">
    </td>
    </tr>
    </form>
    The entries in my server.xml are following:
    <Connector port="8080" maxHttpHeaderSize="8192"
    maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
    enableLookups="false" redirectPort="8443" acceptCount="100"
    connectionTimeout="20000" disableUploadTimeout="true" />
    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
    maxThreads="150" scheme="https" secure="true"
    keystoreFile="${java.home}\lib\security\cacerts" keystorePass="changeit"
    clientAuth="false" sslProtocol="TLS" />
    I have gone through the http://forums.sun.com/thread.jspa?threadID=197150 and tried implementing it; The filter as explained in the thread does gets called but the session values are still lost.
    Please note I am using javascript to go from secure "https" to "http" once the user has successfully logged in The javascript code is as below:
    top.location.href="http://localhost:8080/qtv/index.html." ;
    If I use response.sendRedirect("http://localhost:8080/qtv/index.html") for going to non-secure mode, the index.html page does not gets loaded properly. (Please note that my index.html is made of *4 frames*, as explained earlier. This is a legacy code and frames can't be removed).
    The reason for index.html not getting loaded properly is that the Address bar URL does NOT change its URL and protocol from https (https://localhost:8443/qtv/index.html ) to "*http*" (http://localhost:8080/qtv/index.html) when esponse.sendRedirect() is used ;this is the default behaviour of response.sendRedirect(). And because the protocol in address bar is https, index.html is not able to load the other JSP's in it's frames because of cross-frame-scripting security issues (The other JSP's to be loaded in frames are are NOT secure as discussed earlier).
    Please let know if any way out.
    Thanks,
    Masaai

    Hi
    try to set the maximum interval between requests
    eg:
    session.setMaxInactiveInterval(6000);
    vis

  • Forwarding JSP page through requestdispatcher problem in submiting form

    Hello everyone,
    I am very much new to servlet.
    My problem is somewhat this....
    when i am forwarding one JSP page by requestdispather , there is no problem.But after that when i am trying to submit one html form written inside the jsp page , the request is not submiting the jsp page rather it resides in the servlet.
    The code in servlet is
    RequestDispatcher rd =getServletContext().getRequestDispatcher("/applyConfirm.jsp");
    rd.forward(request,response);
    Now in (applyConfirm.jsp )jsp page one button is there , so when i will click that button the page has to be submitted.But its not submitting rather the request resides in the servlet.
    Dose someone will have any idea.
    Thanks in advance

    First check what sort of button you are using. It should be of "submit" type.
    Check the URL to witch URL it is submitting i.e. Action property in <FORM> tag.
    Make sure for the URLs in the client i.e HTML ex: href, action, and so on use the thumb rule of prefixing "<%=request.getContextPath()%>/" in your JSP or in servlet add it in the java code.
    This should solve the relative URL reference problem.
    Hope this helps.
    Cheers.

  • Using a Statefull Session Bean with RMI on Multiple JSP pages

    Heya all,
    i have a JBoss server running with a statefull bean on it. I want to use it on my JSP pages. But every time I start my JSP-page a NEW INSTANTION of the bean is created! For each user using my page, I want ONE bean.
    Is there anyway to do this? ANything with the sessioncontext?
    I can do it with local beans, using the simple tags in the JSP-page, but they do not work for Remote Beans.
    (I use JNDI)

    hi,
    statefull session beans are client session specific. the instance will exists if client session exits.
    now since u are loading the jsp page again in the other browser, a new instance will be associated with the current session.
    hope it will work.
    sameer

  • How to use a session, created in a jsp page, in a php page

    Hello, forgive me for the newbie question.
    Here is my problem:
    I want to have a jsp page create a session, set some session variables and then redirect to a php page which will access those same session variables.
    I have the redirection worked out, but I can't seem to find out how to use the jsp session in my php script.
    Is this possible at all, and if so, how does it work?

    Note that javascript runs on the client side, and JSP runs on the server. JSP and the session objects are NOT available to javascript in reaction to the user.
    If this function is called only when the page is first created, not when the user interacts with the page, or if you want that value to be constant with respect to the javascript, then you can do this:
    <%
      String someValue = (String)session.getAttribute("theAttributeName");
    %>
    <script type="text/javascript">
         Calendar.setup({inputField:"f_date_dfFirstPmtDate",
                                              button:"f_trigger_dfFirstPmtDate",
                                             singleClick:true,
                                              ifFormat:<%=someVale%>});
    </script>

  • How to redirect a JSP page after the session is killed

    Hello!
    I am quite new to JSP. I have a question about how to redirect a jsp page after the session is killed. Could anyone help?
    thanks a lot in advance!

    You can't, directly. There's no connection betweenthe server and browser.
    even after invalidating the session. we can do it
    directly using the statement
    response.sendRedirect("....");
    or we can use the meta refresh tag.if session is invalidated and if we try to do response.sendRedirect(".. ") it throws IllegalStateException

  • Forward to JSP page without using Navigation Model

    How can I forward to a JSP page without using the Navigation Model?

    It's done in the cardemo example in
    ImageMapEventHandler.processAction() Is there a reason
    for it there?Ah ... that makes sense.
    That code in CarDemo was written before there was such a thing as a NavigationHandler, and we didn't have time to update it to the new approach before the EA4 release. That'll be changed before the next one. In the mean time, I'd recommend that you use the navigation rules mechanism where it works for you, because it encourages good separation of business logic and presentation logic that will lead to more maintainable applications.
    Craig

Maybe you are looking for

  • VS2008 unit tests

    Hi, I have Unit tests in VS2008 and the test configuration is set to generate Source Code Coverage, where I have selected all the referred assemblies. But when my tests finish executing, I just the code coverage for my unittest.dll and not the assemb

  • How can I enlarge the favorite bar to a larger font

    how to change the font size in the favborites bar

  • How do I create and auto-launch bookmarks in LiveCycle Designer?

    I've created a fillable form using Adobe Live 8 Pro, I distribute the form using Acrobat. I haven't found a way to create bookmarks in LiveCycle so I create them using Acrobat first before I distribute the form...Is there another way? The problem I'm

  • Configure iws on Sun cluster???

    I have installed sun cluster 3.1.On top of it I need to install iws(sunone web server).Does anyone have document pertaining to it? I tried docs.sun.com , the document there sound greek or latin to me Cheers

  • Core Duo mac mini vs. Core 2 Duo iMac

    I am interested in getting a new mac. I would like some advice from others about some of the new models. I do a lot of iPhoto with my Nikon D50 and iMovie and iDVD. I am assuming that a new Core Duo mac mini will be a significant upgrade from my curr