GetServletContext().getAttribute problems

I try to deploy the "testfile.war" in WebLogic 6.1
          I put it inside the C:\bea\wlserver6.1\config\mydomain\applications
          folder.
          But I got the following errors, after I restart the server
          Seems to be problems with a path or missing packages that I should
          import.
          Anyone got any diea?
          Compilation of
          'C:\bea\wlserver6.1\config\mydomain\applications\testfile\WEB-INF\_tmp_war_myserver_myserver_testfile\jsp_servlet\_main\__testing_page.java'
          failed:
          C:\bea\wlserver6.1\config\mydomain\applications\testfile\WEB-INF\_tmp_war_myserver_myserver_testfile\jsp_servlet\_main\__testing_page.java:126:
          cannot
          resolve symbol probably occurred due to an error in
          /include/application_realpath.jsp line 2: if
          C:\bea\wlserver6.1\config\mydomain\applications\testfile\WEB-INF\_tmp_war_myserver_myserver_testfile\jsp_servlet\_main\__testing_page.java:127:
          cannot resolve
          symbol probably occurred due to an error in
          /include/application_realpath.jsp line 3:
          getServletContext().setAttribute("appRealPath",
          getServletContext().getRealPath("/"));
          C:\bea\wlserver6.1\config\mydomain\applications\testfile\WEB-INF\_tmp_war_myserver_myserver_testfile\jsp_servlet\_main\__testing_page.java:127:
          cannot resolve
          symbol probably occurred due to an error in
          /include/application_realpath.jsp line 3:
          getServletContext().setAttribute("appRealPath",
          getServletContext().getRealPath("/"));
          

Richard,
          Since you are seeing muliptle definitions of sc, you should be able change the code to look like:
          <%
          sc.setAttribute("appRealPath",getServletConfig().getServletContext().getRealPath("/"));
          out.println(Kit.dispLkup(getServletConfig().getServletContext().getAttribute("appRealPath"),null));
          out.println(" The appRealPath is: " + getServletConfig().getServletContext().getRealPath("/"));
          %>
          Thanks,
          Simon
          Developer Relations Engineer
          BEA Support
          Richard wrote:
          > On Tue, 19 Mar 2002 11:23:57 -0700, Simon Nunn
          > <[email protected]> wrote:
          >
          > Simon,
          >
          > I did the following in my code:
          >
          > <%
          >
          > ServletContext sc = getServletConfig().getServletContext();
          > sc.setAttribute("appRealPath",sc.getRealPath("/"));
          > out.println(Kit.dispLkup(sc.getAttribute("appRealPath"),null));
          > out.println(" The appRealPath is: " + sc.getRealPath("/"));
          >
          > %>
          >
          > I have "ServletContext sc" defined in only one file.
          > After I restart the server, the Weblogic server would generate the
          > servlets automatically from my JSP files. The previous errors are now
          > gone, but now there are some new errors. The following errors occur
          > in those generate servlets.
          >
          >
          > C:\bea\wlserver6.1\config\mydomain\applications\.wlnotdelete\WEB-INF\_tmp_war_myserver_myserver_progress\jsp_servlet\_main\__todo_add_form.java:158:
          > sc is already defined in
          > _jspService(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
          > probably occurred due to an error in /include/application_realpath.jsp
          > line 3:
          > ServletContext sc = getServletConfig().getServletContext();
          >
          > C:\bea\wlserver6.1\config\mydomain\applications\.wlnotdelete\WEB-INF\_tmp_war_myserver_myserver_progress\jsp_servlet\_main\__todo_add_form.java:208:
          > sc is already defined in
          > _jspService(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
          > probably occurred due to an error in /include/application_realpath.jsp
          > line 3:
          > ServletContext sc = getServletConfig().getServletContext();
          >
          > Thanks
          >
          > >Richard,
          > >
          > > I believe that your code should look like:
          > > <%
          > >
          > >ServletContext sc = getServletConfig().getServletContext();
          > >sc.setAttribute("appRealPath",sc.getRealPath("/"));
          > >out.println(" The appRealPath is: " + sc.getRealPath("/"));
          > >%>
          > >
          > >I tested this and it works for me under 6.1 sp2.
          > >
          > >Thanks,
          > > Simon
          > > Developer Relations Engineer
          > > BEA Support
          > >
          > >Richard wrote:
          > >
          > >> I try to deploy the "testfile.war" in WebLogic 6.1
          > >> I put it inside the C:\bea\wlserver6.1\config\mydomain\applications
          > >> folder.
          > >>
          > >> But I got the following errors, after I restart the server
          > >> Seems to be problems with a path or missing packages that I should
          > >> import.
          > >> Anyone got any diea?
          > >>
          > >> Compilation of
          > >> 'C:\bea\wlserver6.1\config\mydomain\applications\testfile\WEB-INF\_tmp_war_myserver_myserver_testfile\jsp_servlet\_main\__testing_page.java'
          > >> failed:
          > >>
          > >>
          > >> C:\bea\wlserver6.1\config\mydomain\applications\testfile\WEB-INF\_tmp_war_myserver_myserver_testfile\jsp_servlet\_main\__testing_page.java:126:
          > >> cannot
          > >> resolve symbol probably occurred due to an error in
          > >> /include/application_realpath.jsp line 2: if
          > >>
          > >> C:\bea\wlserver6.1\config\mydomain\applications\testfile\WEB-INF\_tmp_war_myserver_myserver_testfile\jsp_servlet\_main\__testing_page.java:127:
          > >> cannot resolve
          > >> symbol probably occurred due to an error in
          > >> /include/application_realpath.jsp line 3:
          > >> getServletContext().setAttribute("appRealPath",
          > >> getServletContext().getRealPath("/"));
          > >>
          > >> C:\bea\wlserver6.1\config\mydomain\applications\testfile\WEB-INF\_tmp_war_myserver_myserver_testfile\jsp_servlet\_main\__testing_page.java:127:
          > >> cannot resolve
          > >> symbol probably occurred due to an error in
          > >> /include/application_realpath.jsp line 3:
          > >> getServletContext().setAttribute("appRealPath",
          > >> getServletContext().getRealPath("/"));
          

Similar Messages

  • GetServletContext().setAttribute  problems

    I try to deploy the "testfile.war" in WebLogic 6.1
              I put it inside the C:\bea\wlserver6.1\config\mydomain\applications
              folder.
              But I got the following errors, after I restart the server
              Seems to be problems with a path or missing packages that I should
              import.
              Anyone got any diea?
              Compilation of
              'C:\bea\wlserver6.1\config\mydomain\applications\testfile\WEB-INF\_tmp_war_myserver_myserver_testfile\jsp_servlet\_main\__testing_page.java'
              failed:
              C:\bea\wlserver6.1\config\mydomain\applications\testfile\WEB-INF\_tmp_war_myserver_myserver_testfile\jsp_servlet\_main\__testing_page.java:126:
              cannot
              resolve symbol probably occurred due to an error in
              /include/application_realpath.jsp line 2: if
              C:\bea\wlserver6.1\config\mydomain\applications\testfile\WEB-INF\_tmp_war_myserver_myserver_testfile\jsp_servlet\_main\__testing_page.java:127:
              cannot resolve
              symbol probably occurred due to an error in
              /include/application_realpath.jsp line 3:
              getServletContext().setAttribute("appRealPath",
              getServletContext().getRealPath("/"));
              C:\bea\wlserver6.1\config\mydomain\applications\testfile\WEB-INF\_tmp_war_myserver_myserver_testfile\jsp_servlet\_main\__testing_page.java:127:
              cannot resolve
              symbol probably occurred due to an error in
              /include/application_realpath.jsp line 3:
              getServletContext().setAttribute("appRealPath",
              getServletContext().getRealPath("/"));
              

    I try to deploy the "testfile.war" in WebLogic 6.1
    I put it inside the
    C:\bea\wlserver6.1\config\mydomain\applications
    folder.
    But I got the following errors, after I restart the
    server
    Seems to be problems with a path or missing packages
    that I should
    import.
    Anyone got any diea?Yep .. hope u get this because inside a jsp page to get the servlet context you have to first get the page context and from that u have to get the servlet context.,
    C:\bea\wlserver6.1\config\mydomain\applications\testfil
    \WEB-INF\_tmp_war_myserver_myserver_testfile\jsp_servle
    \_main\__testing_page.java:127:
    cannot resolve
    symbol probably occurred due to an error in
    /include/application_realpath.jsp line 3:
    getServletContext().setAttribute("appRealPath",
    getServletContext().getRealPath("/"));
    why do you use getServletContext() method , it is already an implicit variable in the jsp page as "application"
    just use application.setAttribute()
    application.getRealPath()
    regards,
    Arun.N

  • DataBaseMetadata.getAttributes - Problem with Exception

    I am Using Oracle 10g and have an exception when I run this code:
    public void getAttributes(String schema, String type){
         try{
              md=conn.getMetaData();
              rs=md.getAttributes(null,"SYSTEM","TABLE1", null);
              while(rs.next()){
                   System.out.println(rs.getString("ATTR_NAME"));
         }catch(SQLException ex){
              System.out.println(ex.getSQLState());
              System.out.println(ex.getErrorCode());
              System.out.println(ex);
    The Error code which is written by System.out.println(ex), it might be in greek font and doesn't appear in distinguishable font, so I can't understand in what the error refers to.
    The ex.getSQLState() has the value null
    and
    the ex.getErrorCode() has the value 17023
    I try it and the exception is triggered in this line:
    rs=md.getAttributes(null,"SYSTEM","TABLE1", null);
    Can someone help me with what this problem might be?

    If you want to use a JDBC standard technique and don't want to query Oracle's dictionary tables (such as USER_TABLES or ALL_TABLES), then your choices are pretty much DatabaseMetaData and ResultSetMetaData.
    In my limited experience, both of these work fine on Oracle 10g; I don't understand why you're having problems.
    You might try testing against a different schema, something other than SYSTEM. SYSTEM is special, and it wouldn't surprise me if it was different here. Also, SYSTEM should never ever ever be used for anything but Oracle's own database objects; if you have used SYSTEM for your own things, I would encourage you to reinstall your database, or at least to stop immediately. Also, your programs should never connect to the database as the SYSTEM user; only DBAs shuld use this account for the (very rare) upgrade and maintenance tasks that require it; most DBA tasks should be done from a seperate account that has been granted the DBA role.

  • Problem with beans in session scope

    Hello,
    I developped a website using JSP/Tomcat and I can't figure out how to fix this problem.
    I am using beans in session scope to know when a user is actualy logged in or not and to make some basic informations about him avaible to the pages. I then add those beans to an application scope bean that manages the users, letting me know how many are logged in, etc... I store the user beans in a Vector list.
    The problem is that the session beans never seem to be destroyed. I made a logout page which use <jsp:remove/> but all it does is to remove the bean from the scope and not actualy destroying it. I have to notify the application bean that the session is terminated so I manualy remove it from its vector list.
    But when a user just leave the site without using the logout option, it becomes a problem. Is there a way to actualy tell when a session bean is being destroyed ? I tried to check with my application bean if there are null beans in the list but it never happens, the user bean always stays in memory.
    Is there actualy a way for me to notify the application bean when the user quits the website without using the logout link ? Or is the whole design flawed ?
    Thanks in advance.
    Nicolas Jaccard

    I understand I could create a listener even with my current setup Correct, you configure listeners in web.xml and they are applicable to a whole web application irrespective of whether you use jsp or servlets or both. SessionListeners would fire when a session was created or when a session is about to be dropped.
    but I do not know how I could get a reference of the application bean in >question. Any hint ?From your earlier post, I understand that you add a UserBean to a session and then the UserBean to a vector stoed in application scope.
    Something like below,
    UserBean user = new UserBean();
    //set  bean in session scope.
    session.setAttribute("user", user);
    //add bean to a Vector stored in application scope.
    Vector v = (Vector)(getServletContext().getAttribute("userList"));
    v.add(user);If you have done it in the above fashion, you realize, dont you, that its the same object that's added to both the session and to the vector stored in application scope.
    So in your sessionDestroyed() method of your HttpSessionListener implementation,
    void sessionDestroyed(HttpSessionEvent event){
         //get a handle to the session
         HttpSession session = event.getSession();
          //get a handle to the user object
          UserBean user = (UserBean)session.getAttribute("user");
           //get a handle to the application object
          ServletContext ctx = session.getServletContext();
           //get a handle to the Vector storing the user objs in application scope
            Vector v = (Vector)ctx.getAttribute("userList");
           //now remove the object from the Vector passing in the reference to the object retrieved from the Session.
            v.removeElement(user);
    }That's it.
    Another approach would be to remove the User based on a unique identifier. Let's assume each User has a unique id (If your User has no such feature, you could still add one and set the user id to the session id that the user is associated with)
    void sessionDestroyed(HttpSessionEvent event){
         //get a handle to the session
         HttpSession session = event.getSession();
          //get a handle to the user object
          UserBean user = (UserBean)session.getAttribute("user");
           //get the unique id of the user object
           String id = user.getId();
           //get a handle to the application object
          ServletContext ctx = session.getServletContext();
           //get a handle to the Vector storing the user objs in application scope
            Vector v = (Vector)ctx.getAttribute("userList");
           //now iterate all user objects in the Vector
           for(Iterator itr = v.iterator(); itr.hasNext()) {
                   User user = (User)itr.next();               
                    if(user.getId().equals(id)) {
                           //if user's id is same as id of user retrieved from session
                           //remove the object
                           itr.remove();
    }Hope that helps,
    ram.

  • Hi Experts , I am currently facing problems while running restricted version copy .. The log says 0 location products copied and that the process has has timed out. the error message is /SAPAPO/MVM_INT_SVC_CO_VER_LCW reported exception in task DP00014, th

    Hi Experts , I am currently facing problems while running restricted version copy in sap apo .. The log says 0 location products copied and that the process has timed out. the error message is " /SAPAPO/MVM_INT_SVC_CO_VER_LCW reported exception in task DP00014 " , then ending in time limit exceeded. could anyone explain why this happens. please note even if the log says 0 location products copied , in reality they have have been partially copied.
    Regards
    Jerel

    Hi, thank you for your replies, I found out few things about my servlet, and its portability
    and i have few questions, although i marked this topic as answered i guess its ok to post
    I am using javax.servlet.context.tempdir to store my files in that servletcontext temporary directory. But i dont know how to give hyperlink
    of the modified files to the user for them to download the modified files.
    What i am using to get the tempdir i will paste
    File baseurl = (File)this.getServletContext().getAttribute("javax.servlet.context.tempdir");
    System.out.println(baseurl);
    baseurl = new File(baseurl.getAbsolutePath()+File.separator+"temp"+File.separator+"files");
    baseurl.mkdirs();so i am storing my files in that temp/files folder and the servlet processes them and modifies them, then how to present them as
    links to the user for download ?
    and as the servlet is multithreaded by nature, if my servlet gets 2 different requests with same file names, i guess one of them will be overwritten
    And i want to create unique directory for each request made to the servlet , so file names dont clash.
    one another thing is that i want my servlet to be executed by my <form action> only, I dont want the user to simply type url and trigger the servlet
    Reply A.S.A.P. please..
    Thanks and regards,
    Mihir Pandya

  • Problems with file uploading servlet, the form action doesnt capture url

    Hi, i have one problem. I am working on a project , i have created a servlet that takes uploaded files and processses them and links them back to user to download. The servlet works perfectly from my computer, I am using apache-tomcat-6.0.16 and java 1.6 , I have two forms called encrypt.html and decrypt.html, I will post both of them, now the problem is when somebody access it on the internet while i am running apache, they get a connection was reset on a firefox browser and same stuff on Internet Explorer.
    i have checked my server logs and saw nothing unusual there, So please if you can help me, it is my project.
    I am pasting html file and error message that other users where getting remotely.
    <html>
    <head>
    <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
    <title>Stego Form</title>
    <link rel='STYLESHEET' type='text/css' href='encrypt.css'>
    </head>
    <body>
    <center>
    <form name='encrypt' enctype='multipart/form-data' method='POST' action='http://localhost:8080/examples/temp2
    ' accept-charset='UTF-8'>
    <input type='hidden' name='sfm_form_submitted' value='yes'>
    </input>
    <input type='hidden' name='eord' value='e'>
    <select name='encryption' size='1'>
             <option value='Select an encryption' selected>
             Select an encryption
             </option>
             <option value='DES'>
             DES
             </option>
             <option value='Tripple DES'>
             Tripple DES
             </option>
    </select>
             <input type='file' name='overt' size='20'>
             <input type='file' name='covert' size='20'>
             <input type='submit' name='submit' value='Submit'>
    </form>
    </center>
    </body>
    </html>so it works for me even if i access the page with my ip , but for others it doesnt work,
    now the user got this xhtml page that i will show, i cant find attach button so i am pasting here.
    here is the servlet coding
    import java.io.*;
    import java.util.*;
    import javax.servlet.ServletException;
    import javax.servlet.http.*;
    import org.apache.commons.fileupload.*;
    import org.apache.commons.fileupload.disk.DiskFileItemFactory;
    import org.apache.commons.fileupload.servlet.ServletFileUpload;
    public class temp2 extends HttpServlet
        FileInputStream fin;
        String filenames[] = new String[2],fieldname,fieldval;
        String keyfile,IVfile;
        String names[] = new String[2];
        public temp2()
            super();
        @Override
        public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
            doPost(request, response);
        @Override
        public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
            String eord="";
            List lst = null;
            boolean isMultiPart = ServletFileUpload.isMultipartContent(request);
            if (!isMultiPart) // check whether the post request is actually multipart
                System.out.println("ERROR NOT MULTIPART");
                System.exit(0);
            DiskFileItemFactory fif = new DiskFileItemFactory();
            ServletFileUpload sfu = new ServletFileUpload(fif);
            sfu.setSizeMax(10000000);
            try {  lst = sfu.parseRequest(request);  }
            catch (FileUploadException ex)
            { System.out.println("ERROR IN PARSING FILES" + ex); System.exit(0);  }
            if(lst.isEmpty())  // check whether request is empty
                System.out.println("ERROR LIST SIZE NOT GOOD : " + lst.size());
                System.exit(0);
            Iterator x = lst.iterator();
            int i = 0;
            FileItem f = (FileItem)x.next();
            f = (FileItem)x.next();
            System.out.println(f.getFieldName());
            if(f.getFieldName().equalsIgnoreCase("eord")) // check hidden field to know the case : encrypt or decrypt
                eord = f.getString();
                System.out.println(f.getString());
            else // if it is not first field exit
                System.out.println("Invalid FORM");
                System.exit(0);
            f = (FileItem)x.next(); // next field
            if(f.getFieldName().equalsIgnoreCase("encryption")) // type of encryption des / tdes
                fieldname = f.getFieldName();
                fieldval = f.getString();
                System.out.println(f.getString());
            if(eord.equalsIgnoreCase("e")) // if it is encryption form only file required
                while(x.hasNext())
                    f = (FileItem)x.next();
                    if(!f.isFormField())
                        int check = f.getName().lastIndexOf(File.separator);
                        System.out.println(File.separator);
                        if(check==-1)
                            System.out.println(f.getName());
                            System.out.println("Unsupported browser : " + check);
                            System.exit(0);
                        File ff = new File("e:\\apache\\webapps\\temp\\"+f.getName().substring(check));
                        names[i] = ff.getName(); // original file names
                        try
                            f.write(ff);
                            filenames[i] = ff.getAbsolutePath();
                        // renamed    
                            ff.deleteOnExit();
                        }catch(Exception e) {System.out.println("Error writing file"+ ff.getAbsolutePath()); System.exit(0);}
                        i++;
                    try { System.in.read(); } catch(Exception e) {}
                }// endwhile
                if(fieldval.equalsIgnoreCase("DES"))
                    System.out.println("DES 1"+filenames[1]);
                    javades o = new javades(filenames[1]); // the file to be encrypted   
                    filenames[1] = "e:\\apache\\webapps\\temp\\files\\" + names[1];
                    System.out.println("should be original" + filenames[1]);
                else if(fieldval.equalsIgnoreCase("Tripple DES"))
                    javatdes o = new javatdes(filenames[1]);
                    filenames[1] = "e:\\apache\\webapps\\temp\\files\\" + names[1];
                    System.out.println(filenames[1]);
                System.out.println("Calling stego");
                filenames[0] = "e:\\apache\\webapps\\temp\\" + names[0];
                System.out.println("file 1 "+ filenames[0]);
                System.out.println("file 2"+ filenames[1]);
                try { System.in.read(); } catch(Exception e) {}
                stego s = new stego(filenames[0],filenames[1]);
                System.out.println("mainext " + s.mainext);
                // encryption done, and new files are loaded, now lets hide
                if(s.mainext.equalsIgnoreCase("wav"))
                    s.encodewav();
                    System.out.println("Encoded wave");
                else if(s.mainext.equalsIgnoreCase("bmp"))
                    System.out.println("Encoded bmp");
                    s.encodebmp();
                System.out.println("done !");
                PrintWriter pr = response.getWriter();
                pr.println("Greetings , Your work is done and saved, now download the following files");
                pr.println("The secret key file is needed for getting back your hidden file, so download that too");
                pr.write("<a href=\"/temp/files/IV.txt\">click here</a>");
                pr.write("<br/><a href=\"/temp/files/key.txt\">click here</a>");
                pr.write("<br/><a href=\"/temp/files/"+names[0]+"\">click here</a>");
                return;
            // if it is decryption case
            else if(eord.equalsIgnoreCase("d"))
                while(x.hasNext())
                    f = (FileItem)x.next();
                    if(!f.isFormField())
                        int check = f.getName().lastIndexOf(File.separator);
                        System.out.println(File.separator);
                        if(check==-1)
                            System.out.println(f.getName());
                            System.out.println("Unsupported browser : " + check);
                            System.exit(0);
                        File ff = new File("e:\\apache\\webapps\\temp\\"+f.getName().substring(check));
    // else if ladder to store paths of stegofile keyfile and IVfile                   
                        if(f.getFieldName().equalsIgnoreCase("stegofile"))
                            filenames[0] = ff.getAbsolutePath();
                        else if(f.getFieldName().equalsIgnoreCase("keyfile"))
                            keyfile = ff.getAbsolutePath();
                        else if(f.getFieldName().equalsIgnoreCase("IVfile"))
                            IVfile = ff.getAbsolutePath();
                        try
                            f.write(ff); // writes whole file at once
                        }catch(Exception e) {System.out.println("Error writing file"); System.exit(0);}
                }// endwhile
                System.out.println("Calling stego");
                System.out.println("file 1 "+ filenames[0]);
                stego s = new stego(filenames[0]);
                System.out.println("mainext " + s.mainext);
                if(s.mainext.equalsIgnoreCase("wav"))
                    s.decodewav();
                    System.out.println("Encoded wave");
                else if(s.mainext.equalsIgnoreCase("bmp"))
                    s.decodebmp();
                    System.out.println("Encoded bmp");
                System.out.println("done !");
                ////// hidden file has been retrieved , now lets decrypt it
                System.out.println("ext " + s.ext);
                filenames[0] = "e:\\apache\\webapps\\temp\\"+s.filename;
                System.out.println(filenames[0]);
                System.out.println(keyfile);
                System.out.println(IVfile);
                if(fieldval.equalsIgnoreCase("DES"))
                    javades o = new javades(filenames[0],keyfile,IVfile); // the file to be encrypted   
                    filenames[0] = "e:\\apache\\webapps\\temp\\" + ( new File(filenames[0]).getName());
                    System.out.println("should be original" + filenames[0]);
                else if(fieldval.equalsIgnoreCase("Tripple DES"))
                    javatdes o = new javatdes(filenames[0],keyfile,IVfile);
                    filenames[0] = "e:\\apache\\webapps\\temp\\" + ( new File(filenames[0]).getName());
                    System.out.println(filenames[0]);
                PrintWriter pr = response.getWriter();
                pr.write("Greetings, you have successfully retrieved your hidden file, now download it from here <br>");
                pr.write("<a href=\"http://localhost:8080/temp/files/" + (new File(filenames[0]).getName())+"\">Click here</a>");
    }and here is the xhtml file the user receives, whe he clicks the submit button,
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html [
      <!ENTITY % htmlDTD
        PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "DTD/xhtml1-strict.dtd">
      %htmlDTD;
      <!ENTITY % netErrorDTD
        SYSTEM "chrome://global/locale/netError.dtd">
      %netErrorDTD;
    <!ENTITY loadError.label "Problem loading page">
    <!ENTITY retry.label "Try Again">
    <!-- Specific error messages -->
    <!ENTITY connectionFailure.title "Unable to connect">
    <!ENTITY connectionFailure.longDesc "&sharedLongDesc;">
    <!ENTITY deniedPortAccess.title "This address is restricted">
    <!ENTITY deniedPortAccess.longDesc "">
    <!ENTITY dnsNotFound.title "Server not found">
    <!ENTITY dnsNotFound.longDesc "
    <ul>
      <li>Check the address for typing errors such as
        <strong>ww</strong>.example.com instead of
        <strong>www</strong>.example.com</li>
      <li>If you are unable to load any pages, check your computer's network
        connection.</li>
      <li>If your computer or network is protected by a firewall or proxy, make sure
        that &brandShortName; is permitted to access the Web.</li>
    </ul>
    ">
    <!ENTITY fileNotFound.title "File not found">
    <!ENTITY fileNotFound.longDesc "
    <ul>
      <li>Check the file name for capitalization or other typing errors.</li>
      <li>Check to see if the file was moved, renamed or deleted.</li>
    </ul>
    ">
    <!ENTITY generic.title "Oops.">
    <!ENTITY generic.longDesc "
    <p>&brandShortName; can't load this page for some reason.</p>
    ">
    <!ENTITY malformedURI.title "The address isn't valid">
    <!ENTITY malformedURI.longDesc "
    <ul>
      <li>Web addresses are usually written like
        <strong>http://www.example.com/</strong></li>
      <li>Make sure that you're using forward slashes (i.e.
        <strong>/</strong>).</li>
    </ul>
    ">
    <!ENTITY netInterrupt.title "The connection was interrupted">
    <!ENTITY netInterrupt.longDesc "&sharedLongDesc;">
    <!ENTITY netOffline.title "Offline mode">
    <!ENTITY netOffline.longDesc "
    <ul>
      <li>Uncheck "Work Offline" in the File menu, then try again.</li>
    </ul>
    ">
    <!ENTITY netReset.title "The connection was reset">
    <!ENTITY netReset.longDesc "&sharedLongDesc;">
    <!ENTITY netTimeout.title "The connection has timed out">
    <!ENTITY netTimeout.longDesc "&sharedLongDesc;">
    <!ENTITY protocolNotFound.title "The address wasn't understood">
    <!ENTITY protocolNotFound.longDesc "
    <ul>
      <li>You might need to install other software to open this address.</li>
    </ul>
    ">
    <!ENTITY proxyConnectFailure.title "The proxy server is refusing connections">
    <!ENTITY proxyConnectFailure.longDesc "
    <ul>
      <li>Check the proxy settings to make sure that they are correct.</li>
      <li>Contact your network administrator to make sure the proxy server is
        working.</li>
    </ul>
    ">
    <!ENTITY proxyResolveFailure.title "Unable to find the proxy server">
    <!ENTITY proxyResolveFailure.longDesc "
    <ul>
      <li>Check the proxy settings to make sure that they are correct.</li>
      <li>Check to make sure your computer has a working network connection.</li>
      <li>If your computer or network is protected by a firewall or proxy, make sure
        that &brandShortName; is permitted to access the Web.</li>
    </ul>
    ">
    <!ENTITY redirectLoop.title "The page isn't redirecting properly">
    <!ENTITY redirectLoop.longDesc "
    <ul>
      <li>This problem can sometimes be caused by disabling or refusing to accept
        cookies.</li>
    </ul>
    ">
    <!ENTITY unknownSocketType.title "Unexpected response from server">
    <!ENTITY unknownSocketType.longDesc "
    <ul>
      <li>Check to make sure your system has the Personal Security Manager
        installed.</li>
      <li>This might be due to a non-standard configuration on the server.</li>
    </ul>
    ">
    <!ENTITY sharedLongDesc "
    <ul>
      <li>The site could be temporarily unavailable or too busy. Try again in a few
        moments.</li>
      <li>If you are unable to load any pages, check your computer's network
        connection.</li>
      <li>If your computer or network is protected by a firewall or proxy, make sure
        that &brandShortName; is permitted to access the Web.</li>
    </ul>
    ">
      <!ENTITY % globalDTD
        SYSTEM "chrome://global/locale/global.dtd">
      %globalDTD;
    ]>
    <!-- ***** BEGIN LICENSE BLOCK *****
       - Version: MPL 1.1/GPL 2.0/LGPL 2.1
       - The contents of this file are subject to the Mozilla Public License Version
       - 1.1 (the "License"); you may not use this file except in compliance with
       - the License. You may obtain a copy of the License at
       - http://www.mozilla.org/MPL/
       - Software distributed under the License is distributed on an "AS IS" basis,
       - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
       - for the specific language governing rights and limitations under the
       - License.
       - The Original Code is mozilla.org code.
       - The Initial Developer of the Original Code is
       - Netscape Communications Corporation.
       - Portions created by the Initial Developer are Copyright (C) 1998
       - the Initial Developer. All Rights Reserved.
       - Contributor(s):
       -   Adam Lock <[email protected]>
       -   William R. Price <[email protected]>
       -   Henrik Skupin <[email protected]>
       -   Jeff Walden <[email protected]>
       - Alternatively, the contents of this file may be used under the terms of
       - either the GNU General Public License Version 2 or later (the "GPL"), or
       - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
       - in which case the provisions of the GPL or the LGPL are applicable instead
       - of those above. If you wish to allow use of your version of this file only
       - under the terms of either the GPL or the LGPL, and not to allow others to
       - use your version of this file under the terms of the MPL, indicate your
       - decision by deleting the provisions above and replace them with the notice
       - and other provisions required by the LGPL or the GPL. If you do not delete
       - the provisions above, a recipient may use your version of this file under
       - the terms of any one of the MPL, the GPL or the LGPL.
       - ***** END LICENSE BLOCK ***** -->
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <title>Problem loading page</title>
        <link rel="stylesheet" href="temp2_files/netError.css" type="text/css" media="all"/>
        <!-- XXX this needs to be themeable -->
        <link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAICSURBVHjaYvz//z8DJQAggJhwiDPvnmlzc2aR0O+JGezt+AwACCCsBhxfYhn59N41FWtXIxZOLu70niRGXVwGAAQQNgNYHj96O8HaWYdJW5ubwd4/mI2Ng7sblwEAAYRhwMm1URk/vn4SUNWVYGD8+YZBXZOZm5OLzRjoCmNsBgAEEKoBN82Y7l851GLrqMjM8Oc7A8O/3wwMP54wuAQFCXNycUzGZgBAAKEYcOaKZO2/f//5FbUVgBrfMoRVcgHpNwyKGjKMXDwCan0prFboBgAEELIBzDcvXyy2cVZhYPj9GWj7H4jo/38MDJ9OMDj7O/KzsjH3oxsAEEBwA/bNNipiZf7FI6cqwcDw8x2qqp8fGORUpVn4BEXlgGHhhCwFEEAwA9gfP3hdZ+Oizcjw+wvCdjgAuuLrFQbXIH9hTm7uqcgyAAEENuD4ctcebm5mbikFYRTbV7V/Q6j88Z5BSuY7q4CQgAjQFR4wYYAAAhtw89L5ZFsnRaDtn4CW/YXrAQcisit+PGVwDgrnZ2NnnwATBQggpsNLvGYLCAmxi8tLARWg+h3FBVBXSEj/ZZWQkRcCuiIQJAQQQCyvnj5KMDTkZ2JgYmRg4FchnHv+vmEwttLmeXT3VjKQtx4ggFgk5TXebV63UfT3ijOMxOZAVlZWdiB1EMQGCCBGSrMzQIABAFR3kRM3KggZAAAAAElFTkSuQmCC"/>
        <script type="application/x-javascript"><![CDATA[
          // Error url MUST be formatted like this:
          //   moz-neterror:page?e=error&u=url&d=desc
          // Note that this file uses document.documentURI to get
          // the URL (with the format from above). This is because
          // document.location.href gets the current URI off the docshell,
          // which is the URL displayed in the location bar, i.e.
          // the URI that the user attempted to load.
          function getErrorCode()
            var url = document.documentURI;
            var error = url.search(/e\=/);
            var duffUrl = url.search(/\&u\=/);
            return decodeURIComponent(url.slice(error + 2, duffUrl));
          function getDescription()
            var url = document.documentURI;
            var desc = url.search(/d\=/);
            // desc == -1 if not found; if so, return an empty string
            // instead of what would turn out to be portions of the URI
            if (desc == -1) return "";
            return decodeURIComponent(url.slice(desc + 2));
          function retryThis()
            // Session history has the URL of the page that failed
            // to load, not the one of the error page. So, just call
            // reload(), which will also repost POST data correctly.
            try {
              location.reload();
            } catch (e) {
              // We probably tried to reload a URI that caused an exception to
              // occur;  e.g. a non-existent file.
          function initPage()
            var err = getErrorCode();
            // if it's an unknown error or there's no title or description
            // defined, get the generic message
            var errTitle = document.getElementById("et_" + err);
            var errDesc  = document.getElementById("ed_" + err);
            if (!errTitle || !errDesc)
              errTitle = document.getElementById("et_generic");
              errDesc  = document.getElementById("ed_generic");
            var title = document.getElementById("errorTitleText");
            if (title)
              title.parentNode.replaceChild(errTitle, title);
              // change id to the replaced child's id so styling works
              errTitle.id = "errorTitleText";
            var sd = document.getElementById("errorShortDescText");
            if (sd)
              sd.textContent = getDescription();
            var ld = document.getElementById("errorLongDesc");
            if (ld)
              ld.parentNode.replaceChild(errDesc, ld);
              // change id to the replaced child's id so styling works
              errDesc.id = "errorLongDesc";
            // remove undisplayed errors to avoid bug 39098
            var errContainer = document.getElementById("errorContainer");
            errContainer.parentNode.removeChild(errContainer);
        ]]></script>
      </head>
      <body dir="ltr">
        <!-- ERROR ITEM CONTAINER (removed during loading to avoid bug 39098) -->
        <!-- PAGE CONTAINER (for styling purposes only) -->
        <div id="errorPageContainer">
          <!-- Error Title -->
          <div id="errorTitle">
            <h1 id="errorTitleText">The connection was reset</h1>
          </div>
          <!-- LONG CONTENT (the section most likely to require scrolling) -->
          <div id="errorLongContent">
            <!-- Short Description -->
            <div id="errorShortDesc">
              <p id="errorShortDescText">The connection to the server was reset while the page was loading.</p>
            </div>
            <!-- Long Description (Note: See netError.dtd for used XHTML tags) -->
            <div id="errorLongDesc">
    <ul>
      <li>The site could be temporarily unavailable or too busy. Try again in a few
        moments.</li>
      <li>If you are unable to load any pages, check your computer's network
        connection.</li>
      <li>If your computer or network is protected by a firewall or proxy, make sure
        that Firefox is permitted to access the Web.</li>
    </ul>
    </div>
          </div>
          <!-- Retry Button -->
          <xul:button xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="errorTryAgain" label="Try Again" oncommand="retryThis();"/>
        </div>
        <!--
        - Note: It is important to run the script this way, instead of using
        - an onload handler. This is because error pages are loaded as
        - LOAD_BACKGROUND, which means that onload handlers will not be executed.
        -->
        <script type="application/x-javascript">initPage();</script>
      </body>
    </html>thank you for your prompt reply in advance,
    Regards,
    Mihir Pandya

    Hi, thank you for your replies, I found out few things about my servlet, and its portability
    and i have few questions, although i marked this topic as answered i guess its ok to post
    I am using javax.servlet.context.tempdir to store my files in that servletcontext temporary directory. But i dont know how to give hyperlink
    of the modified files to the user for them to download the modified files.
    What i am using to get the tempdir i will paste
    File baseurl = (File)this.getServletContext().getAttribute("javax.servlet.context.tempdir");
    System.out.println(baseurl);
    baseurl = new File(baseurl.getAbsolutePath()+File.separator+"temp"+File.separator+"files");
    baseurl.mkdirs();so i am storing my files in that temp/files folder and the servlet processes them and modifies them, then how to present them as
    links to the user for download ?
    and as the servlet is multithreaded by nature, if my servlet gets 2 different requests with same file names, i guess one of them will be overwritten
    And i want to create unique directory for each request made to the servlet , so file names dont clash.
    one another thing is that i want my servlet to be executed by my <form action> only, I dont want the user to simply type url and trigger the servlet
    Reply A.S.A.P. please..
    Thanks and regards,
    Mihir Pandya

  • Web gallery problems in flash catalyst. Please help me!

    I've made a web gallery in adobe bridge cs5 that I saved to my harddrive as a swf-file. But when I make a blank page in Flash Catalyst and insert that swf-file nothing happens when I try to view it in "run project". What have I missed. It feels like some file is missing or something. I've tried to import the swf-file in a html document in dreamweaver but it is the same problem there. Can someone help me please?
    Thanks
    Max

    I really appreciate your reply.
    but i am still a little bit confused.
    Why bookstore1 needs syncronized database conection?
    i found the following scriptlet in bookstore servlet of bookstore1 application.
    bookDB =(BookDBAO)getServletContext().getAttribute("bookDB");
    Does it mean bookDB created here is the same object created in servlet context, that is, they use the same block of memory?
    i found the counterpart in bookstore2
    <jsp:setProperty name="bookDB" property="database" value="${bookDBAO}" />
    Does it mean the bookDB bean duplicates another instance of bookDBAO created in servlet context for its database property ,that is,they don't use the same block of memory?

  • Problem with forward using RequestDispatcher

    Dear All
    Below is my code, which trying to use the RequestDispatcher.forward to go from a Servlet to a .jsp page.
    and use
    getServletContext().setAttribute("SvBio",vBio);
    to set an attribute
    It compiles finely but stuck at the forward request to the jsp page and through an exception which is given below.
    BUT on removing this statement
    getServletContext().setAttribute("SvBio",vBio);
    from my doget method , it works and forwrds to the next page
    please help me identifying the problem
    Thanks
    NAV
    ////Part of CODE////////////////
    Vector vBio;
    public void init()
    // vector vBio initialize in init()
    public void doGet(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException
    getServletContext().setAttribute("SvBio",vBio);
    if(param1 == bio)
    gotoPage("/jsp_pages/bio_gp.jsp", request, response);
    private void gotoPage(String address, HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(address);
    if(dispatcher !=null)
    dispatcher.forward(request, response);
    ///exception//////////////////
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
         at nav.gotoPage(nav.java:363)
         at nav.doGet(nav.java:319)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:193)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:666)
         at java.lang.Thread.run(Thread.java:595)
    root cause
    java.lang.NullPointerException
         at org.apache.jsp.bio_gp_jsp._jspService(bio_gp_jsp.java:59)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
         at nav.gotoPage(nav.java:363)
         at nav.doGet(nav.java:319)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:193)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:666)
         at java.lang.Thread.run(Thread.java:595)
    Apache Tomcat/4.1.29-LE-jdk14

    Thanks evnafets
    I find out null pointer assignment in jsp page where forward request was heading.
    There is one more question, if you help me a better understanding the issue
    I have a HTML page invokes the servlet by passing value of parameter, Servlet do some procesing and forward to JSP page depending on the incoming parameter,
    Can JSP page invoke the same servlet by passing some other parameter?
    I tried doing this, but it returns an empty page and didnt went back to servlet.
    HTML Page ---->Servlet--------> JSP page ---------> Servlet
    I think Forward method shift the control from the Servlet to JSP page and now its the responsibility of the jsp page to deliver the response to the client.
    Am i getting the empty page on invoking the servlet from the JSP page because I have not deliver the response to the client?
    ///the code of the JSP page is as fallows///
    <html>
    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>NAVTITLE</title>
    </head>
    <body link="#0000FF" vlink="#0000FF" alink="#0000FF">
    <td height="340" width="977">
    <p align="center"><font size="8" color="#001000"><b>biomolecular group           page</b></font></p>
    <%@page import="java.util.Vector"%>          
    <% Vector vBiopt = (Vector)getServletContext().getAttribute("SvBio");     
    out.println("\nThe size of vBio is ::"+vBiopt.size());
    int n = vBiopt.size();
    %>
    <p>This is the dynamic page generated for the biomolecular group</p>
    <%
    for(int k=0;k<n;k++)
    String href1 ="http://localhost:8080/nav/nav2?param2=";
    String item = (String)vBiopt.elementAt(k);
    out.println("<p><a href= \"" + href1 + k + "\">" + item + "</a></p>");
    %>
    </body>
    </html>

  • Application scope problem in a JSP

    Hi,
    I try to store an object with the following code :
    getServletContext().setAttribute("application", app);
    Later I want to access this object from a JSP with :
    <jsp:useBean id="application" scope="application" class="de.skillworks.SWApp"/>
    that dosn't work !? I can not debug my application because the jsp is initializing my app object new. When I try in my JSP :
    SWApp app = (SWApp)pageContext.getServletContext().getAttribute("application");
    it works fine. I get my object which I have store in my servlet.
    In a Tomcat environment my code is working just the Jdeveloper has a problem with it.
    null

    Andy -
    The web-to-go server has difficulty dealing with sessions. Testing in Tomcat is a good alternative, and this is resolved in Oracle9i JDeveloper.
    Hope this helps,
    Lynn

  • FileOutputStream path problem

    Dear All,
    I have a problem with writing information in a file on server side. I use Tomcat 4.0 and what i execute code
    String fname = "" + FileName;
    System.out.println(" Writing attachment to file: " + fname);
    try
    ByteArrayDataSource bds = new ByteArrayDataSource(
    ds.getInputStream(), dh.getContentType());
    bds.writeTo(new FileOutputStream(fname));
    it write file to C:\Documents and Settings\Maxim\Start Menu\Programs\Apache Tomcat 4.0
    How can i change this location to d:\ for example?
    Thank you advance,
    Maxim.

    Hello.
    You should change the file name this way
    File file = new File("d:/my_file");
    But it is not good solution for a web application. You have to use the temp directory
    File tempDir = (File) httpServlet.getServletContext().getAttribute("javax.servlet.context.tempdir");
    File file = new File(tempDir.getAbsolutePath() + File.separator + "my_file_name");
    Good luck.

  • Problem with set/get attributes

    Hello,
    i'm trying to assign and object i've got to the ServletContext by :
    getServletContext().setAttribute("theairwaybill",theairwaybill);
    and i''ve checked and it's there.
    now, trying to get the object back in my jsp page by:
    theairwaybill = (Shipments.Awb)getServletContext().getAttribute("theairwaybill");
    and i know i've got the object by comparing both my local object's address and the one from the ServletContext() but the values of the variables are null and zeros from unknown reason...?
    what can be reason?
    10x ahead,
    netanel

    try to get the context object from config object then try
    sorry i dont have time to help out out... busy schedule bye

  • Problems in Bookstore2 exmaple. Please help me!!!!!

    Please help me.!!!!!!!!! The issue stated below is very important to me.
    JSP pages that need to access database use <jsp:usebean> action to create an instance of BookDB bean.
    All the beans used by these JSP pages referrence to the only BookDBAO instance created by the servlet context listener.
    But BookDBAO class fails to provide mechanisms to syncronize database operations.
    If there are two theards: one exicuting in "getbookdetai( )l" and the other in "getbook( )", there is high possibility that �con� may not work properly due to possible false value provided to "prepstmt"
    For example, SQL statement in "getbookdetail" is set to "select * " + "from books " while that in "getbook( )" is set to "select * " + "from books where id = ? "
    Thanks in advance!!!! Please help!!!!

    I really appreciate your reply.
    but i am still a little bit confused.
    Why bookstore1 needs syncronized database conection?
    i found the following scriptlet in bookstore servlet of bookstore1 application.
    bookDB =(BookDBAO)getServletContext().getAttribute("bookDB");
    Does it mean bookDB created here is the same object created in servlet context, that is, they use the same block of memory?
    i found the counterpart in bookstore2
    <jsp:setProperty name="bookDB" property="database" value="${bookDBAO}" />
    Does it mean the bookDB bean duplicates another instance of bookDBAO created in servlet context for its database property ,that is,they don't use the same block of memory?

  • Compilation problem -- classes in same package

    I feel like I should know the answer to this, but since I can't figure it out, I'll ask it anyway. I have the following three classes, all in the same package. The Dog class compiles just fine. As for the other two, the compiler insists it "cannot find symbol" when it comes to Dog. Can anyone help?
    package com.example;
    public class Dog {
        private String breed;
        public Dog(String breed) {
             this.breed = breed;
        public String getBreed() {
             return breed;
    package com.example;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class ListenerTester extends HttpServlet {
        public void doGet (HttpServletRequest request, HttpServletResponse response)
                       throws IOException, ServletException {
             response.setContentType("text/html");
             PrintWriter out = response.getWriter();
             out.println("test context attributes set by listener<br>");
             out.println("<br>");
             Dog dog = (Dog) getServletContext().getAttribute("dog");
             out.println("Dog's breed is: " + dog.getBreed());
    package com.example;
    import javax.servlet.*;
    public class MyServletContextListener implements ServletContextListener {
        public void contextInitialized(ServletContextEvent event) {
              ServletContext sc = event.getServletContext();
              String dogBreed = sc.getInitParameter("breed");
              Dog d = new Dog(dogBreed);
              sc.setAttribute("dog", d);
        public void contextDestroyed(ServletContextEvent event) {
    }

    Ok, your .java files and .class files are in the correct location.
    What you should have done is:
    1.) Go to C:\tomcat\web-apps\listenerTest\WEB-INF\classes
    2.) compile your program using "javac -cp c:\tomcat\lib\servlet-api.jar;. com/example/*.java" (note the "." on the classpath, which tells java to include the current directory on its classpath).
    It would also be a good idea to have a sparate tree for the sources and the classes.
    And to develop your application independently from the deployment target.
    But those are semi-advanced topics that you could ignore for now.
    Edit: and again: there's nothing wrong with having classpath trouble when starting Java. But it means that you still have to learn some basics, before you should attempt any J2EE development. Seriously, don't do that yet.

  • Problem In ServletContextListner

    hello all,
    i am using eclipse 3.2 , tomcat 5.0.28
    I made three classes ... in this folder ( given below )
    C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\ServletDataBaseConnection\src\servlet
    corresponding .class file are in this folder ( given below )
    C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\ServletDataBaseConnection\build\classes\servlet
    (1) ServletContextListenerTest.java
    package servlet;
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class ServletContextListenerTest extends HttpServlet {
         private static final long serialVersionUID = -8306793681912311446L;
         public void doGet(HttpServletRequest request , HttpServletResponse response) throws ServletException , IOException{
              response.setContentType("text/html");
              PrintWriter pw = response.getWriter();
              pw.println("Context Listener Test<br>");
             Dog obj = (Dog)getServletContext().getAttribute("dog");
             pw.println("Dog's name is : " + obj.getDogName());
         public void doPost(HttpServletRequest request , HttpServletResponse response) throws ServletException , IOException{
    }(2) Dog.java
    package servlet;
    public class Dog {
         private String dogName;
         public Dog(){
              dogName = null;
         public Dog(String dogName){
              dogName = this.dogName;
         public String getDogName() {
              return dogName;
         public void setDogName(String dogName) {
              this.dogName = dogName;
    }(3) MyServletContextListener.java
    package servlet;
    import javax.servlet.ServletContext;
    import javax.servlet.ServletContextEvent;
    import javax.servlet.ServletContextListener;
    public class MyServletContextListener implements ServletContextListener{
         public void contextInitialized(ServletContextEvent event){
              ServletContext context = event.getServletContext();
              String dogname = context.getInitParameter("dog");
              Dog dogobj = new Dog(dogname);
              context.setAttribute("dog" , dogobj);
        public void contextDestroyed(ServletContextEvent event){
    }and web.xml is :
    <!--    ServletContextListenerTest.java    -->
        <servlet>
            <servlet-name>ServletContextListenerTest</servlet-name>
            <servlet-class>servlet.ServletContextListenerTest</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>ServletContextListenerTest</servlet-name>
            <url-pattern>/servlet/ServletContextListenerTest.do</url-pattern>
        </servlet-mapping>
    <!-- JSPC servlet mappings end -->
            <context-param>
              <param-name>dog</param-name>
              <param-value>GermanShefured</param-value>
            </context-param>  
            <listener>
                <listener-class>servlet.MyServletContextListener</listener-class>
            </listenermy out put is like this when i browse
    http://localhost:8080/ServletDataBaseConnection/servlet/ServletContextListenerTest.do
    Context Listener Test
    Dog's name is : null
    but expected out put should be
    Context Listener Test
    Dog's name is : GermanShefured

    Debug the lines at contextInitialized(). Is it actually invoked? Does it actually retrieve the param value? Is the param value actually correct?

  • Session Time Out For UNLOGGED IN USER During Search -pls help SIR!

    Hi,
    The problem lies in searchresultscontroller.java/searchcontroller.java file under search/web/handler of an application that supports educational note sharing.
    The problem is that -
    When I search with query strings in different fields(as you will find in the above mentioned java files)..the keywords in resourcedto and get some files as search results.
    Then I click on one of the file from within the search result and visit the file.
    Here if I m logged in as an user, and the session time out is set to 1 minute in the web.xml file of the web folder not the admin folder then when I hit the BACK TO SEARCH button it easily goes back to the previous search result page along with the queries string that I had input previously.
    The problem is that when I m NOT LOGGED in as an user, and I've performed a search with queries and other dropdowns in the search panel, I get the search result page, I visit the file by clicking on one of them but when I hit the BACK TO SEARCH button I don't see the previous search result page from where I had navigated to view the file.
    Please suggest on what changes shall I make in the code so that even if I m not logged in as an user, I get back to the search result page on hitting the BACK TO SEARCH button from the file view page.Sir I m herein pasting the code of the searchresultscontroller.java file, but please feel free to ask for anyother file whose code you might want to see.SEARCHRESULTSCONTROLLER.JAVA FILE CONTENT-
    package com.mgh.sps.search.web.handler;
    import java.util.Map;
    import java.util.regex.Pattern;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.log4j.Logger;
    import org.springframework.validation.BindException;
    import org.springframework.validation.Errors;
    import org.springframework.web.servlet.ModelAndView;
    import org.springframework.web.servlet.mvc.SimpleFormController;
    import com.mgh.sps.search.business.facade.Search;
    import com.mgh.sps.common.dto.ResourceDTO;
    import com.mgh.sps.common.util.SessionAttributeKey;
    import com.mgh.sps.common.util.SessionManager;
    import com.mgh.sps.fileusage.web.constants.FileUsageWebConstants;
    public class SearchResultsController extends SimpleFormController {
    * SearchResults Controller
    * @author Muralikrishna.s
    * @Codedondate DD-MM-YY=26-07-07
    * @Usecase/s associated =UC504
    private static final Logger logger = Logger
    .getLogger(SearchResultsController.class.getName());
    private final static String REG_EXP = "^[A-Za-z0-9]*$";
    private final static Pattern EMAIL_PATTERN_REG = Pattern.compile(REG_EXP);
    * Spring framework method used to hold reference data
    * @param request
    * HttpServletRequest
    * @param command
    * Object
    * @param arg2
    * Errors
    * @return Map
    * @throws Exception
    @Override
    protected Map referenceData(HttpServletRequest request, Object command,
    Errors errors) throws Exception {
    logger.debug("SearchResultsController.referenceData() method entered:"
    + request + "," + command + "," + errors);
    SessionManager.setSessionAttribute(SessionAttributeKey.tabIndex,
    FileUsageWebConstants.TAB_SEARCH, request);
    Search search = (Search) super.getWebApplicationContext().getBean(
    "searchfacade");
    ResourceDTO resourceDto = (ResourceDTO) command;
    String[] allValues = new String[7];
    if (null != (String[]) SessionManager.getSessionAttribute(
    SessionAttributeKey.allValues, request)) {
    allValues = (String[]) SessionManager.getSessionAttribute(
    SessionAttributeKey.allValues, request);
    resourceDto.setKeywords(allValues[0]);
    resourceDto.setCountry(allValues[1]);
    resourceDto.setUniversityName(allValues[2]);
    resourceDto.setSubjectArea(allValues[3]);
    resourceDto.setQualification(allValues[4]);
    resourceDto.setYearLevel(allValues[5]);
    resourceDto.setSpecificType(allValues[6]);
    logger.debug("%%%%%%%%%%%%%%%%%qualification%%%%%%%%%%%%%%%"
    + resourceDto.getQualification());
    String flag = (String) request.getParameter("id");
    resourceDto.setFlag(flag);
    logger.debug("SearchResultsController.referenceData() method exited:");
    return search.retrieveReferenceData(resourceDto);
    * Spring framework method used to hold OnSubmit
    * @param request
    * HttpServletRequest
    * @param response
    * HttpServletResponse
    * @param command
    * Object
    * @param arg3
    * BindException
    * @return ModelAndView
    * @throws Exception
    @Override
    protected ModelAndView onSubmit(HttpServletRequest request,
    HttpServletResponse response, Object command, BindException errors)
    throws Exception {
    SessionManager.cleanup(request);
    logger.debug("SearchResultsController.onSubmit() method entered:"
    + request + "," + command + "," + response + "," + errors);
    Search search = (Search) super.getWebApplicationContext().getBean(
    "searchfacade");
    Map dynamic = (Map) getServletContext().getAttribute("config");
    ResourceDTO resourceDto = (ResourceDTO) command;
    SessionManager.removeSessionAttribute(SessionAttributeKey.allValues,
    request);
    //changed by sreelatha on sep21
    //resourceDto.setKeywords(request.getParameter("keywords"));
    //String key = request.getParameter("keywords");
    //logger.debug("&&&&&&&&&&&&& key &&&&&&&&&&&&" + key);
    String keywords = (request.getParameter("keywords"));
    if(null!=keywords) {
    keywords = keywords.trim();
    resourceDto.setKeywords(keywords);
    // changes end
    resourceDto.setUniversityName(request.getParameter("universityName"));
    resourceDto.setSubjectArea(request.getParameter("subjectArea"));
    resourceDto.setCountry(request.getParameter("country"));
    resourceDto.setQualification(request.getParameter("qualification"));
    resourceDto.setYearLevel(request.getParameter("yearLevel"));
    resourceDto.setSpecificType(request.getParameter("specificType"));
    String[] allValues = new String[7];
    //changed by sreelatha on sep21
    //allValues[0] = request.getParameter("keywords");
    allValues[0] = resourceDto.getKeywords();
    //changes end
    allValues[1] = request.getParameter("country");
    allValues[2] = request.getParameter("universityName");
    allValues[3] = request.getParameter("subjectArea");
    allValues[4] = request.getParameter("qualification");
    allValues[5] = request.getParameter("yearLevel");
    allValues[6] = request.getParameter("specificType");
    SessionManager.setSessionAttribute(SessionAttributeKey.allValues,
    allValues, request);
    if(null!=keywords) {
    keywords = keywords.trim();
    String words="";
    for(int i=0;i<keywords.length();i++) {
    String key=String.valueOf(keywords.charAt(i));
    if(key.contains("*")) {
    key = key.replace("*"," ");
    } else if(key.contains("?")) {
    key = key.replace("?"," ");
    } else if(key.contains("[")) {
    key = key.replace("["," ");
    } else if(key.contains("{")) {
    key = key.replace("{"," ");
    } else if(key.contains("(")) {
    key = key.replace("("," ");
    } else if(key.contains(")")) {
    key = key.replace(")"," ");
    } else if(key.contains("+")) {
    key = key.replace("+"," ");
    } else if(key.contains("
    key = key.replace("
    } else if(key.contains(" ")) {
    key = key.replace(" "," ");
    } else if(key.contains("_")) {
    key = key.replace("","");
    } else if(!EMAIL_PATTERN_REG.matcher(key).matches()) {
    key = key.replaceAll(key," ");
    words = words + key;
    keywords = words;
    resourceDto.setKeywords(keywords);
    SessionManager.setSessionAttribute(SessionAttributeKey.test, search.setInputValues(resourceDto, dynamic), request);
    String name = (String) SessionManager.getSessionAttribute(SessionAttributeKey.tempName, request);
    String flag1 = request.getParameter("id");
    String status="";
    if (flag1 !=null && flag1.equals("loggedInUser"))
    if(name==null)
    return new ModelAndView();
    if (flag1 !=null && flag1.equals("loggedInUser")){
    status = "redirect:SearchResults.htm?id=loggedInUser";
    }else if(flag1 !=null && flag1.equals("nonLoggedInUser"))
    status = "redirect:SearchResultsnlu.htm?id=nonLoggedInUser";
    super.setSuccessView(status);
    ModelAndView mav = new ModelAndView(super.getSuccessView());
    logger.debug("SearchResultsController.onSubmit() method exited:");
    return mav;
    }

    Cross-posted in many forums. Don't answer this one.

Maybe you are looking for

  • HT5225 That means my website is going to be erased from the web?

    I spent a lot of money and time to create a website and now u going to erase my website like that? I can't believe Apple is doing this? 

  • Anyone know the address of Apple's update server?

    We're trying to set up our clients to first point to our own xserve then, should it for some reason be unavailable, to check apple's. We're not quite sure how to do this but it should look something this right?: http://<our server address>:http://<ap

  • CS4 or 5 InDesign and Win 7

    I installed my registered CS4 ID on my 64-bit Dell Vostro running Windows 7. ID opens and brings up my files but won't let me highlight type and change the style or size nor can I change the color using swatches. A techie at work suggested I download

  • Updated to firefox 3.6.13 and it closes immediately after opening it

    after upgrading from 3.5.16 to 3.6.13 when I open it immediately closes running windows 7

  • Directory Configuration

    Hi All,    After Directory configuration is done, if we make any changes to SLD Business System (like delete and recreate with same name), how it will affect the configuration. Thanks, Sree