New File() in servlet under Tomcat

When I try this:
File file = new File( "testdirectory" );
System.out.println( file.getAbsolutePath() );
I get the following:
<TOMCAT_HOME>/bin/testdirectory
But I need to access the directory in the classes directory of my web app.
What am I doing wrong???
Thanks for the help...

According to the tomcat doc, a resource is first searched in the web-inf/classes directory, which is where my testdirectory is located. So when I do:
new File( "testdirectory" );
I get the file in <TOMCAT_HOME>/bin/testdirectory instead. It seems like tomcat looks in the wrong directory. I really should access the file in web-inf/classes?

Similar Messages

  • How to run servlets under Tomcat 6 in java1.5

    hi all
    i am unable to run servlets under tomcat 6,i checked environment variables ....all are correct..im getting http 503 error....

    A 503 response says
    503 Service Unavailable
    The server is currently unable to handle the request due to a
    temporary overloading or maintenance of the server
    You apparently have the server mis-configured. Recheck the configuration (or reinstall Tomcat per its instructions.)

  • Problem in executing servlets under tomcat 4.1

    Dear Group,
    I am using Tomcat 4.1 and have the following directory structure:
    1.     C:\Tomcat 4.1\webapps\testapp
    ----It is my root directory and I have my html file called
    sample.html
    2.     C:\Tomcat 4.1\webapps\testapp\WEB-INF------web.xml is here
    3.     C:\Tomcat 4.1\webapps\testapp\classes\TestServlet.class
    -------here I have the servlet, no package---only one servlet
    My[b] web.xml has entry for:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
        <servlet>
            <servlet-name>TestServlet</servlet-name>
            <servlet-class>TestServlet</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>TestServlet</servlet-name>
            <url-pattern>/TestServlet</url-pattern>
        </servlet-mapping>
    </web-app>My[b] sample.html contains:
    <HTML>
    <BODY>
    <form method="post" action="http://localhost:8080/testapp/TestServlet">
    <input type=submit value="showServlet">
    <h2>
    <font color="green">First try on Serlvet</font>
    </h2>
    </form>
    </BODY>
    </HTML>Here is what I have done:
    1.     Started the Tomcat server
    2.     In the IE browser, I typed http://localhost:8080/testapp/sample.html
    -------- - the file shown correctly and I clicked the showServlet button.
    3.     I got the follow error �HTTP Status 404 - /testapp/TestServlet" the
    requested resource not availble
    4.     when I clicked the showServelt button the control goes to another page
    (as it should go to execute the servlet) .
    The URL is �http://localhost:8080/testapp/TestServlet�
    Please enlighten me where I went wrong?

    Hello all,
    Thank you for answering the question now the servlet gets executed.
    I here posts the steps i carried out to execute the
    servlet. If anyone have different idea pls post. Im
    pasting here the steps also attaching one.
    Steps to create your directory and work in Tomcat 4.1
    1.     Create your directory in Tomcat�s webapps Directory.
    -----If your tomcat is in d:\ the your directory may look
    ----- D:\tomcat\webapps\<your directory>
         ------E.g. �d:\tomcat\webapps\test�
    2.     In the test directory you can your html files directly or you can create a
    directory to hold html files.
         --------E.g. �d:\tomcat\webapps\test\first.html (OR)
    -------E.g. �d:\tomcat\webapps\test\html-files\first.html�
    3.     Create a folder called WEB-INF inside test
    -------E.g. �d:\tomcat\webapps\test\WEB-INF
    ------ Under the WEB-INF folder put your web.xml file
    4.     Create another folder named classes under the same test
    ----- E.g. �d:\tomcat\webapps\test\classes
    ----- Here you need to place your servlet classes
    ----- E.g. �d:\tomcat\webapps\test\classes\testServlet.class
    5.     Start any browser that are java enabled
    6.     Type �http://<machine name (or) IP add.>:8080/<your folder
    name>/<html file>�
    ----     E.g. http://localhost:8080/test/ html-files/first.html
    -----E.g.http://127.0.0.1:8080/test/html-files/first.html
    7.     Click the component (button, label�) to enable servlet
    8.     That�s all! Now you should get your servlet executed.
    Files:
    1.     web.xml
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems,
    Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
      <servlet>
        <servlet-name>testServlet</servlet-name>
        <servlet-class>testServlet</servlet-class>
      </servlet>
      <servlet-mapping>
        <servlet-name>testServlet</servlet-name>
        <url-pattern>/testServlet/*</url-pattern>
      </servlet-mapping>
    </web-app>
    2. first.html
    <html>
    <body>
    <form method="POST"
    action="http://localhost:8080/test/testServlet">
    <input type=submit value=click></input>
    </form>
    </body>
    </html>
    3. testServlet.java
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class testServlet extends HttpServlet
         public void doPost(HttpServletRequest req,
    HttpServletResponse res)throws      ServletException,
    IOException
              PrintWriter out = res.getWriter();
              out.println("<html>");
              out.println("<body>");
              out.println("<h1>Hello! </h1>");
              out.println("</body>"+"</html>");
    }I have put my first.html inside the folder
    �d:\tomcat\webapps\test\html-files\� and testServlet
    is under �d:\tomcat\webapps\test\WEB-INF\classes\� folder.

  • No ocijdbc8 in java.library.path (with Servlet under Tomcat)

    Hello,
    my problem is the following: I must use the OCI-Driver of the
    Oracle-Client 8.1.7 because I use special PL/SQL-functions.
    I get the error message:
    java.lang.UnsatisfiedLinkError: no ocijdbc8 in java.library.path
    when I try to start my servlet within netscape. Before this I'm
    starting the tomcat servlet engine and make the following
    path known to tomcat:
    java.library.path=/usr/lib:/lib:/share/ams/oracle/ora817-SunOS-5.7/lib:/share/ams/oracle/ora817-SunOS-5.7/jdbc/lib:/share/ams/oracle/ora817-SunOS-5.7/lib64
    In this line are the necessary paths to find the libocijdbc8.so
    library.
    Why does the servlet still have problems to find the driver?
    In addition, I set my java.library.path within the servlet itself.
    Do you know where is the crux of the matter?
    Thank you,
    Christian Schmidbauer

    I'm not sure if this will help, but check to make sure your LD_LIBRARY_PATH environment variable is set (before starting Tomcat). I think this tells the Oracle classes where to find the .so files.

  • JSP file sharing violation under Tomcat... ($$)

    please help on this following topic ...(DD) :
    http://forum.java.sun.com/thread.jsp?forum=45&thread=302846
    Any help is welcome.
    Thanks

    It's simple,
    With some jsp files (not all but always the same ones), this is what happens :
    1/ I modify the file and save it
    2/ I run it, it works
    3/ I modify again , but I can't save my modifications, my editor saying that the file is opened by another application (I use several editors and I have the same message). The only solution I found is to restart the server !!!!!

  • 404 File not Found error trying servlet under https

    Hi,
    This is the first time that I've had to work with SSL. I have a servlet that worked fine under regular http. I had to implement SSL and run my site over https. When I try to access my servlet under HTTPS, I get the 404 File not found error. Is there something that I need to setup for servlets to run under SSL in apache or server.xml? or Do I need to modify my JSP and Servlet code?
    I call my servlet from my JSP on the action method of the form like such:
    * JSP call to servlet
    <form action="https://www.benefitserver.com:8081/FDFServlet" method="post">
    * Servlet code
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.net.ssl.*;
    import java.io.*;
    import java.util.*;
    import com.yoursummit.benefitserver.*;
    import com.adobe.fdf.*;
    import com.adobe.fdf.exceptions.*;
    public class FDFServlet extends HttpServlet
    private static final String CONTENT_TYPE = "text/html";
    private String fileout = "";
    //Initialize global variables
    public void init() throws ServletException
    System.setProperty("java.protocol.handler.pkgs","sun.net.ssl.internal.www.protocol");
    java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
    //Process the HTTP Get request
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    doPost( request, response);
    //Process the HTTP Post request
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    String planID = request.getParameter("planID");
    String empID = request.getParameter("empID");
    HttpSession session = request.getSession();
              try {
                   FDFDoc outputFDF = null;
                   /* Create a new FDF. */
                   outputFDF = new FDFDoc();
    // Set the form fields with values from the database
    if ( planID.equalsIgnoreCase("31") )
    formDeltaPopulation formDP = new formDeltaPopulation();
    fileout = formDP.populateDeltaForm( outputFDF, planID, empID, request );
    if (planID.equalsIgnoreCase("29") )
    formUnicarePopulation formUC = new formUnicarePopulation();
    fileout = formUC.populateUnicareForm( outputFDF, planID, empID, request );
    if (planID.equalsIgnoreCase("30") || planID.equalsIgnoreCase("32") || planID.equalsIgnoreCase("33") || planID.equalsIgnoreCase("34") || planID.equalsIgnoreCase("35"))
    formSunLifePopulation formSL = new formSunLifePopulation();
    fileout = formSL.populateSunLifeForm( outputFDF, planID, empID, request );
    response.sendRedirect(com.yoursummit.utils.urlRewrite.getServletURL(request,"emp_main.jsp?empID=" + empID));
    } catch(FDFException fdfe) {
    /* We handle an error by emitting an html header */
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("Caught FDF exception");
    out.println(fdfe.toString());
    fdfe.printStackTrace(out);
    IOException e = new IOException ( fdfe.getMessage() );
    throw e;
    catch(IOException ioe) {
         /* We handle an error by emitting an html header */
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("Caught FDF exception");
    out.println(ioe.toString());
    ioe.printStackTrace(out);
    throw ioe;
    catch(Exception e) {
    /* We handle an error by emitting an html header */
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("Caught tomcatDB exception");
    out.println(e.toString());
    e.printStackTrace(out);
    IOException ioe = new IOException ( e.getMessage() );
    throw ioe;
    //Clean up resources
    public void destroy()
    }

    I have been told that there is problem with my configuration of Tomcat. I have followed the documentation found at
    http://jakarta.apache.org/tomcat/tomcat-4.1-doc/ssl-howto.html
    and it doesn't work. I have been working on this for a week now and can't seem to get it to work. Can someone please take a look at it and tell me what I am doing wrong? THANKS!
    I get "HTTP 404 - File not Found" with the URL https://www.benefitserver.com/FDFServlet
    I get "Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request" with the URL https://www.benefitserver.com/servlet/FDFServlet
    I've looked at the log files for Apache and I don't see any errors listed. No errors logged in the Tomcat log file either.
    * httpd.conf
    ## Include line for mod_jk.so (Jakarta-Tomcat installation)
    #Include /usr/home/summimps/usr/local/jakarta/jakarta-tomcat-3.2.3/conf/mod_jk.conf-auto
    LoadModule jk_module libexec/mod_jk.so
    AddModule mod_jk.c
    JkWorkersFile /usr/home/summimps/usr/tomcat4.1.24/conf/worker.properties
    JkLogFile /usr/home/summimps/var/log/mod_jk.log
    JkLogLevel info
    #JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
    #JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
    #JkRequestLogFormat "%w %V %T"
    JkMount /*.jsp benefitserver
    JkMount /solarc/*.jsp benefitserver
    JkMount /servlet/* ajp13
    JkMount /solarc/servlet/* ajp13
    # Should mod_jk send SSL information to Tomcat (default is On)
    #JkExtractSSL On
    # What is the indicator for SSL (default is HTTPS)
    JkHTTPSIndicator HTTPS
    # What is the indicator for SSL session (default is SSL_SESSION_ID)
    JkSESSIONIndicator SSL_SESSION_ID
    # What is the indicator for client SSL cipher suit (default is SSL_CIPHER)
    JkCIPHERIndicator SSL_CIPHER
    # What is the indicator for the client SSL certificated (default is SSL_CLIENT_CERT)
    JkCERTSIndicator SSL_CLIENT_CERT
    <Directory />
    AllowOverride None
    </Directory>
    <Directory "/usr/tomcat4.1.24/webapps/ROOT">
      Options Indexes
      <IfDefine SSL>
        SSLRequireSSL
        SSLOptions +StdEnvVars +ExportCertData +StrictRequire
        SSLVerifyClient require
        SSLVerifyDepth 1
      </IfDefine>
    </Directory>
    <VirtualHost benefitserver.com www.benefitserver.com>
    SSLRequireSSL
    ServerName benefitserver.com
    ServerAdmin [email protected]
    DocumentRoot /usr/local/etc/httpd/htdocs/benefitserver
    TransferLog /usr/local/etc/httpd/logs/bsAccess_log
    ErrorLog /usr/local/etc/httpd/logs/bsError_log
    </VirtualHost>
    * server.xml
    <?xml version='1.0' encoding='utf-8'?>
    <Server className="org.apache.catalina.core.StandardServer" debug="0" port="8006" shutdown="SHUTDOWN">
      <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" debug="0" jsr77Names="false"/>
      <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" debug="0"/>
      <GlobalNamingResources>
      </GlobalNamingResources>
      <Service className="org.apache.catalina.core.StandardService" debug="0" name="Tomcat-Standalone">
        <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
    redirectPort="8443" bufferSize="2048" port="8081" connectionTimeout="20000" scheme="https" enableLookups="true" secure="true" protocolHandlerClassName="org.apache.coyote.http11.Http11Protocol" debug="0" disableUploadTimeout="true" maxKeepAliveRequests="100" proxyPort="0" tcpNoDelay="true" minProcessors="5" maxProcessors="75" acceptCount="100" useURIValidationHack="false" connectionLinger="-1" compression="off">
          <Factory className="org.apache.catalina.net.SSLServerSocketFactory" keystoreFile="//.keystore" keystoreType="JKS" algorithm="SunX509" clientAuth="false" protocol="TLS"/>
        </Connector>
        <Engine className="org.apache.catalina.core.StandardEngine" mapperClass="org.apache.catalina.core.StandardEngineMapper" debug="0" defaultHost="localhost" name="Standalone">
          <Host className="org.apache.catalina.core.StandardHost" appBase="webapps" liveDeploy="true" mapperClass="org.apache.catalina.core.StandardHostMapper" autoDeploy="true" configClass="org.apache.catalina.startup.ContextConfig" errorReportValveClass="org.apache.catalina.valves.ErrorReportValve" debug="9" deployXML="true" contextClass="org.apache.catalina.core.StandardContext" unpackWARs="true" name="localhost">
            <Context className="org.apache.catalina.core.StandardContext" crossContext="false" reloadable="false" mapperClass="org.apache.catalina.core.StandardContextMapper" useNaming="true" debug="0" swallowOutput="false" privileged="false" displayName="Welcome to Tomcat" wrapperClass="org.apache.catalina.core.StandardWrapper" docBase="/usr/tomcat4.1.24/webapps/ROOT" cookies="true" path="" cachingAllowed="true" charsetMapperClass="org.apache.catalina.util.CharsetMapper">
              <Environment name="uploadUrl" override="true" type="java.lang.String" description="URL to display uploaded file in Benefit Server" value="http://www.benefitserver.com:8081/bsup"/>
              <Environment name="exportPath" override="true" type="java.lang.String" description="Export Path for Benefit Server Export Utility" value="/usr/tomcat4.1.24/webapps/ROOT/bsex"/>
              <Environment name="uploadPath" override="true" type="java.lang.String" description="Upload Path for Benefit Server" value="/usr/tomcat4.1.24/webapps/ROOT/bsup/"/>
              <Environment name="tempPath" override="true" type="java.lang.String" description="Temporary Directory for File Upload in Benefit Server - Developm" value="/usr/home/summimps/tmp/benefitserver"/>
              <Resource name="BS_Data" type="javax.sql.DataSource" scope="Shareable"/>
              <ResourceParams name="BS_Mail">
                <parameter>
                  <name>mail.smtp.host</name>
                  <value>localhost</value>
                </parameter>
              </ResourceParams>
              <ResourceParams name="BS_Data">
                <parameter>
                  <name>url</name>
                  <value>jdbc:mysql://localhost/BS_Data</value>
                </parameter>
                <parameter>
                  <name>password</name>
                  <value>kdsusa1350</value>
                </parameter>
                <parameter>
                  <name>maxActive</name>
                  <value>50</value>
                </parameter>
                <parameter>
                  <name>maxWait</name>
                  <value>5000</value>
                </parameter>
                <parameter>
                  <name>driverClassName</name>
                  <value>com.mysql.jdbc.Driver</value>
                </parameter>
                <parameter>
                  <name>username</name>
                  <value>summimps</value>
                </parameter>
                <parameter>
                  <name>maxIdle</name>
                  <value>5</value>
                </parameter>
              </ResourceParams>
            </Context>
            <Logger className="org.apache.catalina.logger.FileLogger" debug="0" verbosity="1" prefix="localhost_log." directory="logs" timestamp="true" suffix=".txt"/>
          </Host>
          <Logger className="org.apache.catalina.logger.FileLogger" debug="0" verbosity="1" prefix="catalina_log." directory="logs" timestamp="true" suffix=".txt"/>
          <Realm className="org.apache.catalina.realm.UserDatabaseRealm" debug="0" resourceName="UserDatabase" validate="true"/>
        </Engine>
      </Service>
    </Server>
    * web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
           <servlet>
                 <servlet-name>FDFServlet</servlet-name>
                 <servlet-class>FDFServlet</servlet-class>
           </servlet>
           <servlet-mapping>
                <servlet-name>FDFServlet</servlet-name>
                <url-pattern>/FDFServlet</url-pattern>
           </servlet-mapping>
    </web-app>

  • How to create a new virtual host under tomcat 4.1.x?

    hi all
    i need some help creating a new virtual host under tomcat 4.1.18!
    that's what i do:
    i'm using the web configuration, reacheable by typing "http://localhost:8080" and then clickign administration
    i create a new host
    name: www.class-site.it
    application base: webapps\class-site
    then i create the context:
    document base: webapps\class-site
    path: /
    and nothing works!!!
    anyone could help me?
    if needed i can also post the server.xml file
    thanx in advance for your help
    sandro

    It should look like this
    <Host name="myvhost.com" debug="0" appbase="/my/path/to/webapps" unpackWars="true">
    <Context path ="" docBase="ROOT" debug="0"/>
    </Host>
    This should be inside the <Engine> tags. You should be able to access a page by going to
    http://myvhost.com:8080/index.jsp
    Obviously you need index.jsp in /my/path/to/webapps/ROOT/index.jsp
    Hope that helps

  • Trying to make oracle-xsql-servlet to work under tomcat

    I am trying setup Setup "oracle-xsql-servlet" to work under tomcat.
    #1. I have installed the xdk from orcale at "C:\xdk_nt_10_1_0_2_0_production"
    #2. I have installed "Apache Tomcat Version 6.0.14"
    #3.
    I have made the following changes to "catalina.bat"
    REM Added for Oracle XSQL Servlet
    REM -----------------------------
    set CLASSPATH=%CLASSPATH%;C:\xdk_nt_10_1_0_2_0_production\lib\xsu12.jar
    set CLASSPATH=%CLASSPATH%;C:\xdk_nt_10_1_0_2_0_production\lib\oraclexsql.jar
    set CLASSPATH=%CLASSPATH%;C:\xdk_nt_10_1_0_2_0_production\lib\xmlparserv2.jar
    set CLASSPATH=%CLASSPATH%;C:\xdk_nt_10_1_0_2_0_production\lib\classes111.zip
    set CLASSPATH=%CLASSPATH%;C:\xdk_nt_10_1_0_2_0_production\xdk\admin
    echo %CLASSPATH%
    #4 created a new folder under "C:\apache-tomcat-6.0.14\apache-tomcat-6.0.14\webapps" xdk
    and created a web.xml in it. Following are the entries is the web.xml:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
         <description>
    XDK Examples.
    </description>
         <display-name>XDK Examples</display-name>
         <servlet>
              <servlet-name>oracle-xsql-servlet</servlet-name>
              <servlet-class>oracle.xml.xsql.XSQLServlet</servlet-class>
              <load-on-startup>1</load-on-startup>
         </servlet>
         <servlet-mapping>
              <servlet-name>oracle-xsql-servlet</servlet-name>
              <url-pattern> *.xsql </url-pattern>
         </servlet-mapping>
    </web-app>
    PROBLEM. When I start up tomcat, I keep getting the following errors.
    SEVERE: Error deploying web application directory xdk
    java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
         at java.lang.ClassLoader.defineClass1(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
         at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)     
    OTHER APPLICATIONS such as Examples (provided by apache) work fine.
    Any ideas ?

    XSQL may be used with Tomcat 3.1 and 3.2.
    Refer to section Jakarta Tomcat 3.1 or 3.2
    http://www.oracle.com/technology/tech/xml/xdk/doc/production10g/doc/java/xsql/xsql_userguide.html#ID3386

  • War file under tomcat/webapps (newbie)

    Quick question:
    I have a file myPrj.war and I place it under tomcat/webapps. I realize that tomcat creates a folder myPrj and I can run my application on the browser (so far so good). my question is this: say I made a revision to my application (therefore I have a new myPrj.war file) and I place the newly myPrj.jar on under the tomcat/webapps. Does tomcat 'know' that he should disregard the 'old' folder myPrj and create a new one (since there's a new myPrj.war)???
    thanks

    Generally speaking, If you replaced your java code or tag lib in jsp, you need to restart tomcat, otherwise, if you just made some changes to the basic html, you don't have to do so.

  • I tried to rename a file, it gave me an error message (can't remember the number - 43??) and then the file disappeared from the original folder. When I do a search, the file comes up under the new name, but it does not show a path, and even though preview

    I tried to rename a file, it gave me an error message (can't remember the number - 43??) and then the file disappeared from the original folder. When I do a search, the file comes up under the new name, but it does not show a path, and even though preview shows the contents, I can't open the document (Powerpoint) and I can't move the document. I tried "Copy" and paste but it doesn't work. I tried "Share" with Airdrop and iChat, but the file is inaccessible. When i try to rename the file, it says the filename is too long.
    When I try to open it, it says the alias is not good, and asks if I want to fix the alias. I'm afraid to do that and lose all access to this document.
    Right now, it feels like a ghost document - it is on the computer intact, but it is in an undisclosed location and inaccessible.
    Please help!!

    I was able to resolve this by repairing permissions, even though no permissions error was listed specifically for that file.
    I could also have recovered it through Time Machine, but I'm interested in knowing how not to have this happen again!
    I was afraid of rebooting and possibly losing track even of the ghost.
    I did not try EasyFind - I'll keep that in mind next time.
    Thanks for all the comments.

  • Applet-Servlet - Creating a new file on client's mashine

    Hi all!
    I need to write a program, that will get a data from client through Applet text fields and save it to a new(or rewrite existing) file on client mashine. To save it, I want to use Servlet, because Applet can't do this because of security restrictions. So I think of sending data from Applet to Servlet, which will save it in a new file (will download this file back to the client's mashine).
    I found the following code in forums to download a file from server to client:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class OutputFileOnBrowser extends HttpServlet {
    public void service(HttpServletRequest req,HttpServletResponse res)
    throws ServletException, IOException
    res.setContentType("application/x-filler");
    res.setHeader("Content-Disposition", "attachment; filename=out.fif;");
    ServletOutputStream stream = res.getOutputStream();
    BufferedInputStream fif = new BufferedInputStream(new FileInputStream("in.fif"));
    int data;
    while((data = fif.read()) != -1)
    stream.write(data);
    fif.close();
    stream.close();
    but I don't understand, does it automatically downloads the file out.fif to client's disc and in what path? I tried it, and it did nothing. Anyway, this code doesn't fit exactly my purpose, because I have first to create the file.
    Could anybody help me please?
    Thank you in advanse!
    P.S. I've already wrote the Applet code, what I need now is o n l y the help with a Servlet part!
    Best regards.

    Thanks, but I want not client but servlet save the file automatically in a given path on client's mashine. Is there any way to do that?
    Thanks.

  • Saving PDF under new file name

    Hi,
    I'm using adobe to complete forms and wish to save the form under a new file name every time I complete one.  Is is possible on the iPad?
    Thanks

    We do not yet have the ability to rename or make copies of documents, but that is a very good feature request!

  • How to deploy my war file to be ROOT under tomcat

    Hello all
    i successfully deployed my web application to be as ROOT under tomcat
    but in my web application the jsp files are inside inner directory called jsps
    so if i like to brows to test.jsp i have to type
    http://localhost:8080/jsps/test.jsp
    how can i avoid this and configure tomcat to take the jsps dir as part of the ROOT url
    so i could type
    http://localhost:8080/test.jsp
    and tomcat will autumnally will know this file is inside jsps dir
    thanks

    Hello all
    i successfully deployed my web application to be as
    ROOT under tomcat He says he has successfully deployed the application as ROOT
    but in my web application the jsp files are inside
    inner directory called jsps
    so if i like to brows to test.jsp i have to type
    http://localhost:8080/jsps/test.jsp
    he says that he can access the jsps/test.jsp as part of the root web app.
    how can i avoid this and configure tomcat to take the
    jsps dir as part of the ROOT url
    so i could type
    http://localhost:8080/test.jsp
    He then says that he wants to access jsps/test.jsp as /test.jsp which is a mapping issue.
    The problem is the subject line does not match the problem in the message body.

  • Cannot save the Untitled.indd under a new file name.

    hi,
       i am using window.i got this message while save a document,Cannot save the Untitled.indd under a new file name.
    my code is,
    IDocument *docFrom = Utils<ILayoutUIUtils>()->GetFrontDocument();
    UIDRef docRef = GetUIDRef(docFrom);
    InterfacePtr<IDocumentUtils> docUtils((IDocumentUtils*)GetExecutionContextSession()->QueryInterface(IID_IDOCUMENTUTILS ));
    InterfacePtr<IDocFileHandler> handler(docUtils->QueryDocFileHandler(docRef));
    IDFile destFile;
    PMString path("E:/desktop/auquery.indd");
    FileUtils::PMStringToIDFile(path,destFile);
    handler->SaveAs(docRef,&destFile,kFullUI);
    ErrorCode result = ErrorUtils::PMGetGlobalErrorCode();
    pls help,
    thanks,
    screen410099

    Hi JADarnell,
                 desktop is a folder which i created in e: drive.And I found problem so pls give me a solution.
       Problem is i save a file without any changes its save but if i made any change in a document it doesn't save and one more information
      the  saveas method working in ActionComponent.cpp file in a project only.
    thanks,
    screen410099

  • New Mysterious File popped up under Music Store

    Hello. I opened up my iTunes today and there is a new file, in blue called "Mcarty's Music". I cannot open it; it requiest a password. However, the problem is, I do not know anyone named "Mcarty" nor did I try to import his/her music. This just popped up out of nowwhere. The icon looks exactly like the Music Store icon but it is blue. Could this be a virus?
    I cannot delete it.
    Thanks for the help!

    You're seeing the shared iTunes library from some other computer on your local network. Go into the iTunes Sharing preference and turn off "look for shared music". If you don't want to similarly be sharing your iTunes library with other computers, make sure that the "Share My Music" option is unchecked.

Maybe you are looking for