Closing the JWS Applet: shutdown hook is not invoked

Windows 2000, Java Web Start 1.4.2_05
I am running my applet with Java Web Start.
If I close the JWS Applet window by clicking the upper right "X" button, the applet is being shut down.
I want to perform a task like showing a warning message, before the applet disappears, but even if I implement the "Shutdown Hook", the according methods are not invoked by JWS.
Does anybody know, how I can prevent the JWS window from being closed without notifying my applet?

Another idea: Is it perhaps possible to disable/remove the "X" button from the JWS applet window?

Similar Messages

  • When Closing the window giving error " Virtual Column not allowed"

    Hi All,
    In my main block, i have a button, on clicking which will open a new window(block) with a free text field to enter.
    I have a Save button in a new window which will save entered text fiedl and refresh the main block to see the value entered in a new block.
    But suppose, if entered something in text field and without saving if i close the window and try to exit from the form
    It is asking me to save the form or not and if i press Yes
    Then it gives me below error
    ORA-01733: virtual column not allowed here
    FRM-40508: ORACLE error: unable to INSERT record.
    If i see from Display database error' It is trying to insert the record into the view On which my new block has based( i know it is not possible).
    Any suggestion on this please?
    Thanks,
    pavan

    Pavan,
    How are you populating your block? It sounds like you are populating the block manually (eg; Looping through a cursor and assigning values to each row of your block). If this is what you are doing, then YES you will get these kinds of errors. Ideally, you should base your data block on your data (either directly on the base table or view of if you are using a query, then a FROM Clause based block).
    I'm guessing here, so would you mind posting a description of your data block(s) is/are set up?
    Craig...

  • The Action in My jsCookMenu is not invoked Properly ..

    Hi all,
    I know this is an old issue but unfortunately no solution yet ???
    i read a lot of older post describing the problem but with older versions of Myfaces and tomahawk
    and the solution was to put the :
    <input id="jscook_action name="jscook_action" type="hidden"/>
    in the jsp page.
    but this field already exist in the page when i view the HTML source of the page
    and when i click on the home item in the menu the url appear to be :http://localhost:8080/MyFacesJSCookMenu/remitForm_jsfMenu_menu:A]home
    'home' is the navigation rule .
    why this "remitForm_jsfMenu_menu:A]" appear in the url too ??!!
    I'm using Tomcat 6.0.20 , Jdk 1.6 JSF 1.2 Myfaces 2.0.1 and tomahawk 1.1.9 under eclipse IDE
    My Jsp code :
    <t:jscookMenu id="JsfMenu" layout="hbr" theme="ThemeOffice" >
                                       <%
                                            /*      Available jscookMenu themes: ThemeIE, ThemeMiniBlack,ThemeOffice,
                                                 ThemePanel
                                                 Available jscookMenu layouts: hbr, hbl, hur, hul, vbr,vbl, vur, vul
                                                 respect to Heng Yuan http://www.cs.ucla.edu/~heng/JSCookMenu
                                       %>
                             <t:navigationMenuItems value="#{menuBuilder.navItems}" />
                        </t:jscookMenu>
    Java code responsible for generating the menu :
    // children for item 2
              logger.info("Building Menu ...");
              NavigationMenuItem[] subItems = new NavigationMenuItem[2];
              subItems[0] = new NavigationMenuItem(" Setting","action2_1", "iconUrl", false);
              subItems[0].setIcon("images/coin.gif");
              subItems[1] = new NavigationMenuItem(" Printer","action2_2", "iconUrl", false);
              subItems[1].setIcon("images/coin.gif");
              // item 2
              NavigationMenuItem itemWithChildren = new NavigationMenuItem(" Settings", "action2", "iconUrl", false);
              itemWithChildren.setNavigationMenuItems(subItems);
              // root items
              navItems = new NavigationMenuItem[3];
              navItems[0] = new NavigationMenuItem(" Utilites","action1", "iconUrl", false);
              navItems[0].setIcon("images/coin.gif");
              navItems[1] = itemWithChildren;
              navItems[1].setSplit(true);
              navItems[1].setIcon("images/coin.gif");
              navItems[2] = new NavigationMenuItem(" Logout","home", "iconUrl", false);
              navItems[2].setSplit(true);
              navItems[2].setIcon("images/coin.gif");
    Am i missing something ? or is it something in the configuration of my working environment ?
    thanks for help.

    Go to the link below.Enter your Product Number as listed on Service Tag attached to bottom of notebook (may be under battery). You can also get the Product Number by pressing Fn + Esc key. After entering PN, click Next ,then choose Software & Drivers.On the next page use the dropdown to select your OS (probably Windows 7 64bit). A list will populate with drivers. Download & Install the latest Audio driver. Restart the laptop after installing.
    http://h10025.www1.hp.com/ewfrf/wc/siteHome?cc=us&lc=en
    ******Clicking the Thumbs-Up button is a way to say -Thanks!.******
    **Click Accept as Solution on a Reply that solves your issue to help others**

  • Shutdown hook not getting called when running tomcat as a service

    I have a shutdown hook as part of a lifecycle <Listener> tomcat6 class, which gets created and registered in the class's constructor (class is referenced in the server.xml). The hook gets called during shutdown when tomcat has been started from a shell, but not when tomcat has been installed as a service. The -Xrs flag doesn't make a difference either way. I am running java 6u12 server VM (haven't tried client) and prior versions. Does anyone have any ideas? This has been tested by starting/stopping from the Control Panel, and also with 'tomcat6 //TS/ServiceName' (i.e. in test mode)
    One possibility is that tomcat internally calls Runtime.halt(), but the shutdown process appears to be normal and the same with either scenario. The other possibility is that the JVM has an issue. The tomcat user groups don't have anything to offer.
    Thoughts?
    tia

    sanokistoka wrote:
    jschell wrote:
    sanokistoka wrote:
    Let me ask the last question in a better way: Does anyone have any GOOD ideas?Get back to us when you have found your good solution.Stop wasting bandwidth. I didn't post here to be a smart ars like you and pretend that I have a solution to a rare problem... FYI - the workaround is to use the tomcat lifecycle events (AFTER_STOP_EVENT) to achieve the same - why do you think I mentioned it's a tomcat listener in the first place? Feel free to educate me.
    So you are claiming that Runtime.getRuntime().addShutdownHook() that you posted in the above is not part of the java API?
    Or perhaps that everything that is added via addShutdownHook() runs?
    Surely you are not claiming that it isn't calling addShutdownHook() in the first place?
    Get a life and a job.I have both but thanks for the concern.
    sanokistoka wrote:
    swamyv wrote:
    There are free tools available to debug windows. I think gdb is one of them. If you search you can find some good tools.
    If you find any good tools that you like share it with us.
    Yes I will try gdb (have cygwin) and see where this takes us - not sure if the JVM or tomcat6.exe have the symbols to get a meaningful stack trace. As luck would have it, [https://issues.apache.org/bugzilla/show_bug.cgi?id=10565|https://issues.apache.org/bugzilla/show_bug.cgi?id=10565] claims that "shutdown hooks are not supported in a container environment" although there is no such restriction in the servlet spec, which would make this a tomcat issue (it does sound like that tomcat6.exe wrapper is somehow involved). Unfortunately, tomcat does NOT issue the AFTER_STOP_EVENT if killed before it has completed its start-up (it appears its own shutdown hook, which sends the event, is not registered until it has fully come up); thus the need for a shutdown hook (at least, up until it's fully up). A shutdown hook is still required in my case for clean-up after tomcat is completely out of the picture. It sounds like the proper architecture here is to really embed tomcat in an application, and create a shutdown hook at the outer level.
    Educate me some more. The above description certainly seems like you are suggesting that both of the following are true.
    1. It is not a bug in the VM.
    2. The problem, for your implementation, is in how the wrapper terminates the windows service.
    Perhaps what is actually happening it that addShutdownHook() is never being called at all? Thus of course any processing of the thread associated with that would never, ever run.
    And that happens because you are banging on the stop service so fast that it doesn't actually have time to spin up?

  • Statement.close() Not closing the Result set

    Hi all,
    I have the following code which invokes a procedure in Oracle database
    public static callProcedure(Connection connection,String procedure){
    ResultSet resultSet = null;
    CallableStatement callableStatement = null;
    try {
    callableStatement = connection.prepareCall(procedure);
    callableStatement.registerOutParameter(1,OracleTypes.CURSOR);
    callableStatement.execute();
    resultSet =((OracleCallableStatement)callableStatement).getCursor(1);
    } catch (Exception exception) {
    exception.printStackTrace();
    } finally {
    try {
    callableStatement.close();
    } catch (SQLException sqlException) {
    sqlException.printStackTrace()
    return resultSet;
    Ideally if i try to iterate through the result set which is returned then it should give me resultset closed as i am closing the resultset. But this is not happening.
    Please anybody can explain the isue

    Hi,
    That is not easy to explain, I might take a guess and say that a statement cache is being used therefore the statement is not actually being closed.
    I always close the reultset then the statement so wouldn't notice this behaviour.
    Why are you returning a resultset anyway? If you really need to do this I would suggest using a disconnected resultset:
    OracleCachedRowSet ocrs = new OracleCachedRowSet();
    ocrs.populate(resultSet);
    return ocrs;

  • When I restart the browser, its not opening the previously opened tabs even though I saved before closing the browser. Pls guide me.

    Dear sir,
    When I restart the browser, its not opening the previously opened tabs even though I saved before closing the browser. This problem was not there in the older versions less than 3.6.8. Even the browser speed has gone down. This is everyday problem with this browser.
    Pls suggest ASAP.
    Thanks & Regards,
    Tripad

    See this article for some suggestions: [[Firefox has just updated tab shows each time you start Firefox]]
    See also http://kb.mozillazine.org/Preferences_not_saved and Preferences are not saved

  • Prompt user to save change before abnormally closing the application

    Hi,
    I've some trouble prompting user to save change before abnormally closing the application (logging off, shutdownding machine...). I tried to use Runtime.getRuntime().addShutdownHook() and it doesn't seem to work. Here's part of my code. Help please!!!
    program print out "1" and stays in a "dead-lock" mode...
    private void shutdown() {
    boolean saveConfig = true;
    if (saveConfig) {
    System.out.println("1 ");
    int answer = JOptionPane.showConfirmDialog(null,
    "Configuration has been changed. Do you want to save
    configuration before exit?",
    "Save Config"
    JOptionPane.
    YES_NO_CANCEL_OPTION);
    JOptionPane.showMessageDialog(this, "Can't connect to unit. Error in Heal unit!", "Error", JOptionPane.INFORMATION_MESSAGE);
    System.out.println("2 ");
    if (answer == 0) {
    savefileButton_actionPerformed();
    jMenuFileExit_actionPerformed();
    else if (answer == 1) {
    jMenuFileExit_actionPerformed();
    else {
    return;
    else {
    int answer = JOptionPane.showConfirmDialog(itself,
    "Are you sure you want to exit? ",
    "Exit",
    JOptionPane.YES_NO_OPTION);
    if (answer == 0) {
    jMenuFileExit_actionPerformed();
    else {
    return;
    private class MyShutdownHook extends Thread {
    public void run() {
    shutdown();
    // add shutdown hook
    MyShutdownHook shutdownHook = new MyShutdownHook();
    Runtime.getRuntime().addShutdownHook(shutdownHook);

    doesn't much matter. shutdown hooks are not guaranteed to run or be able to finish.

  • Shutdown hooker, how does it work?

    hello All:
    I am writting a Java service that might crash for unknown reasons. As a failover mechanism, i was thinking to use shutdown hook to do house cleaning work such as closing db connection, notifying the client of this service, etc.
    However, people point it out that #1, inside shutdown hook it is ok to close db connection, but notifying client won't work; #2, shutdown hook is not reliable and likely not be called in the first place when the system crashes. Like that in the Linux env, it can be killed by "kill" or "kill -9", the impact on the service can be different.
    Anyone can make a comment about the above statements? And what's the best options in a crashing sceanario?
    Thanks,
    Sway

    mlk wrote:
    pierrot_2 wrote:
    Right, if I knew I had to pucker up, I'd put my head between my legs first... but there's no way to tell. Is there anything else you can use to moniter external conditions -- a backup battery?Some UPSes can inform the host that is has lost power and should shut down (but that is not a Java problem but a general OS/server setup issue). But you can't guard against everything (kill -9, running on a VM and someone killing your VM in that). The best you can do is attempt to make sure that you leave the world in as sane state as possible (for example good use of transactions) and make sure your monitoring solution works.Best example of that I ever encountered was a computer with 2 independent power supplies hooked up to an extension cable with a splitter, going into a single UPS and a single wall outlet.
    Someone tripped over the cable, pulling it out of the UPS outlet, thus killing the power to the machine past the point where the UPS is set to guard against power failure, and due to the idiotic arrangement which compromised the very reason (failsafe) there were 2 power supplies causing the machine to turn off.
    No amount of software can guard against such stupidity, yet we were told to modify the software so that it would continue to run in case of power failure (not joking, really happened).
    After much debate we modified it to constantly monitor and document its own state so it could restart where it left off before a power failure.

  • Logger disabled in shutdown hook thread

    Hi, all,
    In a shutdown hook thread, i want to keep a log using jdk1.4's logging class as following:
    public void run(){
    synchronized(this){
    logger.info("System Shutdown");
    But the logger does not work. Does anybody have the idea?
    I create the logger with the following:
    FileHandler fh = new FileHandler("MyLog.log");
    fh.setFormatter(new CCXmlFormatter());
    logger=Logger.getLogger("MyLog");
    logger.addHandler(fh);

    Please accept my appology for the off subject materiel. I just finished writing this and do not want to edit...
    There is a design problem in the MemoryHandler class in that the close() method does not invoke push() as might be expected because most close() methods do flush buffers. This problem is exacerbated by the fact that LogManager registers a shutdown hook that closes all handlers. The log manager shutdown hook also does not invoke push() for memory handlers. Thus it is incumbent upon the user to invoke push() prior to shutting down. It would be natural to do this in a shutdown hook inside of a configureLogger() method. For example,
    private static Logger configureLogger() {
    Logger logger = Logger.getLogger("com.javarules");
    logger.setLevel(Level.ALL);
    try {
    target =new FileHandler("%t/javarules.log",20000,1);
    target.setFormatter(new SimpleFormatter());
    } catch(IOException e) {
    e.printStackTrace();
    System.exit(1);
    memoryHandler = new MemoryHandler(target,
    2000,
    Level.SEVERE);
    Runtime.getRuntime().addShutdownHook(new Thread() {
    public void run() {
    memoryHandler.push();
    logger.addHandler(memoryHandler);
    logger.setUseParentHandlers(false);
    return logger;
    The problem with this is that shutdown hooks are a bunch of unstarted threads that the JVM runs concurrently. There is no guarantee this shutdown hook will run before the log manager closes the handler. (In my experience, the log manager shutdown hook runs first most of the time.)
    Closing a memory handler does two things. The target handler is closed and the memory handler level is set to OFF, which means that when your shutdown hook runs, nothing is published and the push() method completes normally. In single-threaded applications memory-Handler.push() can be invoked at the bottom of the main method. GUI applications should invoke it in AWTExceptionHandler (or whatever you call your top-level exception handler) as well as the windowClosing (WindowEvent e) method.
    There is actually a larger design issue than not being able to invoke push() in a shutdown hook. Should the LogManager class be registering a shutdown hook that invokes reset()? The API docs for that method read as follows.
    Reset the logging configuration.
    For all named loggers, the reset operation
    removes and closes all Handlers and (except
    for the root logger) sets the level to null.
    The root logger's level is set to Level.INFO.
    Bug Id 4682478 addresses this question, but misses the mark because it suggests an ordering (or reordering) of shutdown hooks. The evaluation correctly notes that it �is dangerous to rely on ordering of shutdown operations.� As noted above, shutdown hooks are a bunch of unstarted threads that a JVM starts and runs concurrently. They are not and never will be ordered. See java.sun.com/j2se/1.3/docs/guide/lang/hook-design.html for a discussion. The question, however, is not the fact that shutdown hooks are unordered. The question is should the log manager be closing handlers. In other words, should LogManager be registering a shutdown hook at all? If the answer is yes, the only plausible explanation is the push() method in a memory handler, which explains why I began this section with a discussion of that method. There is no documentation to support this theory (which in and of itself is a problem), but it is at least possible that the Cleaner thread (which is the name of the shutdown hook registered in LogManager) is designed precisely so that application programmers would not use the logging API in a shutdown hook. Logging one or two messages in a shutdown hook would not be a problem, but invoking push() for a memory handler that has thousands of log records that must be both localized and formatted could be a problem. As noted in the addShutdownHook(Thread hook) method:
    Shutdown hooks should... finish their work
    quickly. When a program invokes exit the
    expectation is that the virtual machine will
    promptly shut down and exit. When the virtual
    machine is terminated due to user logoff or
    system shutdown the underlying operating
    system may only allow a fixed amount of time
    in which to shut down and exit. It is there-
    fore inadvisable to attempt any user
    interaction or to perform a long-running
    computation in a shutdown hook.
    I think this warning should suffice, however, and that the logging API should be usable in a shutdown hook. At a bare minimum the LogManager class should document the rationale for making the logging API unavailable during shutdown.

  • 1.4 Logging (shutdown hook question really)

    If I have a handler configured and log a record inside a thread running as a shutdown hook, more times than not I get nothing in the log file (or console, or wherever) and have to resort to System.err.println().
    Now, from studying the code for LogManager this turns out to be the result of the inner Cleaner thread (which is the log managers shutdown hook) calling reset() on the manager.
    So, this question morphs itself into how to get my shutdown hook to run before the one that resets the log manager.
    Any ideas or adjsting the priority (order of execution) of shutdown hooks?

    Guys (silkm, trejkaz and the good doctor),
    That's for the input. Appreciate it.
    On shutdown hooks being bad design - interesting. In the case I'm thinking of, the entry point class for a distributed task manager (see http://forum.java.sun.com/thread.jsp?forum=4&thread=335843&tstart=0&trange=30) is "embedded" in consumer code and does indead have a clean shutdown method that we hope the consumer code will invoke before shutting itself down. But in the same was as the logging subsystem can not rely on it's consumer code to "do the right thing", we can't rely on our consumer code to behave itself. In addition, we do want to catch the case where an operator re-starts the consumer system (internal procedure demands unix processes are sent an interrupt rather than a kill). The code invoked by the clean shutdown and the caught shutdown persists (as XML) the state of the task manager which is read on re-start to perform recovery operations. Now, before you all dive in and say "save the state every time it changes" let me say that the state changes very rapidly and the I/O overhead of saving it is considerable. Also, having a background thread that persists state on a regular basis was considered, but it introduces the problem that it becomes different to gaurantee the validity of the persisted state.
    On setting the thread priority - that had occured to me and I shall be using this as one of my test cases to see what happens. As mentioned, the effects this has will vary by platform and VM. However, as the component in question will be running in a controlled environment we should be able to pick a configuration that works.
    On Linux threads and processes - Good point. But do unstarted threads have a process? This is significant to us as the target platforms for the task manager are Solaris and Linux.
    On java.lang.Runtime's implementation of shutdown hooks - I tend to agree that it's a bit simplistic. Maybe we should raise a change request to allow greater control over how hooks are executed.
    Thanks again and please chip in if you have any other ideas.

  • Quitting the Application Before Closing the Window?

    I have a 6 day old iMac running Snow Leopard. I already knew that closing the window on most Apps did not close the program, so instead of closing the window, I would just click on, ie, "Quit Safari" and the Safari window would then close. I don't do that anymore, now I close the Window first, and then quit the App. Could I have caused any harm to the OS by just quitting the App, and letting that close the window?

    It's OK to close the app without closing the window. I never close the windows when quitting an app, I just hit CMD-Q. It does no damage.
    Regards,
    Captfred

  • Could not invoke the service() method when the JSP page is loaded

    I am new to servlets/jsp so excuse if I am doing something silly here:
    I have a JSP page the suppose to be loading a session attrbute from a simple servlet. When I go to load the jsp page, I get Could not invoke the service() method.
    Any help is much appreciated:
    Here is my JSP:
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
         pageEncoding="ISO-8859-1"%>
    <%@ page session="true" import="insurance.PolicyObj,java.util.*"%>
    <% Vector VTable = (Vector) session.getAttribute("policyTable"); %>
    <HTML>
    <BODY>
    <Form name=listTable action="InsSer" method="post">
    <TABLE border="1">
         <TBODY>
              <TR>
                   <TD width="258" align="center"><B>Policy Id</B></TD>
                   <TD width="187" align="center"><B>Customer Name</B></TD>
                   <TD width="160" align="center"><B>Agent Name</B></TD>
                   <TD width="134" align="center"><B>Status</B></TD>
              </TR>
              <TR>
    <%
    for (int index=0; index < VTable.size();index++) {
    PolicyObj TableL = (PolicyObj) VTable.elementAt(index);
    %>
         <TR bgcolor="#99CCFF">
    <TD width="258" align="center"> <%= TableL.getPolicyId()%> </TD>
    <TD width="187" align="center"> <%= TableL.getCustomerName()%> </TD>
    <TD width="187" align="center"> <%= TableL.getAgentName() %> </TD>
    <TD width="187" align="center"> <%= TableL.getPolicyStatus() %></TD>
    </TR>
         <% } %>
         </TBODY>
    </TABLE>
    <P><INPUT type="submit" name="Submit" value="Refresh Active Policies"></P>
    </BODY>
    </HTML>
    Here is my servlet:
    package insurance;
    import java.io.IOException;
    import java.util.Vector;
    import javax.servlet.RequestDispatcher;
    import javax.servlet.Servlet;
    import javax.servlet.ServletContext;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    public class InsSer extends HttpServlet implements Servlet {
         /* (non-Java-doc)
         * @see javax.servlet.http.HttpServlet#HttpServlet()
         public InsSer() {
              super();
         /* (non-Java-doc)
         * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest arg0, HttpServletResponse resp)
         protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
              doPost(req,resp);
              // TODO Auto-generated method stub
         /* (non-Java-doc)
         * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest arg0, HttpServletResponse resp)
         protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
              //PolicyObj[] policyTable = new PolicyObj[3];
              HttpSession session = req.getSession(false);
              //if (session == null) {
                   //resp.sendRedirect("http://localhost:9080/Insurance/error.html");
              //Vector buylist = (Vector) session.getAttribute("PolicyList");
              Vector policyList = null;
              policyList.addElement(new PolicyObj());
              ((PolicyObj) policyList.get(0)).setPolicyId("0009800002");
              ((PolicyObj) policyList.get(0)).setCustomerName("Salim Zeitouni");
              ((PolicyObj) policyList.get(0)).setAgentName("Jack Smith");
              ((PolicyObj) policyList.get(0)).setPolicyStatus("Pending");
              session.setAttribute("policyTable",policyList);
              ServletContext sc = getServletContext();
              RequestDispatcher rd = sc.getRequestDispatcher("InsSev1.jsp");
              rd.forward(req,resp);
    Message was edited by:
    sfz1
    Message was edited by:
    sfz1

    I am new to servlets/jsp so excuse if I am doing something silly here:
    I have a JSP page the suppose to be loading a session attrbute from a simple servlet. When I go to load the jsp page, I get Could not invoke the service() method.
    Any help is much appreciated:
    Here is my JSP:
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
         pageEncoding="ISO-8859-1"%>
    <%@ page session="true" import="insurance.PolicyObj,java.util.*"%>
    <% Vector VTable = (Vector) session.getAttribute("policyTable"); %>
    <HTML>
    <BODY>
    <Form name=listTable action="InsSer" method="post">
    <TABLE border="1">
         <TBODY>
              <TR>
                   <TD width="258" align="center"><B>Policy Id</B></TD>
                   <TD width="187" align="center"><B>Customer Name</B></TD>
                   <TD width="160" align="center"><B>Agent Name</B></TD>
                   <TD width="134" align="center"><B>Status</B></TD>
              </TR>
              <TR>
    <%
    for (int index=0; index < VTable.size();index++) {
    PolicyObj TableL = (PolicyObj) VTable.elementAt(index);
    %>
         <TR bgcolor="#99CCFF">
    <TD width="258" align="center"> <%= TableL.getPolicyId()%> </TD>
    <TD width="187" align="center"> <%= TableL.getCustomerName()%> </TD>
    <TD width="187" align="center"> <%= TableL.getAgentName() %> </TD>
    <TD width="187" align="center"> <%= TableL.getPolicyStatus() %></TD>
    </TR>
         <% } %>
         </TBODY>
    </TABLE>
    <P><INPUT type="submit" name="Submit" value="Refresh Active Policies"></P>
    </BODY>
    </HTML>
    Here is my servlet:
    package insurance;
    import java.io.IOException;
    import java.util.Vector;
    import javax.servlet.RequestDispatcher;
    import javax.servlet.Servlet;
    import javax.servlet.ServletContext;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    public class InsSer extends HttpServlet implements Servlet {
         /* (non-Java-doc)
         * @see javax.servlet.http.HttpServlet#HttpServlet()
         public InsSer() {
              super();
         /* (non-Java-doc)
         * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest arg0, HttpServletResponse resp)
         protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
              doPost(req,resp);
              // TODO Auto-generated method stub
         /* (non-Java-doc)
         * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest arg0, HttpServletResponse resp)
         protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
              //PolicyObj[] policyTable = new PolicyObj[3];
              HttpSession session = req.getSession(false);
              //if (session == null) {
                   //resp.sendRedirect("http://localhost:9080/Insurance/error.html");
              //Vector buylist = (Vector) session.getAttribute("PolicyList");
              Vector policyList = null;
              policyList.addElement(new PolicyObj());
              ((PolicyObj) policyList.get(0)).setPolicyId("0009800002");
              ((PolicyObj) policyList.get(0)).setCustomerName("Salim Zeitouni");
              ((PolicyObj) policyList.get(0)).setAgentName("Jack Smith");
              ((PolicyObj) policyList.get(0)).setPolicyStatus("Pending");
              session.setAttribute("policyTable",policyList);
              ServletContext sc = getServletContext();
              RequestDispatcher rd = sc.getRequestDispatcher("InsSev1.jsp");
              rd.forward(req,resp);
    Message was edited by:
    sfz1
    Message was edited by:
    sfz1

  • Shutdown hook not called when hitting ctrl-c

    Hello
    I was expecting to be able to do clean-up (using a shutdown hook) when my application was terminated by a ctrl-c with the following code. But if the process is busy doing something (and not sleeping as is the case in all examples I've been able to find) the VM will not run it's hooks, so it seems.
    Am I missing something??
    public class ShutdownHook
    public static void main(String[] args)
    Runtime.getRuntime().addShutdownHook( new Thread() { public void run() { System.out.println("shutdown"); }});
    for (int j = 0; j < 10000; j++)
    System.out.println("run");
    // if the sleep is uncommented ctrl-c will work (99% of the time or so)
    // Thread.sleep(100);
    Regards,
    Jesper

    Cross-post. Original thread (with replies) is located at:
    http://forum.java.sun.com/thread.jspa?threadID=691132
    Kaj

  • Open cursors are NOT closed only by closing the ResultSet or Statement

    I've realised that the open cursors are only closed by closing the connection.
    In my example code I have for-loop with a vector of table-names. For every table-name I start a query to retrieve metainformation (row-size, column-names). Although I close the ResultSet (which automatically closes the PreparedStatement/Statement) I reached after the 150th loop a max-cursor-exception (ora-01000) ?!
    It seems that there is only the workaround to close and re-open the connection at the end of the for-loop. Which is performance-side pretty bad :-(.
    Is there really no other solution?
    Besides: does anyone know WHY the statement.close() also closes the ResultSet?? I think this is a bad design (hence to tight dependency between both classes). What if the garbage collector closes the statement (and hence to the JDOC the statement.close()-method also closes the ResultSet)? For example if a method uses a local Statement and returns a ResultSet (and the Statement-garbage is collected), then the ResultSet would cause an exception?!
    Thanks for the help in advance
    Tai

    I've realised that the open cursors are only closed by
    closing the connection.Or by closing the Statement!
    In my example code I have for-loop with a vector of
    table-names. For every table-name I start a query to
    retrieve metainformation (row-size, column-names).
    Although I close the ResultSet (which automatically
    closes the PreparedStatement/Statement) I reached
    after the 150th loop a max-cursor-exception
    (ora-01000) ?!Closing the ResutSet does not automatically close the PreparedStatement/Statement.
    >
    It seems that there is only the workaround to close
    and re-open the connection at the end of the for-loop.
    Which is performance-side pretty bad :-(.
    Is there really no other solution?
    Just explicitly close the PreparedStatement/Statement!
    Besides: does anyone know WHY the statement.close()
    also closes the ResultSet?? You need to think of a resultset as a live connection to the database.
    Consider SELECT * FROM ABIGTABLE, it would be inefficient to populate the Resultset with all of the rows (could even eat up all memory) so the first n rows are returned ( n = Statement.getFetchSize() ) and the next n rows are returned as needed.
    I think this is a bad
    design (hence to tight dependency between both
    classes). What if the garbage collector closes the
    statement (and hence to the JDOC the
    statement.close()-method also closes the ResultSet)?
    For example if a method uses a local Statement and
    returns a ResultSet (and the Statement-garbage is
    collected), then the ResultSet would cause an
    exception?!You should use a statment and resultset, read all your data into a collection or a CachedRowSet (http://www.javaworld.com/javaworld/jw-02-2001/jw-0202-cachedrow.html) then close the statment as soon as possible. Never return a resultset form your data tier: that is tight coupling between the tiers of your application!

  • I just bought a Samsung S22B310B computer monitor and hooked up to my Mac Mini. I have my mac set to the 1920X1080 resolution but the entire screen (21.5") is not filled. It looks like non HD channels do on an HD TV. Used regular hook up not DVI.

    Just bought Samsung S22B310B computer monitor and hooked it up to my mac mini. I have my mac set to the 1920X1080 resolution but the entire screen (21.5") is not filled. How do fill the screen? it fills the screen on other resolution settings. I have it hooked up regularly and not to the DVI hook up. I'm not a computer savvy person please help!

    That monitor supports both (digital) DVI and (analog) VGA connections, so you should not need a converter or use a different adapter.
    You should use the Apple Supplied HDMI to DVI Adapter and a (digital) DVI cable to the monitor.

Maybe you are looking for

  • How can I transfer my old iTunes library to my new one?

    Just bought a mac pro this week and need to get all of the stuff off of my old macbook. the main thing is how do i get all that stuff on here so that when i plug my iphone into this computer it won't completely have to reset?

  • MIR7 User Exit

    Hi, I am trying to find a user Exit in MIR7. I want specifically that user exit which would have data once the invoce/IR created in MIR7 is saved in the tables RSEG/MSEG. i.e. Commit work has been done, Invoice has been posted/parked/saved. I need to

  • Firefox on Mac will not open local files

    On my Mac, since ver 3.6 I've noticed that when FF is not running, when I open/drag-and-drop a local file, FF opens to the homepage (which has been set to Google). When FF is running, the local files (HTML or even TXT) open fine. FF on my PC is fine.

  • Saving Lightroom Mobile synced photos to existing library system?

    This should be really straightforward but I can't figure it out. When I import photos from my DSLR, Lightroom saves them into a library structure (Pictures > 2104 > 08 > 07). This works for me, as it keeps everything together in the one place, easy t

  • Mail set-up on server 10.4.8

    We just had our web server upgraded from 10.1 to 10.4. The drive was reformated, the server software was installed/configured and we loaded the web sites from a back-up. The web sites are working, ftp is working but we can not get the POP mail workin