Access Session objects

Hi you all,
How can I access, from a normal class which doesn't extend the HttpServlet abstract class, any session objects that might have been stored. It is a requirement that all the classes that I am using which make part of the bussiness logic cannot extend the HttpServlet. Since the HttpServlet in an abstract class I cannot create an instance of it... so how can I access any session objects without extending the HttpServlet class.
Any help is welcome,
Thanks,
MeTitus

You could pass the session object as a parameter to the contructor or in any method calls. However most people will tell that this is poor design an dyou should extract any needed data from the session and only pass that data to the objects instead of the entire session object.

Similar Messages

  • Need help on how to access session object in javaBean

    Hi All,
              I am new to JSP. I have writen a java helper class which gets some data
              from a Session Bean.
              I want to use <jsp:useBean scope="session"> directive in the JSP.
              The helper class requires the reference to session Object to initialize
              itself.
              It looks like I can only pass Strings Or Basic data Type using
              <jsp:setProperty> directive. I want the helper class to initialize only
              once per session.
              I am using weblogic 4.5 and jdk 1.1.7B.
              Need help soon.
              Thanks in Advance
              Regards
              Arun
              

    Arun,
              You need only create a method on the bean and call it passing the request
              object which contains the
              session object. You need not scope to session if you don't need to as well
              ie
              <jsp:useBean id=foo class= myclass.foo scope="session">
              <%
              foo.init(reqeust);
              %>
              Harry
              Arun Kumar <[email protected]> wrote in message
              news:8itp3l$b67$[email protected]..
              > Hi All,
              > I am new to JSP. I have writen a java helper class which gets some data
              > from a Session Bean.
              >
              > I want to use <jsp:useBean scope="session"> directive in the JSP.
              > The helper class requires the reference to session Object to initialize
              > itself.
              >
              > It looks like I can only pass Strings Or Basic data Type using
              > <jsp:setProperty> directive. I want the helper class to initialize
              only
              > once per session.
              >
              > I am using weblogic 4.5 and jdk 1.1.7B.
              >
              > Need help soon.
              >
              > Thanks in Advance
              > Regards
              > Arun
              >
              >
              >
              

  • Accessing Session objects

    I have the following managed bean in my faces-config
    <managed-bean>
    <managed-bean-name>SessionScope</managed-bean-name>
    <managed-bean-class>com.web.object.SessionScope</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    How do I access the functions in the SessionScope class from the Java code? in this login JSP I have a submit button as so:
    <h:commandButton id="btnLogin" text="Submit" actionRef="Login.btnLogin_action"
    style="height: 24px; left: 143px; top: 264px; position: absolute; width: 217px"/>
    But I don't know how to access the SessionScope function from here
    public void btnLogin_action() {
    //This is what I don't know how to do
    SessionScope s = getSessionBean("SessionScope ")
    How do I write the getSessionBean() and setSessionBean() Methods inside a java class so that it accesses the current SessionBean

    MyBean myBean = (MyBean) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("myBean");Also see http://balusc.xs4all.nl/srv/dev-jep-com.html

  • Forms6i Accessing HTTP Session Object in APache JServ

    I want to create an HTTP session object via a servlet in Apache JServ. This session object contains user profile data as well as session context information. The servlet will redirect the user to the forms6i listener servlet. Can the Forms servlet access the session object and retrieve/modify its values? Does Forms6i provide APIs to do this natively?

    Maybe the Java Importer is what you are looking for.
    You can use it to call the servlet from within forms and get the information you need.(But only after forms is running).
    look at the Java integration section on Forms section of otn.

  • How do I access session data through an EJB?

    Hi
    How do I access session data through an EJB?
    I am currantly developing a Web service (using ejb's, JBoss.net and Apache Axis). A client making a call to this Web service, is expecting a bussiness-object in return. My problem is that this bussiness-object i stored in a users session data. How do I retrieve this bussiness-object from the users session.
    I have read that this does not work with httpsessions, is this true? If this is true, is it possible to store the bussiness object in a JavaBean e.g:
    <jsp:useBean id="userContextWebImpl" scope="session" class="com.ac.march.client.UserContextWebImpl">
    <%
    String key = "test";
    String value = "This is the value";
    userContextWebImpl.setValue( key, value1 );
    %>
    </jsp:useBean>
    and then retrieve this information through the EJB? Or is it possible to do this by using Statfull JavaBeans? Or can this be done through a nother solution?
    Please help!

    I have created a JavaBean with scope="application" to store some data. The data is stored when a user prefomes a spesific task.
    A different person then makes a call to a Web-Service on the server. The Web-Service then asks an EJB to retrieve the data stored in the JavaBean (servlet cotext). In other words: How do I retrieve this data from the EJB?
    I have tried with this code, but with no luck.
    (ApplicationContextWebImpl is the JavaBean)
    public static String getBookingResult( String key )
         String myResult = null;
         String myKey = key;
         ApplicationContextWebImpl applicationContextWebImpl = null;
         try
              applicationContextWebImpl = new ApplicationContextWebImpl();
              myResult = (String)applicationContextWebImpl.getValue( key );
         catch ( java.rmi.RemoteException e )
         return myResult;
    }

  • How to get Multiple Values for a key from a session object?

    Hi,
    It might seem dumb but I am facing a problem here with the session object. I'll paste the session object's content from the netbeans "Local Variables" window for clarity -
    Name Type Value
    hsession StandardSessionFacade #66
    session LWSFSession #69
    inherited
    attributes Hashtable #80
    [0] Hashtable$Entry "cart"=>#115
    key String "cart"
    value DummyCart #115
    item null
    submit null
    v Vector
    [0] String Full Metal Jacket
    [1] String As Good As It Gets
    [2] String Tim
    What I want is to get the values "Full Metal Jacket", "As Good As It Gets" and "Tim" from the session obejct?
    The problem I am facing is that if I do a session.getAttribute("cart"), I'll get a single value in return. What will that value be? Will it be "item", "submit" or "v"? And if I want all the values in v above, how can I get them?
    Thanks.

    None of the above.
    HttpSession.getAttribute() will return what you put into it using HttpSession.setAttribute(). In your case, it'll return an Object which you need to cast to DummyCart. Then you can access the data in DummyCart using the API of the DummyCart class.
    hth

  • How to get Request/Session objects in a Webdynpro application

    Hi
    I am working in Enterprise Portal 7.0.
    in one of the iViews which displays a JSP page, i have set a parameter in request and session objects.
    How can i get it in my Webdynpro ABAP Application?
    Thanks & Regards
    Abhimanyu L

    hi Abhimanyu
    I believe originally access to session was deliberately not made available inside WDA.
    Growing security concerns due to misuse of session information and
    perhaps other reasons as well.
    X.509  is considered a better approach.
    This may not help you in your problem.
    But you may see a trend in WDA pushing more robust and client independent
    approaches.
    Full x.509 access should remove the need for session fiddling.
    Also when developers access such session info directly, there is a possiblity
    when they dont understand the technology exactly that they create a security hole.
    You may know how to do safely, it is however discouraged.
    Im not aware of a way to get at the session info inside the WDA framework.
    Well not without a mod to the framework.
    It may be possible without a mod, but I dont know the trick.
    If someone has a little trick... please post.
    You may need to use BSP, if your only solution requires access to the session info.
    regards
    Phil

  • Using a session object to hold the value of a record set?

    Hi,
    I'm trying to hold the value of a record set (or literally the content of a column in a query in a db) in a session variable so that I can call on this later and insert into another table.
    I'm not sure of the correct syntax, I've already made a connection to the DB. I'm trying the following but it doesnt seem to like the code:
    <% session.setAttribute("code",rs("column_name")); %>
    <%String attrib =
    String.valueOf ( session.getAttribute("code")); %>
    Hello <%= attrib %>
    Any ideas, I dont know how to reference the record set, I declared the recordset previously as rs. Help! Can't find examples anywhere on the net!

    So just to recap. I appear to be seeing the column name "custorderno" within the Microsoft Access query "lastcust". But I get "no data found" when I run the following code (which I have sectioned off)
    <!-- connect to database and lastcust query --!>
    <%
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    Connection conn = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=C:/Tomcat/jakarta-tomcat-4.1.31/webapps/ROOT/Oatcake.mdb","","");
    Statement statement = conn.createStatement();
    String sql = "SELECT * FROM lastcust";
    ResultSet rs = statement.executeQuery(sql);
    while (rs.next()) {
    %>
    <TR><TD><%= rs.getString("custorderno") %></TD>
    </TR>
    <% session.setAttribute("code",rs.getString("custorderno")); %>
    <% String attrib =
    String.valueOf ( session.getAttribute("code") ); %>
    Hello <%= attrib %> [B]
    <%
    %>
    </TABLE>
    <%
    if (statement != null)
    statement.close();
    if (conn != null)
    conn.close();
    catch (Exception e) {out.print(e);}
    %>
    </BODY>
    </HTML>
    No as mentioned I am (as you can see) declaring everything as a string when in actual fact the contents of the "custorderno" within the query is set to a autonumber within MS Access.
    The while loop does work by returning the contents but the session object part is not working correctly with the following result returned:
    [B]java.sql.SQLException: No Data Found
    Help please!

  • EJB 3.0: java.io.IOException: Unable to find session object ...

    Hello,
    We have an EJB3 application deployed to an Oracle AS 10.1.3.1.0 instance.
    Our main point of entry to the application is a stateful session bean (that controls access), that has injected several other stateful session beans.
    Like this:
    +@Stateful(name = "TstreamUserSession")+
    +public class TstreamUserSessionBean extends UserSessionBean implements TstreamUserSession {+
    +@EJB(name = "ContactSession")+
    private ContactSessionLocal contactSession;
    +@EJB(name = "GuestSession")+
    private GuestSessionLocal guestSession;
    +@EJB(name = "TechCustomerSession")+
    private TechCustomerSessionLocal techCustomerSession;
    +@EJB(name = "PmSession")+
    private PmSessionLocal pmSession;
    +@EJB(name = "CustomerSession")+
    private CustomerSessionLocal customerSession;
    +@EJB(name = "PartnerSession")+
    private PartnerSessionLocal partnerSession;
    +@EJB(name = "AdminSession")+
    private AdminSessionLocal adminSession;
    +@EJB(name = "SuperAdminSession")+
    private SuperAdminSessionLocal superAdminSession;
    +@EJB(name = "VmSession")+
    private VmSessionLocal vmSession;
    +public TstreamUserSessionBean() {+
    +}+
    +...+
    In this class, we also look up these sessions, because we need several instances of these, in this manner:
    +private synchronized Object getSessionInstance(String sessionName) throws AccessDeniedException {+
              +try {+
                   InitialContext ic = new InitialContext();
                   return ic.lookup("java:comp/env/" sessionName);+
              +} catch (NamingException e) {+
              +}+
         +}+
    However, we keep getting the following messages after a certain period.
    java.io.IOException: Unable to find session object 2816103596632839360 for location 'AdminSession'
    +10/01/12 11:50:04 at com.evermind.server.ejb.EJBInternalInputStream.resolveObject(EJBInternalInputStream.java:70)+
    +10/01/12 11:50:04 at java.io.ObjectInputStream.checkResolve(ObjectInputStream.java:1346)+
    +10/01/12 11:50:04 at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)+
    +10/01/12 11:50:04 at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)+
    +10/01/12 11:50:04 at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)+
    +10/01/12 11:50:04 at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)+
    +10/01/12 11:50:04 at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)+
    +10/01/12 11:50:04 at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)+
    +10/01/12 11:50:04 at com.evermind.server.ejb.StatefulSessionEJBObject.activateBean(StatefulSessionEJBObject.java:581)+
    +10/01/12 11:50:04 at com.evermind.server.ejb.StatefulSessionEJBObject.remove_X(StatefulSessionEJBObject.java:213)+
    +10/01/12 11:50:04 at com.evermind.server.ejb.StatefulSessionEJBObject.remove_X(StatefulSessionEJBObject.java:159)+
    +10/01/12 11:50:04 at com.evermind.server.ejb.StatefulSessionEJBHome.processTimedOutSessions(StatefulSessionEJBHome.java:371)+
    +10/01/12 11:50:04 at com.evermind.server.ejb.StatefulSessionEJBHome.cleanUpMaintenance(StatefulSessionEJBHome.java:306)+
    +10/01/12 11:50:04 at com.evermind.server.ejb.EJBTask.run(EJBTask.java:47)+
    +10/01/12 11:50:04 at com.evermind.util.Task.schedule(Task.java:51)+
    +10/01/12 11:50:04 at com.evermind.util.TaskManager.run(TaskManager.java:221)+
    +10/01/12 11:50:04 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)+
    +10/01/12 11:50:04 at java.lang.Thread.run(Thread.java:595)+
    I guess this occurs when the stateful session TstreamUserSession is reactivated?
    Or when the ones being injected are passivated?
    Any idea why this occurs, or how to suppress it, because it really spams our logs...
    Thanks.

    Hello,
    We have an EJB3 application deployed to an Oracle AS 10.1.3.1.0 instance.
    Our main point of entry to the application is a stateful session bean (that controls access), that has injected several other stateful session beans.
    Like this:
    +@Stateful(name = "TstreamUserSession")+
    +public class TstreamUserSessionBean extends UserSessionBean implements TstreamUserSession {+
    +@EJB(name = "ContactSession")+
    private ContactSessionLocal contactSession;
    +@EJB(name = "GuestSession")+
    private GuestSessionLocal guestSession;
    +@EJB(name = "TechCustomerSession")+
    private TechCustomerSessionLocal techCustomerSession;
    +@EJB(name = "PmSession")+
    private PmSessionLocal pmSession;
    +@EJB(name = "CustomerSession")+
    private CustomerSessionLocal customerSession;
    +@EJB(name = "PartnerSession")+
    private PartnerSessionLocal partnerSession;
    +@EJB(name = "AdminSession")+
    private AdminSessionLocal adminSession;
    +@EJB(name = "SuperAdminSession")+
    private SuperAdminSessionLocal superAdminSession;
    +@EJB(name = "VmSession")+
    private VmSessionLocal vmSession;
    +public TstreamUserSessionBean() {+
    +}+
    +...+
    In this class, we also look up these sessions, because we need several instances of these, in this manner:
    +private synchronized Object getSessionInstance(String sessionName) throws AccessDeniedException {+
              +try {+
                   InitialContext ic = new InitialContext();
                   return ic.lookup("java:comp/env/" sessionName);+
              +} catch (NamingException e) {+
              +}+
         +}+
    However, we keep getting the following messages after a certain period.
    java.io.IOException: Unable to find session object 2816103596632839360 for location 'AdminSession'
    +10/01/12 11:50:04 at com.evermind.server.ejb.EJBInternalInputStream.resolveObject(EJBInternalInputStream.java:70)+
    +10/01/12 11:50:04 at java.io.ObjectInputStream.checkResolve(ObjectInputStream.java:1346)+
    +10/01/12 11:50:04 at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)+
    +10/01/12 11:50:04 at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)+
    +10/01/12 11:50:04 at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)+
    +10/01/12 11:50:04 at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)+
    +10/01/12 11:50:04 at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)+
    +10/01/12 11:50:04 at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)+
    +10/01/12 11:50:04 at com.evermind.server.ejb.StatefulSessionEJBObject.activateBean(StatefulSessionEJBObject.java:581)+
    +10/01/12 11:50:04 at com.evermind.server.ejb.StatefulSessionEJBObject.remove_X(StatefulSessionEJBObject.java:213)+
    +10/01/12 11:50:04 at com.evermind.server.ejb.StatefulSessionEJBObject.remove_X(StatefulSessionEJBObject.java:159)+
    +10/01/12 11:50:04 at com.evermind.server.ejb.StatefulSessionEJBHome.processTimedOutSessions(StatefulSessionEJBHome.java:371)+
    +10/01/12 11:50:04 at com.evermind.server.ejb.StatefulSessionEJBHome.cleanUpMaintenance(StatefulSessionEJBHome.java:306)+
    +10/01/12 11:50:04 at com.evermind.server.ejb.EJBTask.run(EJBTask.java:47)+
    +10/01/12 11:50:04 at com.evermind.util.Task.schedule(Task.java:51)+
    +10/01/12 11:50:04 at com.evermind.util.TaskManager.run(TaskManager.java:221)+
    +10/01/12 11:50:04 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)+
    +10/01/12 11:50:04 at java.lang.Thread.run(Thread.java:595)+
    I guess this occurs when the stateful session TstreamUserSession is reactivated?
    Or when the ones being injected are passivated?
    Any idea why this occurs, or how to suppress it, because it really spams our logs...
    Thanks.

  • How do I  call a DeleteAllQuery stored in the session object?

    Hi all,
    I have a DeleteAllQuery that I have stored in my session object by name (PURGE_IRLE):
    srvSession.addQuery(DaoConst.PURGE_IRLE, delq);
    I have RTFM:ed but the only description for deleteing that I could find delets individual objects. I couldn't find an example for DeleteAllQuery. :-(
    I set the reference class when I define the query but I'm confused by the getObjects() and setObjects() methods.
    Q1: When do I need to call them?
    Q2: How do I call this query?
    Q3: Which Session.executeQuery(...) should I use? (this relates to 1 & 2).
    Q4: How do I get back the number of rows deleted? execute returns an Object; can I assume it's an Integer containing the numbers of rows deleted?
    Many thanks in advance,
    Andrei Lenkei

    Ok, but this causes me some problems because:
    1) I can't really use SQL because I need a notExists subquery access on a TopLink object that represents a join (in the pre-TopLink version of the code the object was represented by a temporary table; I could put that whole select as a subquery to the subquery but that's not very elegant and would be quite inefective)
    2) This could be hundreds/thousands of row; wouldn't deleteing them 1-by-1 be extremly inefective?
    Isn't there a way i can call the DeleteAllQuery the same way TopLink would call it?
    Regards,
    Andrei Lenkei

  • Handling Session Object in WebDynpro Java

    *After Validation in WebDynpro Component, if the user is not authorized to access the page, i want to close the session of that Particular login user and sent back to the login page (home page)*
    i don't want to close the window
    come out of the application to the login page
    In Java, i can get session object by request.getSession(true);
    in webDynpro how can i get the Session Object.
    Thanks
    NSM

    Hi,
    try to use the following method
    WDClientUser user;
          user.forceLoggedInClientUser()
    Regards
    Ayyapparaj

  • Should we try to access session scope in ADF BC ?

    hi
    In the blog post "How to Access Session Scope in ADF BC "
    at http://andrejusb.blogspot.com/2012/01/how-to-access-session-scope-in-adf-bc.html
    Andrejus Baranovskis suggests it is no problem to access session scope in ADF BC using
    Map sessionScope = ADFContext.getCurrent().getSessionScope();But I wonder if this is really a good practice, as it looks very much like breaking the MVC pattern.
    At the same time I wonder where the Oracle documentation says this would be a good or bad idea.
    One starting point could be the ADFContext.getCurrent() method
    at http://docs.oracle.com/cd/E24382_01/apirefs.1112/e17486/oracle/adf/share/ADFContext.html#getCurrent%28%29
    that starts with saying "Gets the ADF context for the current thread. ..." which in a typical deployment scenario of ADF BC might not cause a problem.
    But, I wonder how defensive your programming should be when using the getSessionScope() method in your ADF Business Component code (that implements the Model).
    Ideas and feedback welcome.
    many thanks
    Jan Vervecken

    Hi Shay,
    Reviewing ADFContex methods it seems that this object shouldn't be accessible from BC. Example:
    public static ADFContext initADFContext(java.lang.Object context,
                                            java.lang.Object session,
                                            java.lang.Object request,
                                            java.lang.Object response)
        Initializes the ADFContext for the environment of the specified context.
        Parameters:
            context - the ServletContext or PortletContext of the current execution environment.
            session - the HttpSession or PortletSession of the current execution environment. OPTIONAL.
            request - the HttpServletRequest or PortletRequest of the current execution environment. OPTIONAL.
            response - the HttpServletResponse or PortletResponse of the current execution environment. OPTIONAL.
        Returns:
            the ADFContext that was current when init was invoked. Should be passed back to resetADFContext after the block requiring the ADFContext has completed.Kuba

  • URGENT! Share session object in JSP and JServlet

    Dear all,
    I am new to OAS. I am now trying OAS by build a simple Shopping Cart application.
    Currently, I use JSP to build user interface and Servlet to build bussiness logic. So I use JSP cartage and JServlet cartage to build the application.
    However, I find that the "session object" I create in the JSP cannot be access from Servlet cartage.
    Is anyone can help me to solve this problem. ( Is this implementation framework works in OAS ? )

    >
    I am short describing the problem again,
    IN JSP, MY CODE IS LIKE THIS:
    HttpSession oSession=request.getSession(true);
    oSession.setAttribute("batchHash",reqRows);
    IN SERVLET, MY CODE IS LIKE THIS:
    HttpSession oSession=req.getSession(true);
    tblSession = (Hashtable)
    oSession.getAttribute("batchHash");
    System.out.println("IsNew ="+oSession.isNew());
    System.out.println("Object="+prmSSO);
    If I deploy this in TOMCAT, my output is like this:
    IsNew =false
    Object=Hashtable@982fc1
    If I deploy this in WEBLOGIC 6.1, my output is like
    this:
    IsNew =true
    Object=null
    Why is this?
    Why the "oSession.isNew()" returns "false" in tomcat
    and "true" in weblogic ?
    Please help....Your only problem is using
    HttpSession oSession=req.getSession(true);instead of
    HttpSession oSession=req.getSession(false);in your servlet! getSession(true) - forces to allocate new session,
    so it's absolutely clear why your Hashtable is absent in
    a newly created session!!
    Paul

  • Session object problem. help needed

    Hi,
    I have an application where I am showing records in a chunk of 10 a time and have NEXT/PREVIOUS buttons to iterate.
    The user fills in the search criteria and hits the search button that inturn shows the data in a chunk of 10.
    I am adding an ArrayList to a session object in a servlet. The first time when user submits the search I create the ArrayList and add to a session object. When I try to access that ArrayList in my jsp page it always gives me null but when I click on a NEXT button the ArrayList is no more null.
    Here is the servlet code where I am creating adding ArrayList to a session object:
    //The following code is executed everytime the user hits search button or clicks NEXT/PREVIOUS buttons
    ArrayList data = getData(val1,val2);
    boolean val = false;
    Enumeration enum = session.getAttributeNames();
    while(enum.hasMoreElements())
      String s = (String)enum.nextElement();
      if(s.equals("arr"))
         val = true;
    if(val)
       session.removeAttribute("arr");
    //the following returns the correct size everytime even if it's the first time
    System.out.println("****************************** ArrayList Size = " + data.size());
    session.setAttribute("arr", data);
    System.out.println("****************************** ArrayList Size After = " + ((ArrayList)session.getValue("arr")).size());Here is the jsp code where I am calling the servlet:
    <img src="http://<%= request.getServerName() %>:<%= request.getServerPort() %><%= request.getContextPath()%>/servlet/DataReq"></a>    
        <%       
            //first time it's returning null which is not right
    //I SHOULD NOT GET null I ALWAYS HAVE THE ARRAYLIST. BUT SOMEHOW FIRST-TIME I GET IT null
           ArrayList al = (ArrayList)session.getAttribute("arr");
            if (al != null && (al.size() >0))
                System.out.println("******* DEBUG = " + al.size());
         else
             System.out.println("******* DEBUG NO VALUES ");     
        %>I don't know why the first time ArrayList is null even though I have created and added to a session in a servlet but when clicking NEXT it always returns me the values in it and it's no more null.
    Any help is really appreciated.
    Thanks!

    I keep 10 records a time in an ArrayList but before displaying the data in jsp page I want to call a servlet that gets the data from the DB and stores it in a session object and then I iterate through that session object. The image tag here is for my testing purpose as I am trying to figure out some other way to call a servlet before displaying the data. Here is the code:
    //...... Here I want to call a servlet ......
      ArrayList al = (ArrayList)session.getAttribute("arr");
      Iterator iterator = al.iterator();
      while(iterator.hasNext())
        DataRet s = (DataRet)iterator.next());
    %>
    <tr>
    <td align="left" nowrap="nowrap"><%= s.getName()</td>
    <td align="left" nowrap="nowrap"><%= s.getID()</td>
    <td align="left" nowrap="nowrap"><%= s.getAmount()</td>
    <td align="left" nowrap="nowrap"><%= s.getAddr()</td>
    <td align="left" nowrap="nowrap"><%= s.getCity()</td>
    </tr>
    <%
    %>
    Before getting an ArrayList from a session object I want to call a servlet. How do I call a servlet directly from jsp page.
    Any help is really appreciated.
    Thanks

  • How can i refresh the session object

    Hello..
    I am jst learning jsp... i hav a problem plz help me...
    I am using <jsp:useBean id="util" class="myUtilClass" scope="session" />
    I hav modified the object content...
    how can i refresh the object...
    ie...i want to access the modified data in the session object...

    You don't do that. It should already be reflected.
    Unless you modified another instance of it. If this is the case, then fix your code logic accordingly that it modifies the right object instance.

Maybe you are looking for

  • How can I register my new ipad air?

    How do I register my new ipad air?

  • 2008 MacBook Boot Camp Assistant doesn't recognize Windows XP install disk

    I'm trying to install Boot Camp, so I put in my Windows XP installation disk, which the computer recognizes because it shows up on the desktop, but when I run the Boot Camp Assistant, it says "The installer disk could not be found. Insert your Window

  • Error during connecting to BW reports

    Hi everybody! I have a problem with my EP. I need to execute a BW report in *Business Package component* for assets. When i try to use this report I have this error message:                       Unknown system 'Only SAP R/3 system are supported curr

  • How to add html tag in c:set value

    If i put the html tag around, like this <c:set var="test" value="This is a <b>nice</b> page." /> , the <c:out value="${test}" /> will print the bold tag around "nice" . How to get the actually string "nice" to be bold instead? Thank you!

  • WebDynpro component interface and Models

    Hi there, I'd like to know how I could reuse Models and WebDynpro Interfaces from Projects to Projects. For instance, I have created models and webdynpro interface in Appication1 in Project1. Now, I have created Project2 and Application2 and would li