Session object question put vs. putValue vs. setAttribute?

I have the following code:
<%@ page import="java.util.*" %>
<jsp:useBean id="EducationBean" class="java.util.Hashtable" scope="session" />
<%
String swCurrFileName = "swcontrol.jsp";
Enumeration params = request.getParameterNames();
while (params.hasMoreElements()) {
     String name = (String)params.nextElement();
     EducationBean.put(name, request.getParameter(name));
%>
My question is I can't find any documentation on the put command, whats the difference between 'put', and 'putValue', and 'setAttribute'? When I try using the 'putValue' or 'setAttribute' command I get errors.
What I'm trying to do is store form values in a session object across several pages, and on the last page display all the form values from the previous pages.

the object you are calling put on is a java.util.Hashtable. put places an object into the table to be keyed off of another object. In your case, your key is the variable name and the object to be stored is your parameter from that name.
the putValue and setAttribute are methods on the session object. They both do the same action as above, but are for HttpSession objects. putValue is deprecated and you should be using setAttribute, but most WebServers have putValue() pointing to the setAttribute() method. hope this helps.

Similar Messages

  • Sessions / object question

    Hi,
         I have a servlet that creates a session(if it is a new session) and adds an object(filled with data from an html form) to it. The problem is whenever I try to run the servlet again I cant retrieve the object from the session. The session is intact as well as the object name(i.e ItemObject@ie9355).
         Does this have anything to do with serialization? I didnt use any serialization here.
         Any Ideas?
    Thanks in Advance!
    J

    What I have is 2 servlets AddToCart and Cart. I am trying to use the AddToCart servlet to add elements to a shopping cart and use the Cart servlet whenever someone clicks on the shopping cart to display the contents of the cart.
    In AddToCart I have a session and I put a value in it called vCart and make it a new Vector. I have a class called ItemObject which has 4 variables. I take the info from the form - instantiate an item of type ItemObject - add the info from the form to the 4 variables of the item - then add the item to the vCart vector.
    In AddToCart I can take the vCart from the session and say ItemObject item = new ItemObject; item = (ItemObject) vCart.elementAt(0); ISBN = item.ISBN; title = item.title; etc. But in the Cart servlet using System.out's I find that the servlet is stopping at the line - item = (ItemObject) vCart.elementAt(0);
    I used vCart.size() in my Cart servlet and the items are there, I just cant create item objects from the vCart elements.
    Could this have anything to do with my AddToCart using doPost and my Cart using doGet?
    Thanks
    j

  • Question about app design - database + session object in JSP

    hi all
    i am studying this application built mostly with servlets and JSPs, and there are several questions i want to ask your guys' opinions about it.
    first of all, i noticed that the application hits database to get/save data very frequently. from one page to another it would save data collected from user to the DB, and retrieve data from DB to display on the next page. it does this a lot. would this decrease the overall performance of the application, i mean a DB hit requires network traffic overhead, wouldn't it be better if all data collected from user are stored in a session object temporarily, and all the data that are displayed on those pages retrieved at the start time? and do one save process in the end. it uses Oracle DB if it makes any difference. should we try to avoid db hit as much as possible?
    my next question is that is it good approach to keep information in session object? even if there is a lot of data to keep?
    another question is the db connection. in a pooled environment - weblogic server, we would use JNDI in the code to get connection from the pool, we use it and close it. when we close a connection with close() method, what really happens? does this connection gets return to the pool or it is being destroyed completely.
    i know this is a lot to ask, i appreciate your help very much. looking forward to seeing some feedback.

    No, I don't have tables of values. I have a java 1.5 enumeration, like for instance:
    public enum VelocityConvention {
       RELATIVISTIC,
       REDSHIFT;
    }and a class Velocity that contains a convention and a value like so:
    public class Velocity {
       public VelocityConvention getConvention() {...}
       public double getValue() {...}
       public void set(VelocityConvention conv, double value) {...}
    }When I persist the Velocity class to the database, I want a field called convention that holds the appropriate value of the enumeration. That much is done how I explained before.
    I want to have a selectOneMenu for setting the convention. Via trial and error, I found that MyFaces wasn't able to automatically convert from a string back to a proper VelocityConvention enum constant. It can, of course, convert from the enum to a string because it just calls toString(). But I need both directions for any UIInput element I use, be it a selectOne, or just a straight inputText.

  • 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

  • I need to add the values stored in the session object into the html textbox

    Dear Sir,
    i have been trying to create an edit employee details page
    What i have done till now is as follow:
    1. Got employee id from HTML page.
    2. Compared it with the id stored in the database.
    3. If the id is correct then pulled the record of the corresponding employee and stored it in the session object.
    4. Dispatched the session values to another servlet EditEmpDetails2.java
    what i need to do now
    5. Now i need to set the session values in the text field of the html form
    6. I also need to be able to edit those vales and store the edited values in the database.
    Please help me as i have tried doing it for 1 week without any clues
    i have tried to create a html page which is something like this:
    <html>
    <head>
    <title>Edit Employee Details Page</title>
    <body BGCOLOR="red" text="black">
    <h1 ><font color="black">Edit Employee Details Page</font></h1>
    <form action = "EditEmpDetails" method="Get">
    <table width="50% align="center"
    <tr><td>Employee ID: </td>
    <td><INPUT TYPE="TEXT" name="employeeid"<br></td></tr>
    <tr><td><center><input type="submit" value="submit"></center></td></tr>
    <tr><td><center><input type="reset" value="reset" ></center></td></tr>
    </table>
    </form>
    </body>
    </html>
    design of my servlet EditEmpDetails.java
    public void EditEmpDetails1 extends HttpServlet
    public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException
    PrintWriter out = response.getWriter();
    response.setContentType("text/html");
    HttpSession session = request.getSession();
    String employeeid;
    String X = request.getParameter("employeeid");
    System.out.println("Employee iD:" + X);
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:murphy");
    String query = "Select * from users where employeeid=?";
    PreparedStatement stat = con.prepareStatement(query);
    System.out.println(stat);
    stat.setString(1,X);
    ResultSet rs = stat.executeQuery();
    while(rs.next())
    String Z = rs.getString(password);
    if(Z.equals(X))
    String A = rs.getString(1);
    session.setAttribute("employeeid", A);
    String B = rs.getString(2);
    session.setAttribute("firstname", B);
    String C = rs.getString(3);
    session.setAttribute("lastname", C);
    String D = rs.getString(4);
    session.setAttribute("gender", D);
    String E = rs.getString(5);
    session.setAttribute("dateofbirth", E);
    String F = rs.getString(6);
    session.setAttribute("address", F);
    String G = rs.getString(7);
    session.setAttribute("postalcode", G);
    String H = rs.getString(8);
    session.setAttribute("phone", H);
    String I = rs.getString(9);
    session.setAttribute("mobile", I);
    String J = rs.getString(10);
    String url = "/EditEmpDetao;s.java";
    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url)
    dispatcher.forward(request,response);
    catch (Exception e)
    system.out.println(e)
    I do not know how to put the values stored in the session object into the html text box

    3. If the id is correct then pulled the record of the corresponding employee and stored it in the session object.do you really need to store this in session object?
    5. Now i need to set the session values in the text field of the html form which form? in a new html/jsp page? i suggest go for a JSP
    In your JSP page use JSP expression tags to put the session attributes.
    it's something like : <input type='text' name='employeeid' value='<%= session.getAttribute("employeeid") %>' >and you need to generateanother servlet for saving the details/modifications to the database.
    I think i m clear enough.
    if you need more clarifications. just try it and then post your problem.
    Diablo

  • Storing array(or other data structure) in a session object

    hi wise ones
    to minimise my calls to a database I would like to store the information retrieved from a ResultSet in an array and then store this in a session object, retrieving it with getAttribute("nameOfArray"); when I need it.
    I have tried to print the object contents to test what is happening but am getting a[b] [Ljava.lang.String;@11d646c[/b] response which is something, but not what I expected.
    Is using a session the right way to make the information available to all servlets? If not what other method is appropriate?
    thank you

    thanks for your comments Annie & MLRon. I have tried both suggestions but am still hitting problems
    the usual method to get the elements results in my compiler complaining that sessionINFO is an object and .length cannot be applied to an object.
    for (int i = 0; i < sessionINFO.length; i++) {
                       out.print(sessionINFO);
                   out.print("<BR>");
    An array IS an object though?
    I have used Arrays.asList(sessionINFO) and get another compiler error stating that java.util.Arrays cannot be applied to an object
    I took my variables from the ResultSet and converted them all to Strings and put them into a String array
    int bankIDLogin=customerResults.getInt("id");
                                   //convert to String for array
                                   String bankIDLoginSTR = String.valueOf(bankIDLogin);
                                  String passwordLogin =customerResults.getString("password");
                                  String accNo=customerResults.getString("number");
                                  float accBal=customerResults.getFloat("balance");
                                  //convert to String for array                              
                                  String accBalSTR = String.valueOf(accBal);
                                  //put info into array
                                  String[]customerDetails={bankIDLoginSTR,passwordLogin,accNo,accBalSTR};then I put that array into the session object
                        HttpSession session =req.getSession(true);
                        session.setAttribute("id",bankID);
                        session.setAttribute("customerdetails",customerDetails);In a separate servlet I called the session object
    Object sessionINFO = session.getAttribute("customerdetails");How can I get the original array out of this object?
    What should I do if more than one result set is created and I need to create two session objects with customer details, (one customer has two accounts)? multi dimensional array?

  • Is Bulky Session Object Better or a Bulky Stateful Sess bean better

    Hi,
              We are clustering on Weblogic 6.0. Currently we are debating on whether
              to cache out ACL information which is very bulky in the session object
              or to store it into a statefull session bean and store the handle to
              that bean in the HttpSession object
              I "feel" it might be preferable to bulk the Session bean than to bulk
              the HttpSession object. Weblogic documentation discourages making the
              HttpSession object heavy citing replication issues. But wouldnt the same
              issues arise when we store a lot of information on the Session Bean.
              Also do all attributes of the Session bean need to be Serializable to
              support clustering.
              Any help will be appreciated.
              Thanks
              Sameer
              

    Sticky -- it will continue to go back until the session or the server dies.
              Peace,
              Cameron Purdy
              Tangosol Inc.
              << Tangosol Server: How Weblogic applications are customized >>
              << Download now from http://www.tangosol.com/registration.jsp >>
              "Sameer Wadkar" <[email protected]> wrote in message
              news:[email protected]...
              > If user x makes a call to servlet Y on Machine A where Machine A and B are
              in
              > cluster. If the user makes a second call to Y will the proxy webserver if
              thats
              > what is being used redirect the user call to machine A
              > and not B for sake if laodbalancing?
              >
              > Sameer
              > Cameron Purdy wrote:
              >
              > > Replication uses serialization. Serialization does not take transient
              > > fields. Therefore, even when used in a stateful session bean,
              replication
              > > would not take transient fields.
              > >
              > > Peace,
              > >
              > > --
              > > Cameron Purdy
              > > Tangosol, Inc.
              > > http://www.tangosol.com
              > > Tangosol: How Weblogic applications are customized
              > >
              > > "Sameer Wadkar" <[email protected]> wrote in message
              > > news:[email protected]...
              > > > Cameron,
              > > >
              > > > One last question? If I have a stateful session bean and I have an
              handle
              > > to
              > > > it. In a clustered environment would a transient field inside a
              Stateful
              > > > Session bean NOT BE replicated. I understand the situation for
              HTTPSession
              > > > objects. I just want to confirm if the situation is treated in
              identical
              > > > fashion while replicating Stateful Session Beans.
              > > > If I am working in a clustered environment and a client has
              established an
              > > > HTTPSession with respect to my server. When the client makes repeated
              > > calls to
              > > > the server in the context of that session is the client request
              forwarded
              > > to
              > > > the same server each time if there is no failover or to diff servers
              in
              > > the
              > > > cluster to meet loadbalancing req.
              > > > Also what is preferable (I am now not talking of clusteringnow : just
              > > > performance issues in a single server) storing a large object in
              > > HTTPSession
              > > > object or
              > > > putting that large object in a Stateful Session Bean and storing its
              > > handle in
              > > > the Session object(We need that object practically everytime a
              Controller
              > > > Servlet fires). Weblogic guys suggested to us that the session object
              > > should be
              > > > kept as small as possible to which I agree hence I thought of this
              > > solution.
              > > >
              > > > I would appreciate your response. We are using Weblogic 6.0
              > > >
              > > > Regards,
              > > > Sameer
              > > >
              > > > Cameron Purdy wrote:
              > > >
              > > > > Sameer,
              > > > >
              > > > > You are joking, right? Replicating a sh?tload of stuff across a
              cluster
              > > is
              > > > > expensive. Cached items that can be reloaded on another server in
              the
              > > rare
              > > > > case of failover should not be replicated, since they can be
              reloaded on
              > > > > another server in the rare case of failover. If you want your
              > > application to
              > > > > perform well, don't replicate things that you don't have to!
              > > > >
              > > > > Here's the math:
              > > > >
              > > > > - 1 in pf chance of a request having to failover, where pf should be
              at
              > > > > least 10,000,000
              > > > > - cb is the number of bytes being replicated, and f1(cb) is the cost
              of
              > > > > replicating
              > > > > - f2(cb) is the cost of loading the cache from the database (for
              > > example)
              > > > >
              > > > > If f2(cb)/pf is greater than f1(cb) then you should not replicate
              the
              > > cache.
              > > > > Generally that means that if you replicate the cache, you are
              expecting
              > > each
              > > > > server to die after serving between one and two requests. If that is
              the
              > > > > case, you are really hosed to begin with.
              > > > >
              > > > > If you have an object stored in the HTTP session, and that object
              has a
              > > > > transient field, the contents of the transient field are not
              replicated.
              > > > > That means that you can store your cache in a transient field on an
              > > object
              > > > > that you store in the HTTP session, and you will not pay a
              significant
              > > > > replication price on it. The accessor for the cache should follow
              the
              > > lazy
              > > > > pattern such that on failover it will reload the cache.
              > > > >
              > > > > For even more performance, you should implement Externalizable,
              since
              > > you
              > > > > can improve the performance of ser/deser by a factor of 3 to 10 or
              so.
              > > > >
              > > > > Peace,
              > > > >
              > > > > --
              > > > > Cameron Purdy
              > > > > Tangosol, Inc.
              > > > > http://www.tangosol.com
              > > > > Tangosol: How Weblogic applications are customized
              > > > >
              > > > > "Sameer Wadkar" <[email protected]> wrote in message
              > > > > news:[email protected]...
              > > > > > How would it matter. Both the Session Bean and The Session object
              are
              > > > > > destriyed whrn the user logs off.
              > > > > >
              > > > > > Cameron Purdy wrote:
              > > > > >
              > > > > > > If it is just a cache, then you need to prevent it from being
              > > > > replicated.
              > > > > > > Use a "transient" field or implement Externalizable on that
              object
              > > to
              > > > > > > control serialization and avoid serializing cached objects.
              > > > > > >
              > > > > > > Peace,
              > > > > > >
              > > > > > > --
              > > > > > > Cameron Purdy
              > > > > > > Tangosol, Inc.
              > > > > > > http://www.tangosol.com
              > > > > > > Tangosol: How Weblogic applications are customized
              > > > > > >
              > > > > > > "Sameer Wadkar" <[email protected]> wrote in message
              > > > > > > news:[email protected]...
              > > > > > > > Hi,
              > > > > > > >
              > > > > > > > We are clustering on Weblogic 6.0. Currently we are debating
              on
              > > > > whether
              > > > > > > > to cache out ACL information which is very bulky in the
              session
              > > object
              > > > > > > > or to store it into a statefull session bean and store the
              handle
              > > to
              > > > > > > > that bean in the HttpSession object
              > > > > > > > I "feel" it might be preferable to bulk the Session bean than
              to
              > > bulk
              > > > > > > > the HttpSession object. Weblogic documentation discourages
              making
              > > the
              > > > > > > > HttpSession object heavy citing replication issues. But
              wouldnt
              > > the
              > > > > same
              > > > > > > > issues arise when we store a lot of information on the Session
              > > Bean.
              > > > > > > > Also do all attributes of the Session bean need to be
              Serializable
              > > to
              > > > > > > > support clustering.
              > > > > > > >
              > > > > > > > Any help will be appreciated.
              > > > > > > >
              > > > > > > > Thanks
              > > > > > > > Sameer
              > > > > > > >
              > > > > >
              > > >
              >
              

  • 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!

  • How to implement a Session Object.

    Hi,
    If anybody show me any example of how to implement
    session object so that I can store any parameters such as user id and use it later on. And also if there is any good web site for reference about using session object.
    thanks

    You can use the the session.setAttribute and session.getAttribute methods.
    For example let's say you would want to store a username in the session after a user has logged on:
    String usrname = request.getParameter("username");
    session.setAttribute("myStoredUsername", usrname);
    you can then retrieve it using the get method. Remember that the entities stored inside a session object are generic objects and need to be cast to be used:
    String usrname2 = (String)session.getAttribute("username");
    Hope this helps
    Chelman

  • Get session object in a class

    hi,
    is possible obtain the session object in a class method without send it from jsp as a parameter?

    you mean like this?
         public ActionForward execute(
              ActionMapping mapping,
              ActionForm form,
              HttpServletRequest req,
              HttpServletResponse res)
              throws Exception {
              SessionManager sm = new SessionManager(req);
                                    ....sessionmanager class
    package com....;
    import java.util.*;
    import java.lang.reflect.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.jsp.*;
    import javax.servlet.http.*;
    import org.apache.log4j.*;
    * <code>SessionManager</code> is a wrapper for request, response and session
    * @author
    public class SessionManager {
         static Logger log = Logger.getLogger(SessionManager.class);
         ** Holds string containing the unique identifier assigned to this session
         private String sessionid;
         ** Holds HttpSession object
         private HttpSession session;
         ** Holds request object object - must be passed in by the calling application
         private HttpServletRequest request;
         ** Holds response object - any application sending a response must call
         ** session manager
         private HttpServletResponse response;
         ** Holds Servlet Context - useful if logging is reqd.
         private ServletContext context;
          * Page context.
         private PageContext pctx = null;
         ** Constructor to initialize with a request object
         public SessionManager(HttpServletRequest req) {
              request = req;
              session = req.getSession();
              sessionid = session.getId();
         ** Constructor to initialize with a pagecontext object - convenient to call from jsp's
         public SessionManager(PageContext pctx) {
              request = (HttpServletRequest) pctx.getRequest();
              response = (HttpServletResponse) pctx.getResponse();
              context = pctx.getServletContext();
              session = pctx.getSession();
              sessionid = session.getId();
              this.pctx = pctx;
         ** Constructor to initialize with request, response objects
         public SessionManager(HttpServletRequest req, HttpServletResponse resp) {
              request = req;
              response = resp;
              session = req.getSession();
              sessionid = session.getId();
         ** Constructor to initialize with request, servletcontext objects
         public SessionManager(HttpServletRequest req, ServletContext ctx) {
              request = req;
              context = ctx;
              session = req.getSession();
              sessionid = session.getId();
         ** Constructor to initialize with request, response and context objects
         public SessionManager(HttpServletRequest req, HttpServletResponse resp, ServletContext ctx) {
              request = req;
              response = resp;
              context = ctx;
              session = req.getSession();
              sessionid = session.getId();
         ** Setter and getter methods
         public void setRequest(HttpServletRequest req) {
              request = req;
              session = req.getSession();
              sessionid = session.getId();
         ** Setter and getter methods
         public void setContext(ServletContext ctx) {
              context = ctx;
         ** Setter and getter methods
         public ServletContext getContext() {
              return context;
         public void createLoginSession(java.io.Serializable obj) {
              if (obj == null)
                   log.debug("Object is null");
              setAttribute("user", obj);
         public void setAttribute(String key, java.io.Serializable obj) {
              session.setAttribute(key, obj);
         public void removeAttribute(String key) {
              session.removeAttribute(key);
         ** Setter and getter methods
         public HttpServletRequest getRequest() {
              return request;
         ** Setter and getter methods
         public HttpServletResponse getResponse() {
              return response;
         ** Checks if either member session or guest session exists
         public boolean isLoggedIn() {
              if (session.getAttribute("user") != null)
                   return true;
              else
                   return false;
         public long getCreationTime() {
              return session.getCreationTime();
         ** Setter and getter methods
         public String getId() {
              return session.getId();
         public long getLastAccessedTime() {
              return session.getLastAccessedTime();
         public int getMaxInactiveInterval() {
              return session.getMaxInactiveInterval();
         ** Setter and getter methods - also useful for retrieving state object(s)
         public Object getAttribute(String name) {
              if (session != null)
                   Object sObject = session.getAttribute(name);
                   //Log.debug("Session State for the object "+name+" is "+sObject);
                   return sObject;
              else
                   return null;
         ** Setter and getter methods - gets enum of all stored state objects
         public Enumeration getAttributeNames() {
              return session.getAttributeNames();
         public void invalidate() {
              session.invalidate();
              // Remove all object that is bound to this session
              //wip : Resetting instance variable.
              //This is necesary as further operations on session will
              //result in illegalstateexception
              session = null;
         public boolean isNew() {
              return session.isNew();
         public void setMaxInactiveInterval(int interval) {
              session.setMaxInactiveInterval(interval);
          * This method returns the host url in the form "www.carclub.com".
          * <p>
          * The return value is compatible with default_website field of clubs DB table.
          * </p>
          * @return host url present as part of the http request object
         public String getHostURL()
              if (request == null)
                   return null;//No request object present, hence return null
              String str = request.getServerName();
              //Log.debug("--- The request URL is --- " + str);
              return str;
          * Flushes <code>out</code> stream.
         public void flush()
              throws IOException
              if (pctx != null)
                   pctx.getOut().flush();
    }

  • 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

  • How to detect session objects in a project

    Hi,
    There are many session objects in our project which has over 1000 classes. What would you suggest as the best practice to identify all of them. I am using eclipse. How to detect they are serialized or not. If not serialized how could i make sure they are serializable or not.?
    Appreciate your time.
    Pralav

    If not serialized how could i make sure they are serializable or not.?By implementing the Serializable interface.
    If you want to ensure they can't be serialised, then you implement Externalisable and throw exceptions when you override readExternal() and writeExternal()
    As for identifying the objects that are added to a session.... do a search for things like session.setAttribute() on your code. No easy way.
    regards,
    Owen

  • 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

  • How to store complex data in session object

    Hi All,
            I have a requirement like this, I have to store some complex data(like some object) in webdynpro session object.
    I know that i can store some string value in session by using wdScopeUtil and is it possible to store some complex data like(object ot object array).
    See i have some ContryTO[] object which contains countrycode and value i have to store this Array object in session.How can I solve this problem,i am strucked regarding this pls help me regarding this issue.
    Regards,
    saleem

    Bala,
    Go thru this link. It may be useful to you.
    Maintaining caching for a user session in webdynpro
    List elementList = new ArrayList();
    // set values to your list.
    IMaintainScope maintainer = Utils.getScopeMaintainer(WDScopeType.APPLICATION_SCOPE);
    maintainer.getScope().put("list",elementList);
    List elementList1 = (List)maintainer.getScope().get("list");
    Regards,
    Sridhar

  • V$SESSION columns question

    Hi Gurus
    I have a question regarding of the meaning of some columns in the V$SESSION table. I wonder what does the values in the following columns means?
    ROW_WAIT_O
    ROW_WAIT_F
    ROW_WAIT_B
    TADDR
    LOCKWAIT
    I find out that these columns always have some values when my users unable to log into the application. Even I kill the session that have lockwait, other users are still unable to connect and it happens around once every 2 months.
    Thanks for the answer in advanced
    Oui

    V$SESSION
    This view lists session information for each current session.
    Column Datatype Description
    SADDR
    RAW(4 | 8)
    Session address
    SID
    NUMBER
    Session identifier
    SERIAL#
    NUMBER
    Session serial number. Used to identify uniquely a session's objects. Guarantees that session-level commands are applied to the correct session objects if the session ends and another session begins with the same session ID.
    AUDSID
    NUMBER
    Auditing session ID
    PADDR
    RAW(4 | 8)
    Address of the process that owns this session
    USER#
    NUMBER
    Oracle user identifier
    USERNAME
    VARCHAR2(30)
    Oracle username
    COMMAND
    NUMBER
    Command in progress (last statement parsed); for a list of values, see Table 3-3. These values also appear in the AUDIT_ACTIONS table.
    OWNERID
    NUMBER
    The column contents are invalid if the value is 2147483644. Otherwise, this column contains the identifier of the user who owns the migratable session.
    For operations using Parallel Slaves, interpret this value as a 4-byte value. The low-order 2 bytes of which represent the session number, and the high-order bytes the instance ID of the query coordinator.
    TADDR
    VARCHAR2(8)
    Address of transaction state object
    LOCKWAIT
    VARCHAR2(8)
    Address of lock waiting for; NULL if none
    STATUS
    VARCHAR2(8)
    Status of the session: ACTIVE (currently executing SQL), INACTIVE, KILLED (marked to be killed), CACHED (temporarily cached for use by Oracle*XA), SNIPED (session inactive, waiting on the client)
    SERVER
    VARCHAR2(9)
    Server type (DEDICATED| SHARED| PSEUDO| NONE)
    SCHEMA#
    NUMBER
    Schema user identifier
    SCHEMANAME
    VARCHAR2(30)
    Schema user name
    OSUSER
    VARCHAR2(30)
    Operating system client user name
    PROCESS
    VARCHAR2(9)
    Operating system client process ID
    MACHINE
    VARCHAR2(64)
    Operating system machine name
    TERMINAL
    VARCHAR2(30)
    Operating system terminal name
    PROGRAM
    VARCHAR2(48)
    Operating system program name
    TYPE
    VARCHAR2(10)
    Session type
    SQL_ADDRESS
    RAW(4)
    Used with SQL_HASH_VALUE to identify the SQL statement that is currently being executed
    SQL_HASH_VALUE
    NUMBER
    Used with SQL_ADDRESS to identify the SQL statement that is currently being executed
    PREV_SQL_ADDR
    RAW(4)
    Used with PREV_HASH_VALUE to identify the last SQL statement executed
    PREV_HASH_VALUE
    NUMBER
    Used with SQL_HASH_VALUE to identify the last SQL statement executed
    MODULE
    VARCHAR2(48)
    Contains the name of the currently executing module as set by calling the DBMS_APPLICATION_INFO.SET_MODULE procedure
    MODULE_HASH
    NUMBER
    The hash value of the above MODULE
    ACTION
    VARCHAR2(32)
    Contains the name of the currently executing action as set by calling the DBMS_APPLICATION_INFO.SET_ACTION procedure
    ACTION_HASH
    NUMBER
    The hash value of the above action name
    CLIENT_INFO
    VARCHAR2(64)
    Information set by the DBMS_APPLICATION_INFO.SET_CLIENT_INFO procedure
    FIXED_TABLE_SEQUENCE
    NUMBER
    This contains a number that increases every time the session completes a call to the database and there has been an intervening select from a dynamic performance table. This column can be used by performance monitors to monitor statistics in the database. Each time the performance monitor looks at the database, it only needs to look at sessions that are currently active or have a higher value in this column than the highest value that the performance monitor saw the last time. All the other sessions have been idle since the last time the performance monitor looked at the database.
    ROW_WAIT_OBJ#
    NUMBER
    Object ID for the table containing the ROWID specified in ROW_WAIT_ROW#
    ROW_WAIT_FILE#
    NUMBER
    Identifier for the datafile containing the ROWID specified in ROW_WAIT_ROW#. This column is valid only if the session is currently waiting for another transaction to commit and the value of ROW_WAIT_OBJ# is not -1.
    ROW_WAIT_BLOCK#
    NUMBER
    Identifier for the block containing the ROWID specified in ROW_WAIT_ROW#. This column is valid only if the session is currently waiting for another transaction to commit and the value of ROW_WAIT_OBJ# is not -1.
    ROW_WAIT_ROW#
    NUMBER
    The current ROWID being locked. This column is valid only if the session is currently waiting for another transaction to commit and the value of ROW_WAIT_OBJ# is not -1.
    LOGON_TIME
    DATE
    Time of logon
    LAST_CALL_ET
    NUMBER
    The last call
    PDML_ENABLED
    VARCHAR2(3)
    This column has been replaced by column PDML_STATUS
    FAILOVER_TYPE
    VARCHAR2(13)
    Indicates whether and to what extent transparent application failover (TAF) is enabled for the session:
    NONE - failover is disabled for this session
    SESSION - the client is able to fail over its session following a disconnect
    SELECT - the client is able to fail over queries in progress as well
    See Also:
    Oracle9i Database Concepts for more information on TAF
    Oracle9i Net Services Administrator's Guide for information on configuring TAF
    FAILOVER_METHOD
    VARCHAR2(10)
    Indicates the transparent application failover method for the session:
    NONE - failover is disabled for this session
    BASIC - the client itself reconnects following a disconnect
    PRECONNECT - the backup instance can support all connections from every instance for which it is backup
    FAILED_OVER
    VARCHAR2(3)
    Indicates (YES|NO) whether the session is running in failover mode and failover has occurred
    RESOURCE_CONSUMER_GROUP
    VARCHAR2(32)
    Name of the session's current resource consumer group
    PDML_STATUS
    VARCHAR2(8)
    If ENABLED, the session is in a PARALLEL DML enabled mode. If DISABLED, PARALLEL DML enabled mode is not supported for the session. If FORCED, the session has been altered to force PARALLEL DML.
    PDDL_STATUS
    VARCHAR2(8)
    If ENABLED, the session is in a PARALLEL DDL enabled mode. If DISABLED, PARALLEL DDL enabled mode is not supported for the session. If FORCED, the session has been altered to force PARALLEL DDL.
    PQ_STATUS
    VARCHAR2(8)
    If ENABLED, the session is in a PARALLEL QUERY enabled mode. If DISABLED, PARALLEL QUERY enabled mode is not supported for the session. If FORCED, the session has been altered to force PARALLEL QUERY.
    CURRENT_QUEUE_DURATION
    NUMBER
    If queued (1), the current amount of time the session has been queued. If not currently queued, value is 0.
    CLIENT_IDENTIFIER
    VARCHAR2(64)
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96536/ch3171.htm#1122127
    Joel P�rez

Maybe you are looking for

  • Printing AnyGantt creates black background color

    I use a customized AnyGantt chart. When I try to print it on a page A3 I get a mean issue with the background color. It becomes black. The Chart itself looks good. When I try the same with examples from AnyChart.com the no black background appears. I

  • How to affect Purchase account

    Dear Experts In purchasing proces  we are making a Purchase Order-> GRN->A/P Invoice. We have defined the items as inventory and purchase items...we have chosen set G/L accounts by item level in the item MD Now when we are adding the GRN the JE poste

  • Performance issue in ABAP

    Hi, This issue is becoming very big challenge for us.    "select adrnr            tplnr     appending table i_iloa     package size 50000     from iloa     where tplnr in s_mprn2     and owner eq '2'.   endselect. like this i have some other select s

  • Moving Folders Version 2.  Please Help!

    Hello again, Once again I need your help with the same script but I just need a little more help.  I'm an (very) amateur scripter and I'm still trying to grasp the fundementals.  This time I need your help, so that I can also move files as well as fo

  • Trying to figure out using my macbook as a web server

    So I have Apache and PHP enabled and working with MySQL installed. And I know that I am able to access my IP address and my IP address/~myusername online, but it says I don't have permission to do it. What folder or directory is the internet reading