Session attributes

I have a JSP page that calls itself multiple times and passes information back to itself using a vector passed as a session attribute. I am attempting to clear the attribute by using the removeAttribute() method and also calling the setAttribute() method and assigning an empty vector when the page is first called.
If after populating the session attribute I move to another page ("page X") and then come back, the page appears to have cleared the attribute/vector, but when I submit the page unto itself again the attribute/vector appears with the new information that I just passed to it ALONG WITH the old information assigned from my initial call before going to "page X". I would like to clear the information if the page is called from a page other than itelf, but somehow the old information is still being saved in the session.
Anyone know what I'm doing wrong?
Thanks for your time.
Matt

Thanks for the help. I have pieced out the part of the page where I attempt to reset the vector. Hopefully it is not too out of context to make any sense.
Assumptions:
- daySelected is a form object in this page (used to determine if page is called by itself
- workWeek is a vector of "workday" objects populated by this page
Code below:
if(request.getParameter("daySelected") != null){//page called by itself
//retrieve the workweek object from the previous version of this page
workWeek = (Vector) session.getAttribute("passedWorkWeek");
//dayIndex = 0-6 (Sat-Fri)
dayIndex = Integer.parseInt(request.getParameter("daySelected"));
if(request.getParameter("hourType").equals("In")){  //Time In
input = request.getParameter("hourin").trim() +":"+
request.getParameter("minuteIn").trim()+
request.getParameter("AMPMin").trim();
((WorkDay) workWeek.elementAt(dayIndex)).setTimeInEntries
(input);
}else{//hourType="Out" = Time Away
input = request.getParameter("outHours")+"."+
     request.getParameter("outFracHours") + " "+
     request.getParameter("outType").trim();
((WorkDay) workWeek.elementAt(dayIndex)).setTimeAwayEntries (input);                                              
session.setAttribute("passedWorkWeek",workWeek);
}else{//if page not called by itself or Clear Hours selected
//clear any existing vector and session attribute
workWeek.clear();
session.removeAttribute("passedWorkWeek");
//the above lines seem redundant as I am setting the attribute again, but nothing seems to work consistently
//Create empty vector for workWeek
for(int i=0; i<7; i++){
workWeek.addElement(new WorkDay(weeksDates,"", "", ""));
session.setAttribute("passedWorkWeek",workWeek);

Similar Messages

  • How to set session attributes in a bean?

    How do I set a session attribute in a server-side bean?
    I'm not sure if I asked the question the right way. What I meant is, while it's easy to set session attributes in a JSP page (session.setAttribute("sessionname", "sessionvalue")), I'd want to set such an attribute within a server-side bean defined in this web application. But what is the syntax for doing it?

    Here a simple bean that stores something in the session and retrieves something from it.
    import javax.servlet.http.HttpSession;
    public class TestBean {
      private String value;
      public void doSomething(HttpSession session, int a, int b) {
        if (a+b > 0) {
          session.setAttribute("ab",Boolean.TRUE);
        } else {
          session.setAttribute("ab",Boolean.FALSE);
      public void init(HttpSession session) {
        if (session != null) {
          Boolean b = (Boolean)session.getAttribute("ab");
          if (b == Boolean.TRUE) {
            value = "a + b is greater than zero";
          } else {
            value = "a + b is not greater than zero";
        } else {
          value = "no session";
      public String getValue() {
        return value;
    }In your JSP, use something along the lines of :
    <%
      TestBean bean = new TestBean();
      bean.init(session);
      bean.doSomething(session,1,2);
    %>If your bean only lives during one request, you can pass the session to the constructor, which stores it in a private variable. This saves passing the session each time.
    Hope this helps,
    --Arnout                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Javascript to JSP question...Can javascript function set session attributes

    hello,
    i have a web app that, on one of its pages, displays "tabbed pane" as an image map at the top (a la amazon.com). my problem is this: each "logical" page contains separate forms that all use the same javabean. in other words, imagine that the tabs represent an account maintenance web ui for an on-line record store. the first tab might be labeled "General," the second "Contact info," the third "Shipping Info." Each uses the same account bean and displays portions of its properties relevant to the tab at hand. what i want to do is allow a user to enter the account maintenance ui, update info on the first tab, click on tab two and have the request with the changes sent to a processing jsp. yet, since each "tab" is actually a separate URL to another page, how do i get the updated info on the first tabe without adding some sort of "SAVE" button on each tab. ive considered using javascript, but dont know how to get the request params out of the first tab whn i click on another tab. is it possible to include an "onClick" function in each URL that "grabs" the updated form fields off the preceeding tab? can a javacript function set session attributes in jsp?

    hello there,
    wow, you've created one big mammy-jammy tool.
    first, javascript cannot access, set values to the session, without having to post to another JSP. javascript is great for manipulating objects, layers, form values, etc.
    you have 2 issues [if i understand correctly]:
    1) you need to able to save user info for a specific tab without having to reloading the page.
    ---you can create a form for EACH of your tabs and POST all the information to a hidden IFRAME or LAYER for NN4. that hidden IFRAME / LAYER will load a JSP page which with all the parameters you posted to it. or you can build a FRAMESET and target that document["frame-name"].src with that same JSP.
    2) handling when the SAVE INFO action should happen: hence some javascript event handler: onMouseOver, onClick, etc
    ---i don't know the dynamics of your tabs, but if store which tab was clicked on last, then if the user clicks on some other tab, javascript can submit that FORM to a JSP [see condition above]
    you have an interesting tool. can i see?
    i hope i wasn't too confusing, but your problem is sooo interesting. =)
    -WJP

  • How to get from data entered on a form to a session attribute

    I have a jsp with a form with fields that are updated by the user.
    The values are in the fields value as I expected.
    Example. document.frm.Name.value = "Me"
    How do I populate a session variable with document.frm.Name.value?
    I think I have to do a request.getParameter("Name") followed by a
    session.SetAttribute. But the request.getParameter does not get populated with the latest value in document.frm.Name.value.
    Any idea is welcomed. Thanks
    Claudiine

    Below is the code:
    What I want to do is save in the session attribute "mailToAddressList" whatever the user types in the textarea "MailTo"
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    import java.sql.*;
    import java.text.*;
    import java.io.*;
    import com.cname.apl.*;
    public class DealTeamServlet extends HttpServlet {
    private appUtil util ;
    private java.sql.Connection conn ;
    private static String dbUrl ;
    private static String dbUid ;
    private static String dbPwd ;
    private static String mailFromAddressList ;
    private static String mailToAddressList ;
    private static String mailCcAddressList ;
    private static String mailBccAddressList ;
    private static String mailSubject ;
    SimpleDateFormat SDF = new SimpleDateFormat("d-MMM-yyyy");
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    dbUrl = config.getInitParameter("dbUrl");
    dbUid = config.getInitParameter("dbUid");
    dbPwd = config.getInitParameter("dbPwd");
    mailFromAddressList = config.getInitParameter("mailFromAddressList");
    mailToAddressList = config.getInitParameter("mailToAddressList");
    mailCcAddressList = config.getInitParameter("mailCcAddressList");
    mailBccAddressList = config.getInitParameter("mailBccAddressList");
    mailSubject = config.getInitParameter("mailSubject");
    if (dbUrl == null)
    dbUrl = "*" ;
    if (dbUid == null)
    dbUid = "*" ;
    if (dbPwd == null)
    dbPwd = "*" ;
    if (mailFromAddressList == null || mailFromAddressList.equals("*"))
    mailFromAddressList = "" ;
    if (mailToAddressList == null || mailToAddressList.equals("*"))
    mailToAddressList = "" ;
    if (mailCcAddressList == null || mailCcAddressList.equals("*"))
    mailCcAddressList = "" ;
    if (mailBccAddressList == null || mailBccAddressList.equals("*"))
    mailBccAddressList = "" ;
    if (mailSubject == null || mailSubject.equals("*"))
    mailSubject = "" ;
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, java.io.IOException {
    HttpSession session = request.getSession(true) ;
    String msgBody = (String) request.getParameter("msgBody");
    String uid = (String) request.getParameter("uid");
    String key = (String) request.getParameter("key");
    Boolean isAuthorized = (Boolean) session.getAttribute("isAuthorized");
    java.io.PrintWriter out = response.getWriter();
    if (msgBody == null) msgBody = "" ;
    response.setContentType("text/html");
    if (uid == null || key == null) {
    isAuthorized = new Boolean(false);
    if ( isAuthorized == null ) {
    util = new appUtil();
    conn = util.getConnection(dbUrl, dbUid, dbPwd) ;
    isAuthorized = util.isAuthorized(conn, uid, key);
    util.closeConnection(conn) ;
    if ( isAuthorized.booleanValue() ) {
    session.setAttribute("isAuthorized", new Boolean(true));
    java.sql.Timestamp serverTime = util.getServerTime(conn) ;
    java.sql.Date now = new java.sql.Date(serverTime.getTime());
    int idEntry = Integer.parseInt(msgBody);
    mailToAddressList = request.getParameter("MailTo");
    out.println("<html>");
    out.println("<head>");
    out.println("<title>Team Members</title>");
    out.println("<SCRIPT LANGUAGE=JavaScript>");
    out.println("function open_window() {");
    out.println("document.domain = \"ny.cname.com\"");
    out.println("var loc = \"http://peoplelkp.ny.cname.com/peoplelkp/PDLookupService?&emil2=eMail&form=frm&launch=myRoutine()&csr=1&srch=1&adv=1&wc=y&pump=\"");
    out.println("loc = loc + document.frm.Name.value");
    out.println("var w = window.open(loc,\"Model_Details\",\"scrollbars,width=400,height=450,resizable=yes\")");
    out.println("return;");
    out.println("}");
    out.println("function myRoutine() {");
    out.println("document.frm.MailTo.value=document.frm.MailTo.value+\",\"+document.frm.eMail.value;");
    out.println("}");
    out.println("function submitForm() {");
    out.println("alert('submit form')");
    out.println("var mailAdd = document.frm.MailTo.value");
    out.println("alert('mailAdd='+mailAdd);");
    out.println("if ( mailAdd.length == 0 || mailAdd.indexOf(' ') == 0 || mailAdd.indexOf('.com') == -1 || mailAdd.indexOf('@') == -1 ) {" );
    out.println("alert('The To: field must be populated. No space are allowed. Email addresses must have valid format. Example: [email protected]')");
    out.println("document.all.frm.MailTo.focus();");
    out.println("return false;");
    out.println("}");
    out.println("return true;");
    out.println("}");
    out.println("function UpdateMailTo() {");
    out.println("alert ('I am in UpdateMailTo='+document.frm.MailTo.value);");
    out.println("}");
    out.println("</SCRIPT>");
    out.println(util.getStyleSheet());
    out.println("</head>");
    out.println("<body bgcolor='silver'>");
    out.println("<form name='frm' action='SendMail' method='post'>");
    out.println("<b>Team Members</b>");
    out.println("<tr>");
    out.println("<TABLE cellpadding='0' cellspacing='0' border='0'>");
    out.println("<tr>");
    out.println("<td align='right'><b>Subject:  </b></td>");
    out.println("<td>Deal Team Members Cleared by Conflicts</td>");
    out.println("</tr><br>");
    StringBuffer bod = new StringBuffer("");
    SimpleDateFormat SDF = new SimpleDateFormat("d-MMM-yyyy");
    try {
    /*get header information*/
    CallableStatement st = conn.prepareCall("{call apl_get_sp ?}");
    st.setInt(1, idEntry);
    ResultSet rs = st.executeQuery();
    int id = 0;
    int dw = 0;
    String cde_proj = "";
    String nm_title = "";
    String nm_long = "";
    String empl = "";
    String sid = "";
    int userid = 0;
    String email_pr = "";
    while ( rs.next() ) {
    id = rs.getInt("id_entry");
    dw = rs.getInt("id_dealworks");
    cde_proj = rs.getString("cde_proj");
    nm_title = rs.getString("nm_title");
    nm_long = rs.getString("nm_long");
    empl = rs.getString("empl_name");
    sid = rs.getString("id_standard");
    email_pr = rs.getString("id_email_ext_unix");
    mailToAddressList = email_pr.trim();
    out.println("<tr><td align='right'><b>To:  </b></td>");
    out.println("<td><textarea name='MailTo' cols='50' rows='2'>"+mailToAddressList+ "</textarea></td>");
    out.println("<td>  </td>");
    out.println("<td><input type='button' value='Save' onClick='UpdateMailTo()'></td>");
    out.println("</tr>");
    // out.println("request.setAttribute('mailadd',document.frm.MailTo.value);");
    // mailToAddressList = request.getParameter("mailadd");
    out.println("<tr><td align='right'><b>Name:  </b></td>");
    out.println("<td><INPUT NAME='Name' VALUE='' size=65 ></td>");
    out.println("<td>  </td>");
    out.println("<td><input type='button' value='Search' onClick='open_window()'></td>");
    out.println("</tr>");
    out.println("<tr><td align='right'><b>EMail:  </b></td>");
    out.println("<td><INPUT NAME='eMail' VALUE='' size=65'></td>");
    out.println("</tr>");
    if (rslt != null) rslt.close() ;
    if (stmt != null) stmt.close() ;
    }/*end try*/
    catch ( Exception e) {
    System.out.println(e) ;
    getServletContext().log(e.toString());
    out.println("<td colspan='5' align='right'><input type='submit' value='Send email' onClick='submitForm()'></td>");
    out.println("</tr>");
    out.println("</table>");
    out.println("</form>");
    out.println("</body>");
    out.println("</html>");
    mailSubject = "Team Members";
    String body = "testing";
    session.setAttribute("mailFromAddressList", mailFromAddressList);
    session.setAttribute("mailToAddressList", mailToAddressList);
    session.setAttribute("mailCcAddressList", mailCcAddressList);
    session.setAttribute("mailBccAddressList", mailBccAddressList);
    session.setAttribute("mailSubject", mailSubject);
    session.setAttribute("mailBody", body);
    else {
    session.setAttribute("isAuthorized", new Boolean(false));
    out.println("You are not authorized.");
    //out.close();
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, java.io.IOException {
    processRequest(request, response);
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, java.io.IOException {
    processRequest(request, response);
    public String getServletInfo() {
    return "Short description";
    }

  • Problem removing session attributes

    I have a problem removing session attributes
    I try w/ mysession.removeAttribute("key");
    but it still lives in memory. I've tried setAttribute("key", null) as the API states that will do the same thing, but it doesn't work.
    I can get mysession.invalidate() to work, but I want to keep some of the attributes there, while removing another.
    I get no exceptions and no errors.
    Help.
    Running Tomcat 4
    jre 1.3.1

    Actually,
    response.addHeader("Expires", "-1");should be enough.
    The browser should then contact the Web server for updates to that page via a conditional If-Modified-Since request. You don't want a cache disabling 'overkill', since you'd still want the page to remain in the disk cache and used in appropriate situations without contacting the remote Web server, such as when the BACK and FORWARD buttons are pressed...
    Anyway, try this first, and if it doesn't solve your problem, add the other cache-disabling headers, as outlined in the previous post.
    If you're using JSP, verify also that your page has
    <%@ page session="true"%>

  • How to save the login ID as a session attribute ?

    I am using form-based authentication in a web application which is being deployed on a JBoss 3.2.3 server. I am authenticating against an Oracle database by way of a DatabaseServerLoginModule (JAAS).
    I would like to save the user's login ID as a session attribute in order to be able to use it later in the application.
    It's not obvious how you can capture this information and add it to the session, since it seems that the login ID is lost once the authentication is done by j_security_check process.
    Is there some way to tell the servlet container to save the login ID as a session attribute as part of the j_security_check process (something along the lines of "if the authentication succeeds add the login ID as an attribute to the session") ?
    Is there another approach ? What is the accepted "best practice" for doing session initialization after authentication ? For example if a user needs to have several attributes set in their session after login -- how is this handled ? I have done this before with a login servlet which did both the authentication and the session initialization, but when using form-based authentication and j_security_check it's not clear to me how you go from the authentication to the initialization logic.
    Thanks in advance for any suggestions or insight.

    You should already have it... hidden in request.getUserPrincipal().getName()

  • Variable coming from a session attribute

    Hello, I am developing a web application with JDeveloper 10g
    I've got a View Object which is basically a query, where I use a variable:
    WHERE BbCustomerOrderStatusTab.CUSTNO = :CustomerNumber
    When I define CustomerNumber in a form, it works:
    <af:panelForm>
    <af:inputText value="#{bindings.CustomerNumber.inputValue}"
    label="#{bindings.CustomerNumber.label}"
    required="#{bindings.CustomerNumber.mandatory}"
    columns="#{bindings.CustomerNumber.displayWidth}">
    <af:validator binding="#{bindings.CustomerNumber.validator}"/>
    </af:inputText>
    <af:commandButton actionListener="#{bindings.ExecuteWithParams.execute}"
    text="ExecuteWithParams"
    disabled="#{!bindings.ExecuteWithParams.enabled}"/>
    </af:panelForm>
    But I would like CustomerNumber to come from a session attribute. I tried something like that:
    session.setAttribute("CustomNum","IRI0001");
    setCustomerNumber(session.getAttribute("CustomNum"));
    with the View Object Editor -> Client Interface setCustomerNumber selected, but it doesn't work.
    I tried :
    String CustNum=session.getAttribute("CustomNum");
    %>
    <af:attribute name="#{bindings.CustomerNumber}"
    value="<%= CustNum%>"/>
    but it tells me that "Attribute value does not accept runtime expressions".
    Does someone know how I could do that?
    Thanks,
    Romain

    Hi,
    Frank's suggestion should work.
    Most importantly, don't forget to declare your bind variable in your view object !!
    Your statement looks odd to me
    String CustNum=session.getAttribute("CustomNum");
    %>
    <af:attribute name="#{bindings.CustomerNumber}"
    value="<%= CustNum%>"/>
    There are many ways to do it. You may try using backing bean for command button's actionlistener or action like the following
    class myBackingBean
    private String CustNum; //of course with getter and setter method
    myButtonAction() {
    CustNum = yourFavouriteValue;
    OperationBinding ob = getBindings().getOperationBinding("ExecuteWithParams"};
    ob.execute();
    note you must declare CustomValue in your pageDef's binding to #{yourBackBeanClass.CustNum} in your ExecuteWithParams binding
    I don't know and seems not being recommended to set session value in jspx.
    Another way is inside your command button in the jspx
    <af:setActionListener from="#{somesource.value}"
    to="#{processScope.CustNum}"/>
    in such case, you must declare CustomValue in your pageDef's binding to #{processScope.CustNum} in your ExecuteWithParams binding
    If you have already set session value somewhere beforehand, then what you need to do is simply declare CustomValue in your pageDef's binding to #{sessionScope.CustNum} in your ExecuteWithParams binding.
    I did lot of ExecuteWithParams thing and no problems occur so far.

  • Unable set session attribute with certain types.

    Hello I was surprise that when I execute HttpSession.setAttribute("somekey", new HashMap()), "somekey" will not be stored in the Session. I can replace HashMap with HashSet and it's okay.
              Out of curiosity, I create a Java class like below :
              public class abc implements Serializable {
              public String def = "def";
              And I have the same issue with HashMap and it will not get stored in the Session attribute. Does anyone know what kind of valid object and what makes the object storable into the Session's attribute? Any inputs are appreciated. Thanks.
              yien

    Actually never mind. It have something to do with BEA's Portal Ad services. I will post this into the appropriate forum.

  • Setting session attributes at the Role level

    I am running AM7.1 in Legacy mode and I am trying to create a role and assign session attributes at this role level. I followed the instructions for doing this but it does not seem to be working. I created the role and added the session service to it. I then went in an changed the attributes (Max Idle, Max Session, etc.) to the values I need for the role. I then assigned the role to a user. However when I log in as this user and look at the Active Sessions panel all of the values are still saying they are set at the defaults. It is not picking up the new values for the user. Am I missing something? Help! -Jeff

    Reply i was also getting this problem in relam mode but 7.0..........but when i specify in the url?role=rolename..........i see the session info applied but i wanted it to be dyanmically applied(without specifiying the role in the url).......i have raised an SR but that is for 7.0 .........please do it for 7.1 i think you might get some response.

  • 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

  • Session Attribute

    Hi,
    We have some problems with our portlet (deployed on portal 10g). We have two “applications”. One is outputting a menu with links to the other JSP that is redirecting the user.
    In the first application we set a session variable that needs to be read in the other JSP. But the redirecting script can’t read the session variable (session.getAttribute always returns null).
    And the funny thing is, we have an old version of these two scripts that are deployed and running on the same portal in the same OC4J (under different name) and they work properly.
    We checked all the settings we could think off, but we didn’t find anything.
    Regards,
    Gregor

    Hello Gregor,
    Here i have few quick thought that hit my mind..
    I am assuming you are developing JPDK portlet, right ?
    Just check out two settings,
    First:-
    While registering the provider, on the General Properties page we first write the web provider URL. Then on the same page, under User/Session Information section, make sure that Login Frequency must be selected as Always and Required Portal user specific session information must be checked.
    Click on Apply and OK.
    Second:-
    In the provider.xml the session attribute must be set to true.
    If you have already done the above steps, and still facing issues.
    please let me know, we will find some solution.
    Thanks
    <Neeraj Sidhaye/>
    Try_Catch_Finally AT YAHOO DOT COM
    http://ExtremePortal.blog.co.uk

  • Session attributes persists forever!

    When I validate form input in my servlet, I create a HashMap of error
    messages and store that Hash in the session
    (session.setAttribute("myErrors", hash))
    Then, I response.sendRedirect() the user back to the page and print
    the error messages with (session.getAttribute("myErrors")). After
    this, I try to clear the session attribute with:
    session.removeAttribute("myErrors"), but it still remains in the
    session!
    I even try to add a "new HashMap()" to the "myErrors" attribute after
    I remove it, but that doesn't work.
    Any ideas on why I'm unable to clear the attribute from my session?

    I found out that the session has changed. I am using Tomcat. This probably explain why the attribute is not there.
    When I use the back button, I get back to the earler session with all the attribute intact. Why does this happen???.
    JSP code below
    <BR>Session ID: <%= session %></BR>
    <%
         Enumeration ee;     
         ee = session.getAttributeNames();
         System.out.println("[START LIST]SESSION ATTRIBUTES........");
         while (ee.hasMoreElements()) {
              String s = (String)ee.nextElement();
    %>
    <BR><%=s %></BR>
    <%
         System.out.println("[END LIST] SESSION ATTRIBUTES........");
    %>

  • Error in retrieving session attribute for ejb remote in clustered env

              We store EJB remote object in session and differnt clients retrieve it from sessionbefore
              making a business method call. This seems to work in most cases but sometimes
              it gives the exception attached. This happens only in a clustered environment.What
              has been observed is that if we put the remote object inside a hashtablewhich
              in-turn is stored in session retrieval from hashtable does not give thisproblem.
              Any suggestion / solution would be greatly appreciated.
              Regards,
              Shilpa
              The exception Stack trace is attachedjava.rmi.NoSuchObjectException: Unable to
              locate EJBHome: 'BalconHome' on server:'t3://176.19.183.6,176.19.183.15:9616 at
              weblogic.ejb20.internal.HomeHandleImpl.getEJBHome(HomeHandleImpl.java:80) at weblogic.ejb20.internal.HandleImpl.getEJBObject(HandleImpl.java:184)
              at weblogic.servlet.internal.session.SessionData.getAttribute(SessionData.java:395)
              at com.chase.ccs.util.AccountInfoAccessor.setCurrentAccountAttributeBalcon(AccountInfoAccessor.java:362)
              at com.chase.ccs.util.ModelAccessor.initBlaconOfferModel(ModelAccessor.java:311)
              at com.chase.ccs.balancetransfer.OfferPortlet.service(OfferPortlet.java:88) at
              com.chase.ccs.balancetransfer.OfferView.pageStart(OfferView.java:65) at com.chase.ccs.util.ModuleStarter.doAllPageStart(ModuleStarter.java:236)
              at jsp_servlet._templates._template0005._UXaQVaXTUaSYaWaSRZfdXbWSfYXbTRQb.__ccs_mm_tgl_pfp_grid._jspService(__ccs_mm_tgl_pfp_grid.java:316)
              at weblogic.servlet.jsp.JspBase.service(JspBase.java:27) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
              at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:482)
              at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:308)
              at weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:116) at com.epicentric.servlets.ServletUtils.include(ServletUtils.java:150)
              at com.epicentric.template.Style.execute(Style.java:538) at com.epicentric.taglib.html.IncludeGridTag.doStartTag(IncludeGridTag.java:57)
              at jsp_servlet.__index._jspService(__index.java:560) at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
              at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:242)
              at com.epicentric.servlets.stackable.SiteDispatcherServlet.service(SiteDispatcherServlet.java:195)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
              at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2546)
              at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2260)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              

              The EJB is stateful session EJB. Have seen some posts pointing to problems
              with
              stateful session EJB and cluster and the suggested solution was SP4 (we are
              on 6.1 SP3).
              Hope this gets more clarity (and some solutions!!!).
              regards,
              Rajesh / Shilpa
              "Cameron Purdy" <[email protected]> wrote in message
              news:[email protected]...
              > It's probably caused by the fact that the session attributes get
              serialized
              > when they are in a cluster. (Something to do with ser/deser process?)
              >
              > Peace,
              >
              > Cameron Purdy
              > Tangosol, Inc.
              > http://www.tangosol.com/coherence.jsp
              > Tangosol Coherence: Clustered Replicated Cache for Weblogic
              >
              >
              > "Shilpa" <[email protected]> wrote in message
              > news:[email protected]...
              > >
              > > We store EJB remote object in session and differnt clients retrieve it
              > from sessionbefore
              > > making a business method call. This seems to work in most cases but
              > sometimes
              > > it gives the exception attached. This happens only in a clustered
              > environment.What
              > > has been observed is that if we put the remote object inside a
              > hashtablewhich
              > > in-turn is stored in session retrieval from hashtable does not give
              > thisproblem.
              > > Any suggestion / solution would be greatly appreciated.
              > >
              > > Regards,
              > > Shilpa
              > >
              > > The exception Stack trace is attachedjava.rmi.NoSuchObjectException:
              > Unable to
              > > locate EJBHome: 'BalconHome' on
              > server:'t3://176.19.183.6,176.19.183.15:9616 at
              > >
              weblogic.ejb20.internal.HomeHandleImpl.getEJBHome(HomeHandleImpl.java:80)
              > at weblogic.ejb20.internal.HandleImpl.getEJBObject(HandleImpl.java:184)
              > > at
              >
              weblogic.servlet.internal.session.SessionData.getAttribute(SessionData.java:
              > 395)
              > > at
              >
              com.chase.ccs.util.AccountInfoAccessor.setCurrentAccountAttributeBalcon(Acco
              > untInfoAccessor.java:362)
              > > at
              >
              com.chase.ccs.util.ModelAccessor.initBlaconOfferModel(ModelAccessor.java:311
              > )
              > > at
              > com.chase.ccs.balancetransfer.OfferPortlet.service(OfferPortlet.java:88)
              at
              > > com.chase.ccs.balancetransfer.OfferView.pageStart(OfferView.java:65) at
              > com.chase.ccs.util.ModuleStarter.doAllPageStart(ModuleStarter.java:236)
              > > at
              >
              jsp_servlet._templates._template0005._UXaQVaXTUaSYaWaSRZfdXbWSfYXbTRQb.__ccs
              > mmtgl_pfp_grid._jspService(__ccs_mm_tgl_pfp_grid.java:316)
              > > at weblogic.servlet.jsp.JspBase.service(JspBase.java:27) at
              >
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              > :265)
              > > at
              >
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              > :200)
              > > at
              >
              weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImp
              > l.java:482)
              > > at
              >
              weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImp
              > l.java:308)
              > > at
              weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:116)
              > at com.epicentric.servlets.ServletUtils.include(ServletUtils.java:150)
              > > at com.epicentric.template.Style.execute(Style.java:538) at
              >
              com.epicentric.taglib.html.IncludeGridTag.doStartTag(IncludeGridTag.java:57)
              > > at jsp_servlet.__index._jspService(__index.java:560) at
              > weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              > > at
              >
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              > :265)
              > > at
              >
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              > :200)
              > > at
              >
              weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp
              > l.java:242)
              > > at
              >
              com.epicentric.servlets.stackable.SiteDispatcherServlet.service(SiteDispatch
              > erServlet.java:195)
              > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at
              >
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              > :265)
              > > at
              >
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              > :200)
              > > at
              >
              weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
              > ntext.java:2546)
              > > at
              >
              weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
              > :2260)
              > > at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139) at
              > weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              >
              >
              

  • READ UNCOMPLETE DATE FROM SESSION ATTRIBUTE

    i have servlet read from DB and set result at vector and put it in session attribute to jsp that read it and print it
    but this view does takes 10 sec on my computer
    and on hosting server
    it shows date un complete what is do you thing it wrong

    i have servlet read from DB and set result at
    vector Vectors are normally discouraged because they're Synchronized.
    Why don't you read the ResultSet in an ArrayList Collection instead?
    and put it in session attribute to jsp that
    read it and print itInstead of putting the ArrayList of results (or in your case Vector) into the Session, you could store it in the HttpRequest attribute instead.
    HttpRequest attribute has an advantage over HttpSessions
    1) The Request Attribute is available through the scope of the Request
    But the session attribute can expire at any time. The session attribute will not work if the page gets cached by the browser.
    but this view does takes 10 sec on my computer
    and on hosting server If it is taking that long you may want to optimize your JDBC code.
    1) Use Connection Pooling
    2) Prepared Statements
    3) RowSet
    4) Check the SELECT statement
    it shows date un complete what is do you thing it
    wrongHard to say without looking at the code.

  • Session attribute between JVMs

    Hi,
    I have a JSP try to send two session attribute from one JSP to another. The target JSP is in different WEB server (JVM). How can I do so that target JSP can use "session.getAttribute" to get the attribute?
    1. Cann't use any JAVA Script in JSP.
    2. Conn't show or send hidden because I don't want let user see the value of the variable.
    Thanks
    Kenny

    SEND IT VIA HIDDEN BUT INSTEAD OF USING GET METHOD USE POST TO ADDRESS YR SECURITY CONCERNS

Maybe you are looking for

  • Pavilion dm4 failure "The recovery attempt has failed"

    Laptop gave me the following Message: The recovery attempt has failed. Select one of the following buttons. Save Log Details Retry. Saved the Log and Retry (two times) with same issue:This is the Log,Please Help   P2PP BurnBoot Check Failed   Possibl

  • I get a crash thread when opening iPhoto After install of mountain lion.

    I was told by apple tech support by phone to reinstall iPhoto. So I did. Did not work same crash every time. I took it to genius bar and he said I had to many photos for one library for iPhoto to manage so I should separate photo into smaller librari

  • 11g Read-Only repository on Linux

    Hi Currrenty I am struggling with a Read-Only issues on a new install of OBIEE 11g. I have install OBIEE11g on a Linux box and also on a windows server just to use the Repository Administation tool. I then created an ODBC DSN on the windows server to

  • Getting facility code in ALV

    I would like to get the facility code in my ALV repot for a customer statment report . Its been asked to populate that field using the logic as follows. The logic for the customer facility code should be something like this. Find the business locatio

  • What kind of design pattern is this?

    Hi , I am just learning the designpattern. So when I went through different kinds of design pattern, I got some doubts as it looks same some design patterns. could anybody please tell what kind of design pattern is the following one? public interface