Controlling Sessions in JSP

Hi,
I wonder is it possible to have control over session objects whether in JSP code or via application server configurations.
Controlling means:
+ Memory space used for session objects
+ Maximum space available for session objects
Is it an application-server-relater config or can be simply set or accessed via JSP code?
Thanks in advance.

to what end?
You have to really know what you're putting in the session to know how much memory is used. Generally, you have 2 bytes per char in a string, whatever the primitive types use (1-8 bytes), and 32 bytes for an object (if I recall correctly)... depending on the object data (much of the time it boils down to strings and primitives anyway, it seems). Then you could try adding up what's in the session and keep a count of the usage. But otherwise there's no simple way to keep track of the memory usage.

Similar Messages

  • How can we add a control on our .jsp webpage for uploading several image fi

    How can we add a control on our .jsp webpage for uploading several image files as done in gmail attachment, Where a Remove button also appears if we wanna remove the particular attachment.

    The SCOM Management Server is in Domain A.  I've tried it already and it has failed.  
    So just to clarify the method I used was to go to Administration>Security>User Roles.  Then New User Role>Read-Only Operator.  In the Create User Role Wizard I then gave the User Role a name, Clicked "Add" under User Role Members.
     Then the Select Users or Groups window pops up and I changed the Locations from Domain A to Domain B and searched for the user, which it's able to find, then clicked "OK" to add it to the User Role members which it does just fine.  On
    the next page which is Group Scope I checked the one group I want this account to have access to and then click next.  This brings me to Dashboards and Views where I click the radio button for "Only the dashboards and views selected in each tab are
    approved" and chose the folder of dashboards I want this account to access and then click next.  This brings me to the Summary and I click "Create".  At this point it thinks for a moment then closes out the wizard but the new Read-Only
    Operator does not appear.  I then look in Event Viewer and see the Event I pasted above.
    Am I doing something wrong here?  Any guidance on how to get around this issue would be much appreciated.
    Thanks,
    Jake

  • How to make controls static in jsp page

    Hello Friends.............
    I want to make controls or objects static which are on jsp page.
    i.e. when my window is maximized then every thing is perfect but when i restore my window all the controls on the jsp page gets destorted.....
    I want to make look that jsp page same in both the positions of window.
    1) When window is maximized.
    2) When window is minimized.
    The controls should not get destorted.
    Can any body please help me out in this issue....
    Thanks
    Sameer Rede

    This has nothing to do with JSP. It's all about HTML and CSS. You can use CSS to specify fixed sizes/locations for things, or you can use HTML tables to control layouts.

  • Session in JSP page

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

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

  • Servlet not forwarding a control to the jsp with req dspher

    hi ppl,my servlet code is supposed to forward a control to a jsp page so as to display the value in the jsp.but the request dispatcher's forward is not forwarding the control to the jsp page.....here is my servlet code----
    // Decompiled by DJ v3.4.4.74 Copyright 2003 Atanas Neshkov  Date: 7/4/2003 12:37:00 PM
    // Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
    // Decompiler options: packimports(3)
    // Source File Name:   BdgtMaster.java
    package publicity;
    import java.io.*;
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class BdgtMaster extends HttpServlet
        public synchronized void service(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse)
            throws ServletException, IOException
            Object obj = null;
            String s3 = "";
            String s4 = "";
            out = httpservletresponse.getOutputStream();
            String s = "";
            String s1 = "";
            String s2 = httpservletrequest.getParameter("option");
            s3 = httpservletrequest.getParameter("branch");
            s4 = httpservletrequest.getParameter("publicity_code");
            String s5 = httpservletrequest.getParameter("budget");
            try
                String s6 = "0";
                String s7 = "0";
                String s8 = "INSERT INTO Budget_Master(Branch,Publicity_Code,Budget_Alloted,Work_In_Progress,Amount_Paid) VALUES (?,?,?,?,?)";
                String s9 = "update budget_master set old_budget = budget_alloted where branch='" + s3 + "' and publicity_code=" + s4;
                String s10 = "UPDATE Budget_Master set budget_alloted=" + s5 + " where Branch='" + s3 + "' and publicity_code=" + s4;
                datasource = "jdbc:odbc:budget";
                con = DriverManager.getConnection(datasource);
                int i = con.getTransactionIsolation();
                con.setTransactionIsolation(2);
                con.setAutoCommit(false);
                if("new".equalsIgnoreCase(s2))
                    PreparedStatement preparedstatement = con.prepareStatement(s8);
                    preparedstatement.setString(1, s3);
                    preparedstatement.setString(2, s4);
                    preparedstatement.setString(3, s5);
                    preparedstatement.setString(4, s7);
                    preparedstatement.setString(5, s6);
                    preparedstatement.executeUpdate();
                    con.commit();
                    preparedstatement.close();
                if("update".equalsIgnoreCase(s2))
                    Statement statement = con.createStatement();
                    statement.executeUpdate(s9);
                    statement.executeUpdate(s10);
                    con.commit();
                con.setTransactionIsolation(0);
                /*htmlStart(out, "BUDGET MASTER");
                out.println("<p> </p><div align=\"left\">");
                out.println("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"50%\">");
                out.print("<tr>");
                out.println("<td width=\"50%\"><strong><small><font face=\"Tahoma\">Branch </font></small></strong></td>");
                out.println("<td width=\"50%\"><small><font color=\"#004080\" face=\"Tahoma\">" + s3 + "</font></small></td></tr><tr>");
                out.println("<td width=\"50%\"><strong><small><font face=\"Tahoma\">Budget Alloted </font></small></strong></td>");
                out.println("<td width=\"50%\"><small><font color=\"#004080\" face=\"Tahoma\">" + s5 + "</font></small></td></tr><tr>");
                out.println("<td width=\"50%\"><small><strong><font face=\"Tahoma\">Publicity Code</font></strong></small></td>");
                out.println("<td width=\"50%\"><small><font color=\"#004080\" face=\"Tahoma\">" + s4 + "</font></small></td></tr></table></div>");
                htmlEnd(out);
              con.close();
                httpservletrequest.getRequestDispatcher("/pages/serview/BdgM.jsp").forward(httpservletrequest,httpservletresponse);        
            catch(SQLException sqlexception)
                cleanUp();
                printSQLException(sqlexception, out);
            out.flush();
        public void init(ServletConfig servletconfig)
            throws ServletException
            super.init(servletconfig);
            try
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                return;
            catch(ClassNotFoundException classnotfoundexception)
                log("Couldn't load class sun.jdbc.odbc.JdbcOdbcDriver");
                throw new ServletException(classnotfoundexception.getMessage());
        static void printSQLException(SQLException sqlexception, ServletOutputStream servletoutputstream)
            throws IOException
            servletoutputstream.print("<b>SQLException</b>\n<p>\n\n");
            for(; sqlexception != null; sqlexception = sqlexception.getNextException())
                servletoutputstream.print("<b>SQLState:</b> " + sqlexception.getSQLState() + "<br>\n");
                servletoutputstream.print("<b>Message:</b> " + sqlexception.getMessage() + "<br>\n");
                servletoutputstream.print("<b>Vendor:</b> " + sqlexception.getErrorCode() + "<br>\n");
        private static boolean checkForWarning(SQLWarning sqlwarning)
            throws SQLException
            boolean flag = false;
            if(sqlwarning != null)
                System.out.println("\n *** Warning ***\n");
                flag = true;
                for(; sqlwarning != null; sqlwarning = sqlwarning.getNextWarning())
                    System.out.println("SQLState: " + sqlwarning.getSQLState());
                    System.out.println("Message:  " + sqlwarning.getMessage());
                    System.out.println("Vendor:   " + sqlwarning.getErrorCode());
                    System.out.println("");
            return flag;
        /*void htmlStart(ServletOutputStream servletoutputstream, String s)
            throws IOException
            servletoutputstream.println("<html><head><title>" + s + "</title></head>");
            servletoutputstream.println("<body topmargin=\"0\" leftmargin=\"0\" bgproperties=\"fixed\">");
            servletoutputstream.println("<div align=\"left\"><table border=\"0\" width=\"100%\">");
            servletoutputstream.println("<tr><td width=\"100%\" bgcolor=\"#DFDFFF\">");
            servletoutputstream.println("<font face=\"Tahoma\" color=\"#000000\"><strong>B u d g e t   M a s t e r - D e t a i l s   E n t e r e d</strong></font></td>");
            servletoutputstream.println("</tr></table>");
        void htmlEnd(ServletOutputStream servletoutputstream)
            throws IOException
            servletoutputstream.print("<hr>");
            servletoutputstream.print("</body></html>\n");
        String link(String s, String s1)
            return "<a href=\"" + s + "\">" + s1 + "</a>";
        public String getServletInfo()
            return "Display and SQL manipulate JDBC databases on the server.";
        public void cleanUp()
            throws IOException
            if(con != null)
                try
                    out.print("Closing database connection");
                    con.setTransactionIsolation(0);
                    con.close();
                    return;
                catch(SQLException _ex)
                    return;
            else
                return;
        public BdgtMaster()
        private Connection con;
        private String datasource;
        private String user;
        private String password;
        private String base;
        private ServletOutputStream out;
    plz tell me where im wrong...
    regards....a_joseph

    Hi,
    Sorry to say this but it'd be lot simple if we can avoid cross posting similar Queries.
    I'd appriciate if you can continue using with your post
    http://forum.java.sun.com/thread.jspa?threadID=5208928
    Hope there are no hard issues on this.
    REGARDS,
    RaHuL

  • How to Handle user Session in JSP

    Help me,
    How to handle user session in JSP.......

    Prakash_Pune wrote:
    tell me some Debugging tech. so i can overcome from my problem.....Do you use an IDE? Any IDE ships with a decent debugger where in you can just execute the code step by step, explore the current variable values and check what exactly is happening. For example Eclipse or IntelliJ. If you don´t use an IDE, then just place some System.out.println() or Logger.debug() statements at strategic locations printing the variables of relevance so that you can track in logs what exactly is happening.
    or tell any other way to find is my page is thread safe or not...Just write correct code and narrow the scope of the variables as much as possible. If you for example assigned the user object to a static variable or as a servlet´s instance variable, then exactly the same user object would be used everywhere in the application. That kind of logical things.

  • Using ReportViewer Controls in a jsp application calling Reporting Services using Web Services

    Hi,
     I am invoking RS web services to render reports, using Apache Axis to generate stub classes from Reporting Service WSDL.
    Please let me know if I can integrate Report Viewer control in the jsp where I am writing the report output. Else do I have to create my own custom tags simulating ReportViewer functionality.

    did anyone of you have tried it or not?
    i need this thing tobe confirmed. i have drilled the google and others.but can't find other than
    http://www.mainsoft.com/products/SQLServerReportingServicesConnectorforWPS.aspx

  • How to clear session in JSP?

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

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

  • What is the use of session in jsp

    hai,
    what is the use of session in jsp. i cant understand from books. give some practical approach
    thanks

    give some practical approachYou sound like a supervisor ordering for a cup of coffee.
    I DONT TAKE ORDERS !!
    IMAO
    Which book did you refer ? Did you google ?

  • Want to get ApEx session in JSP

    Hi Pals,
    From my ApEx application, I am calling a JSP by providing a direct URL.
    THe JSP does some specific function here.
    If the user get the JSP url by right click and view source, they can very well use this outside my ApEx application.
    I want to apply security like, the JSP url only works inside my ApEx application.
    My thought, if I can share ApEx session with JSP session I can impose the security check in JSP level.
    Any idea would be appreciable.

    Hi,
    Im using below method to call jsp page and passing UserName, application id and Session as
    <iframe src="http://apex.oracle.com/pls/otn/...javaapplication.jsp?userId=&USER.&appId=&APP_ID.&sessId=&SESSION."></iframe>
    Vailidation is done against the table "wwv_flow_sessions$" of schema : flows_030100 ,whether those values are exist in table.
    But if user is already logged into apex application, he can run the jsp independantly taking the url from "view source".
    Im also looking for more solid validation
    Regards,
    Benz

  • Making  a session in jsp.

    I want ti make a session in jsp.
    suppose if any budy can login through login page which is
    www.harshworld.info/login.jsp
    they will just direct open that page
    www.harshworld.info/wallpage.jsp
    then this page will not open . & user will see The login page it self.
    So after making session in jsp what can i do ?
    & how to Do can one help me.
    PL Thanks for Giving time to me

    THk dear
    there's always a session...
    if(session.getAttribute("username") == null) {
    response.sendRedirect("login.jsp");
    return;
    and put the attribute in the session on successful
    login..
    Or look up other security modes.

  • Handling Session in jsp and bean scope

    i have problems with handling session in jsp
    I want to check on all jsp pages
    first thing is session is null
    i want to him to be redirected to first page
    and he should not be able to go ahead
    I tried
    if(session ==null)
    response.sendRedirect("Login.jsp");
    but this does not seem to work
    It is very crtical problem can any one answer
    this asap
    Also i wanted to know that
    I have bean which in turn calls static methods of another class which holds all DomainTable(database tables which do not change frequently)
    Information .
    This is bean is being implemented by me
    in seession scope in a jsp
    Do u guys think it would be goo idea to change
    scop of this bean as Application in jsp
    if so what would be advantages for same
    I would appericate if i could a quick reply on both
    question
    as i am time crunch
    arsh

    You will always get some value of session and your code wont work. At the end of your Login.jsp, you should create a sesssion and store attributes. Check for these attributes in session, rather than checking session==null.

  • Maintain session in JSP frame

    Hi,
    I am having trouble in maintaining session in jsp frames. -
    Here is sample code
    parent.jsp
    <HTML>
    <HEAD>
    <LINK rel=stylesheet type="text/css" href="defaults.css">
    <TITLE>abc</TITLE>
    <%     
         String checkAmount = "100.00";
         session.setAttribute("checkAmount", checkAmount);
         System.out.println("checkAmount in ppmain"+session.getAttribute("checkAmount"));
    %>
    <FRAMESET rows="235,*" frameborder="no" >     
    <FRAME NAME="pptop" SRC="top.jsp" frameborder=0 scrolling=no noresize >
    <FRAME NAME="ppbottom" SRC="bottom.jsp" frameborder=0 scrolling=no marginwidth=0 marginheight=0 noresize>
    </FRAMESET>
    </HTML>
    top.jsp -
    <HTML>
    <HEAD>
    <LINK rel=stylesheet type="text/css" href="defaults.css">
    <TITLE>top</TITLE>
    <%     
    System.out.println("session in top "+session);
    System.out.println("checkAmount in top "+session.getAttribute("checkAmount"));
    %>
    </HTML>
    It is not able to retain session in the top.jsp ( in SOP for session I get different session ID in parent.jsp and top.jsp
    This Works well in local but when gets deployed to WAS6 server troubles starts.
    Any help is appreciated.
    Thanks

    When you create URLs, you might want to try using JSTL to rewrite them:
    <FRAME NAME="pptop"
           SRC="<c:url value='top.jsp'/>"
           frameborder=0
           scrolling=no
           noresize >
    <FRAME NAME="ppbottom"
           SRC="<c:url value='bottom.jsp'/>"
           frameborder=0
           scrolling=no
           marginwidth=0
           marginheight=0
           noresize>Or you can use:
    SRC='<%= response.encodeURL("top.jsp") %>'

  • How to block ABAP Debugger Controls Session 1 (Exclusive) pop-up ?

    Hello dear experts,
    Whenever I save my report after my first debugging, the program automatically pops-up open a debugger window of controls session 1.  I tried to delete all the breakpoints but it still kept coming.
    Kindly, help me with this issue, it's actually obstructing a lot of work.
    Thanks and regards,
    Ambareesh J.

    Go to breakpoints tab of debugger, and delete all breakpoints.
    Repeat steps for watchpoints tab.
    Then Go to Menu > Settings, Change debugger profile/settings. Uncheck system and update debugging if they are already checked.
    Then click on Save, and come out of debugger.
    Logout, Login, and Retry.

  • Problem with Sessions in JSP

    Hi,
    I am working on a JSP based website, where I am facing problem with sessions. The user is asked to login by providing her id and password. If found correct, a bean is created and populated with all her details and placed in session scope. I plan to use the information stored in the bean on other related pages until she logs out.
    <jsp:useBean id="validUser" scope="session" class="UserBean" >
    <c:set target="${validUser}" property="userId" value="${fn:trim(dbValues.UserId)}" />
    <c:set target="${validUser}" property="userName" value="${fn:trim(dbValues.UserName)}" />
    </jsp:useBean>
    <c:redirect url="userHome.jsp" /> The user is presented her homepage - 'userHome.jsp', where she can find various links, like 'Update Profile', 'Pay Registration Fees', 'Book Room' etc. The information stored in the bean is available on 'userHome.jsp'page.
    <A HREF='userHome.jsp'>Home</A>
    <A HREF='editPersonal.jsp'>Update Profile</A>
    <A HREF='registrationFee.jsp'>Pay Registration Fees</A>
    <A HREF='bookRoom.jsp'>Book Room</A>
    <A HREF='logout.jsp'>Logout</A> The problems are:
    1. Whenever user clicks on any of the above mentioned links and moves to any page, the bean comes out as null.
    <%-- Verify that the user is logged in --%>
    <c:if test="${validUser == null}">
    <jsp:forward page="loginForm.jsp">
    <jsp:param name="origURL" value="${pageContext.request.requestURL}" />
    <jsp:param name="errorMsg" value="You must be logged in to access this site." />
    </jsp:forward>
    </c:if> 2. The URL shows an additional jsessionid, which my client doesn't want to see.
    3. On every click on any link, the value of this jsessionid changes.
    What I presume, when I am clicking on different links, my session changes, and so I am seeing a different jsessionid. And since session is changing, therefore the bean is not available in a different session.
    All this works fine with localhost, problem comes into picture, when I upload my pages to the server.
    Puzzled, can anyone help, where am I going wrong? Let me add here, I am new to JSP and hence don't have much resources with me.

    There are several ways sessions can be exchanged between the browser and the server in a j2ee web application.
    1. The default is through cookies. However when the client does not accept cookies, the server appends the session id to the url.
    2. Some servers also facilitate session information exchange using session id in the url even if the client does accept cookies. This is usually ahieved through a setting in some server configuration file.
    You will have to find out why the server in your application is appending the session id to the url.
    Whatever be the case, the server should be able to look up the session from the incoming request (be it from the session id in the url or a session cookie).
    When session information is exchanged through the JSESSIONID in the url, you should ensure that each and every url that goes to the server has this input parameter. To do that all links and form post urls in your servlet/jsp should be treated with a call to encodeURL().
    For example, in a jsp
       <a href = "<%=response.encodeURL("/nextJsp.jsp")%>">Click here </a>
    or
       <form action = "<%=response.encodeURL("/nextJsp.jsp")%>">
       </form>etc.
    ram.

Maybe you are looking for

  • Need program for running accruals mid-month

    Hi, We have accruals set up at period-end (and not Receipt) at Purchasing options. For testing this, I cannot close period or change period date. I know there is program that runs Accruals for all unpaid purchase orders (possibly in payables) I searc

  • Get error 69 trying to restore from a backup CD

    I have only seen this error associated with an ipod in every search I have made.  Can not contact Apple Itunes Support without a serial number... the problem is not with my ipod!!!!! It is when I try to restore from the CD's I burned!! If I "explore"

  • How do I 'call' external instance methods?

    I want to send a message from a Controller to another Class  to execute a method.  Inside the controller, I typed my message:                      [[MemoryContent]  PopulateMemory]; What I think I am doing here is telling it to go to the MemoryConten

  • Can you add Web Clips to Launchpad?

    I think that Launchpad can take a while getting used to, but it's cool. I have alot of web sites I vist to alot like Facebook. Can I add them to Launchpad like in iOS?

  • Is there shutdown of primary database needed when creating standby by Grid?

    I want to create physical standby database using EM Grid Control. Is there neccessary during the process to shutdown primary database, e.g. when creating backup of primary database? Thanks for advise, M.