Is it possible to create a file in servlet context? pls help me

Is it possible to create a file in servlet context? pls help me

Surely it is possible.File file = new File(path, name);

Similar Messages

  • Is it possible to create a file object from a resource?

    Hi all
    Is it possible to create a File from a resource call rather than from a path
    e.g.
    File myFile= new File("C:/j2sdk/sampledir/mypage.htm");is how im doing it now
    how can i call it from a resource something like
    File myFile= new File(this.getClass.getResource("mypage.htm"));

    you may be right
    im trying to load a file into a string then display that string
    my resource thingy isnt working anyway :s
    [code[
    URI pTURI=null;
    URI pBURI=null;
    try
    pTURI= new URI(this.getClass().getResource("/resources/prev_header.htm").toString());
    pBURI= new URI(this.getClass().getResource("/resources/prev_fullpac.htm").toString());
    catch(URISyntaxException e)
    warnUser("URI Error");
    File previewTop = new File(pTURI);
    File previewBtm = new File(pBURI);
    im getting this error
    java.lang.NullPointerException
    at cssCreator.cssCreator.setPreview(cssCreator.java:1263)
    at cssCreator.cssCreator.<init>(cssCreator.java:48)
    at cssCreator.cssCreator.main(cssCreator.java:1681)

  • Is it possible to create .ncd file without using MAX?

    Is it possible to create .ncd file without using MAX? I am trying to read the data given by hundreds of possible Arb. IDs on one of the CAN port without having to create it from the MAX.
    Thank you

    Hi,
    the NI-CAN driver software does not provide functions/VIs to generate
    *.ncd files. However the *.ncd file format is just plain XML (ASCII text). Take a
    look at the example.ncd file that gets installed with NI-CAN
    (<ProgramFiles>\National Instruments\NI-CAN\):
    <?xml version="1.0" encoding="UTF-8"?>
    <nican_config version="0.1">
    <saved>8/8/2005,17:58</saved>
    <message name="TransmissionFluids">
      <id extended="0">82</id>
      <dbc>C:\Program Files\National Instruments\NI-CAN\example.ncd</dbc>
      <conflicts>0</conflicts>
      <bytes>6</bytes>
      <interface>1</interface>
      <comment></comment>
      <channel name="ClutchPressure">
        <conflicts>0</conflicts>
        <bitfield start="0" bits="8" order="0" type="1"/>
        <linear_scaling factor="1.600000e+001"
    offset="0.000000e+000" max="4.000000e+003" min="0.000000e+000"
    default="0.000000e+000" unit="kPa"/>
        <comment></comment>
      </channel>
    </message>
    </nican_config>
    Thus, you could generate *.ncd files with simple file I/O. Having XML-specific file I/O functions simplifies this task.
    -B2k

  • I have an existing ipod that I use with my mac. I am trying to connect an additional ipod to it but when I try and register, it just brings up the existing info. I don't want to lose the original info or library - just create new for this device. Pls help

    I have an existing ipod that I use with my mac. I am trying to connect an additional ipod to it but when I try and register, it just brings up the existing info. I don't want to lose the original info or library - just create new for this device. Pls help...

    We are starting from the beginning like its a new ipod starts out asking language, country,location services,choose a network,and when we get to "setup ipod touch  " there are 3 options 1..setup as new ipod, 2.restore from ipod backup 3 restore from itunes backup and when we hit setup as new ipod and click next it comes up with sign in with apple id or create a free apple id  we clicked create a free apple id....then comes up with bday,1st name last name, use your current email address, get a free icloud email address or change email address and THIS is where we have problems....if we hit change email address it means that sis's stuff goes under his name and moves all her stuff to this older ipod which the brother does not want. sorry this is so long but its the only way I knew to do it.

  • 8.9 ACH Paycycle -- possible to create multiple files?

    We currently have multiple business units set up to create ACH payments (for example 5 paycycles). Each of these paycycles is run separately as the business units all contain either a different Bank Numbers or a different Account Numbers from the same bank. Here is an example:
    Bank 1:
    Paycycle 1 - Account 1
    Paycycle 2 - Account 2
    Paycycle 3 - Account 3
    Bank 2:
    Paycycle 4 - Account 4
    Bank 3:
    Paycycle 5 - Account 5
    We are currently looking to see if we should try to combine all of the paycycles into one so the user only has to run one paycycle daily. However, we would need 5 separate files written out of the Paycycle.
    Has anyone done this before? Is it possible with minimal customizations? or will it be a lot of customizations?
    Thanks!
    Jennifer

    Jennifer,
    usually payment files are generated based on the bank,bank account and payment method combination. In your case you should be able to create 5 files for 5 different bank accounts even after combining everything into one paycycle.
    Try this and let me know if you face any issues.
    Regards,
    DevD

  • Creating a file in servlet?

    Hello,
    I want to read the content of a website and store them
    in a file on my local disk, but I can't do it with servlet.
    In my servlet doGet method I have:
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
         try
         URL xml_file = new URL("http://localhost:8080/xml/search.xml");
         InputStream in = xml_file.openStream();
         InputStreamReader read = new InputStreamReader(in);
         FileOutputStream output_file = new FileOutputStream(new File("xml.xml"));
         int c;
         while ((c=read.read())!=-1)
              servletOutStr.println(c);
              output_file.write(c);
    Doesn't      :FileOutputStream output_file = new FileOutputStream(new
    File("xml.xml"));" should create an empty file "xml.xml" in the same
    folder? Or it only works only in the main method?
    Thank you in advance for your reply.

    The servlet is running on a web server, so it creates the file there. But when you say "in the same folder", the truth is that it creates the file in the servlet container's current directory, not in the same folder as something you were thinking of. I don't understand why you would use a servlet to do this task when an ordinary Java application would work.

  • Abap Proxy to Send RFC  data  -- xi - File    ,   how to do - pls help  ?

    Hi Friends ,
                           Our scenario is once in day an  RFC is to be triggered and create flat file .That RFC will return data .
       Using  below likns i have configured the RFC Sender adapter
    /people/arpit.seth/blog/2005/06/27/rfc-scenario-using-bpm--starter-kit
    /people/michal.krawczyk2/blog/2005/03/29/configuring-the-sender-rfc-adapter--step-by-step
    First Activate the ABAP Proxy?
    /people/vijaya.kumari2/blog/2006/01/26/how-do-you-activate-abap-proxies
    How to implement a Client Proxy?
    /people/ravikumar.allampallam/blog/2005/03/14/abap-proxies-in-xiclient-proxy
    My question is
    <b>     1.    Is it possible to use ABAP Client proxy   to achive this ?
          2.   Then do we need to write RFC Call in side this proxy call ?
          3.      If we go for proxy do we need RFC Sender Adpater ?</b>
            I am little confused can you please explain , as how it works ?
    <b>       Is there is any other way to trigger RFC to send data ?</b>
    Regards.,
    Shyam

    Hi sabrish ,
                          Tahnks for ur reply. I was waiting for ur response . i have doubt
    the foloowing code i got from ur blog .
    REPORT Z_TEST_RFC_XI_WEBSERVICE.data: lv_distance type char10.CALL FUNCTION 'Z_WEBSERVICE_TEST_SHABZ' <b>destination 'Z_WEBSERVICE' </b> EXPORTING FROMZIP        = '12222' TOZIP          = '22222' IMPORTING  DISTANCE       = lv_distance.write : 'Distance is : ' , lv_distance.
      <b>           1. i have to generate proxy from Out bound interface right ? inside that proxy class whare i have to in clude the code to call rfc ?
                  2. Can u please tell what is the Destination in that report.  What is z_webservice ?</b>
                  3 . Do we need to use RFC Sender adapter ? It is not related to proxy right ?
    Regards.,
    Shyam
    null

  • IS it possible to create control file in FAT32

    I have an external disk with fat32.The version 9.2 in win2k
    Will i be able to create in external hard disk .The Oracle software in installed in NTFS
    The create database fails with followin error.
    orA-01501: CREATE DATABASE failed
    orA-00200: controlfile could not be created
    orA-00202: controlfile: 'F:\oracle\oradata\QSNY\control01.ctl'
    orA-27040: skgfrcre: create error, unable to create file
    osD-04002: unable to open file
    oS-Error: (OS 5) Access is denied

    It looks like an OS permission problem.
    Oracle should have no problem access FAT32 if setup correctly. However, in Installation Guide, it recommended to use NTFS.
    Is there any reason you want to have this disk FAT32 ?

  • Is it possible to create a hyperlink in a context menu entry?

    We use Altium Designer, which export schematics to PDF.
    For the parameters it uses the context menu of the pdf specs.
    One entry in the menu is a path to a document.
    Is it possible to get an hyperlink to this Path/URL, to open it directly out of the Adobe Reader XI?
    In the current output it is not possible.
    What must be done in the PDF definition to realize the hyperlink?
    best regards
    Silvio Kilz

    Are you using JavaScript to create this menu? If so then you can expand your code to open a file (or a web-link) based on the user's selection.

  • Getting Error while  creating Integration server Connection ...PLS help me

    Hi everybody,
    While creating the Integration server connection I am getting the below error.
    Please help me to solve it.
    I am using 10.1.3.1 .
    Application Server: OK
    BPEL Process Manager Server: FAILED
    ESB Server: FAILED
    Thanks in advance.
    Ramana

    Now i can able to login to my weblogic admin console and find that listen address is blank i have given the listen address as localhost now i can able to create the application server connection successfully ...Listen address blank means your server will accept connections on all network addresses i.e. on localhost, on 127.0.0.1 and on IP/Host name of machine
    If you want to access this server from a remote machine as well, then better keep the listen address field as blank OR assign the value of hostname/IP of machine as listen address. In case you set listen address as hostname/IP of machine, server will not listen anymore to localhost or 127.0.0.1
    1)Now iam working in local machine so that i am giving localhost .... In case i doing some bpel work in my local machine and after completing the work if want to move to my server ...do i want to change the connectionand give my server hostname ha?If your BPEL server is a remote server then better create a new connection for that (using listen address and port of that server)
    How to see errors in Admin server log C:\Oracle\Middleware\user_projects\domains\Soa_base_domain\servers\AdminServer\logs ...is it i want to check it here?Yes, you need to check the logs in this directory in file AdminServer.log
    How to check this?Under $Domain_Home/bin (C:\Oracle\Middleware\user_projects\domains\Soa_base_domain\bin), there will be a file setSOADomainEnv.cmd. If you open this file using notepad, you would see a setting like below -
    set DEFAULT_MEM_ARGS=-Xms512m -Xmx768mThis setting defines the heap memory.
    Regards,
    Anuj

  • Problem in the local file download by gui_download,pls help!

    hello,everyone,
    when I use 'GUI_DOWNLOAD' to download file to my pc,the data in the file has some display problem,eg:'440006114002084000 'displayed as 4.40006E+17
    when I enlarge the excel grid,then the  '4.40006E+17 ' just not change to 440006114002084000,so does any know this problem?pls give me some help.
    thank you in advance.

    Hi,
    You need to change the content of the field in your internal table before you call gui_download.
    Something like
    constant: c_quote value `'`.
    loop at data_tab assigning <fs_data>.
    concatentate c_quote <fs_data>-ean into wa_ean.
    <fs_data>-ean = wa_ean.
    endloop.
    This will change the field from, for example 123456 to '123456, which Excel will treat as text.
    Regards,
    Nick

  • When opening .doc from website link, FF appends .docx extention to file & does not open in Word 2010, with incorrect file format error. Pls Help

    I'm using Firefox v12 to open a hyperlink from a website that points to a filename.doc MS Word Document for download.
    We are then asked to open the file with MS Word (Default), which our installed version is MS Word 2010.
    Firefox then renames the file appending a .docx to the filename e.g filename.doc.docx. MS Word 2010 opens with error 'incorrect file format', which is correct as Firefox has renamed it.
    Is there a fix or workaround for this?

    Hello Jscher2000,
    I can save the file and it opens fine.
    It's when I open it directly, Firefox appends the 'docx' extenstion to the filename.
    If I continue to reopen from the web link, Firefox renames the file as so
    mydoc.doc-1.docx
    mydoc.doc-2.docx
    mydoc.doc-3.docx
    I can open a .doc from a Microsoft site ok.
    I have the feeling it's the way the web server is reporting the mime type to Firefox.
    The link in question works fine in Internet Explorer.
    best regards,
    Youngielinux.

  • Two seperate class files can not resolve (pls help me) THANKS!

    When i compile UseMusic.java i get the following:
    i can't figure it out..
    Thank You for Time!
    D:\java\cENG310\Ass2>javac UseMusic.java
    UseMusic.java:29: cannot resolve symbol
    symbol  : variable middlec
    location: class UseMusic
                       mm.caldis(middlec);  // compute freqs
                                 ^
    UseMusic.java:42: cannot resolve symbol
    symbol  : variable middlec
    location: class UseMusic
             mm.setzero(middlec); // reset middlec to zero
                        ^
    UseMusic.java:56: caldis(java.lang.String[],double[],double) in Music cannot be appli
                      mm.caldis(middlec);  // compute freqs
                        ^
    UseMusic.java:81: checkvaild(java.lang.String[],java.lang.String) in Music cannot be
    a.lang.String)
                boolean cv = mm.checkvaild(strkey);
                               ^
    UseMusic.java:86: getfreq(java.lang.String[],java.lang.String) in Music cannot be app
    ang.String)
                   int index = mm.getfreq(strkey);
                                 ^
    5 errors
    *  Filename    : UseMusic.java
    import iopack.Io;
    import java.text.DecimalFormat;
    * UseMusic this class is
    public class UseMusic {
          public static void main(String[] args) {
             Music mm = new Music();
                   DecimalFormat fmt = new DecimalFormat("0.###"); // round output to 3 decimals places
             boolean newmidc = false;
             boolean notelookup = false;  
             System.out.println("\n\tMusical Scales");
             System.out.println("\t---------------");     // display the title and instructions
             System.out.println("\n\tDefault note values are:");  
                 mm.caldis(middlec);  // compute freqs
             System.out.println("\n\t************************");
             System.out.println("\t* Notes  *  Frequency  *");
             System.out.println("\t************************"); 
             // print old results
             for (int i = 0; i < mm.noteName.length; i ++) {
                        // display values onto screen
                System.out.println("\t* " + mm.noteName[i] + "\n");
                System.out.println("      " + mm.noteFreq[i] + " Hz *\n");     
             mm.setzero(middlec); // reset middlec to zero
             // prompt user for value of midddle c
             while (!newmidc) {
                   //read value new value for middle c
                   double middlec = Io.readDouble("\n\tEnter value for Middle C [Between 250 - 265] (Hz)");
                   // vaildate value for middlec
                   // vaild if valeu for middle is between 250-265
                   if ((middlec > 250) && (middlec < 265)) {
                      System.out.println("\n\tNew note values");
                      System.out.println("\n\t----------------\n");
                      mm.caldis(middlec);  // compute freqs
                      System.out.println("\n\t************************");
                      System.out.println("\t* Notes  *  Frequency  *");
                      System.out.println("\t************************"); 
                      // print old results
                      for (int i = 0; i < mm.noteName.length; i ++) {
                            // display values onto screen
                            System.out.println("\t* " + mm.noteName[i] + "\n");
                            System.out.println("      " + mm.noteFreq[i] + " Hz *\n");     
                      break;   // get out of while
                   else {
                         System.out.println("\nError Invaild Input!\nValue must be between 250 Hz to 265 Hz.");         
                   } //end of else
             } // end of while for newmidc
             // prompt user for note
             while (!notelookup) {
                //read value new value for
                String strkey = Io.readString("\n\tEnter note value");
                boolean cv = mm.checkvaild(strkey);
                // vaildate value for middlec
                // vaild if valeu for middle is between 250-265
                if (cv == true) {
                   int index = mm.getfreq(strkey);
                   System.out.println("\nNote " + mm.getnoteName(index) + "has frequency of" + mm.getnoteFreq(index) + " Hz");
                   break;   // get out of while
                else {
                   System.out.println("Invaild note!, please try again.");          
                } //end of else
             } //end of while    
          }// end of static main
    } // end of Class UseMusic
    *  Filename    : Music.java
    import java.*;
    public class Music
       static int MAXSIZE = 12;                  // max # of elements (13 elements)
       static double INITALMIDDLEC = 256;     // set default value of middle c to 256
       double middlec;          // user value for middlec
       String[] noteName;   // array stores name of notes
       double[] noteFreq;     // array stores freq of notes
      boolean vaildstr;     // track whether entered string is vaild
       char replay;               // user's reponse to continue prompt
       boolean uContinue;     // whether or not to continue
       int sub;                         // index of searched string
       // Default Constructor
       Music () {
          String[] noteName = {"C","C#","D","D#","E","F","F#","G","G#","A","A#","B","C'"};
          double[] noteFreq = new double[noteName.length];
          middlec = INITALMIDDLEC; // default value of middlec to 256
              vaildstr = false;        // signify whether user entered value
          sub = 0;
       void caldis(String[] noteName, double[] noteFreq, double middlec) {
          // calculate the values based upon middlec
          double temp = 0; // dummy used to store value
          double semitone = (double)Math.pow(2,(1/12));
          temp = middlec;   //set the value of the first element to middlec   
          // fill noteFreq with values wrt middlec
          // no magic #s - noteName since noteFreq has # of elements
          for (int i = 0; i < noteName.length; i++) {
             temp = noteFreq[i-1]; // save value of previous elements 
             noteFreq[i] = temp + (temp * semitone);
          } //end of for
       double getmiddlec(double middlec) {
          return middlec;   // Returns the value of middlec
       int getfreq(String[] noteName, String strkey) {     
          for (int i = 0 ; i < noteName.length ; i++) {        
             if (strkey.compareTo(noteName) == 0) {           
    sub = i;
    return sub;
         double setzero(double middlec) {
              middlec = 0;
              return middlec;
    String getnoteName(int index) {
    return noteName[index];
    double getnoteFreq(int index) {
    return noteFreq[index];
    boolean checkvaild(String[] noteName, String strkey) {
    vaildstr = noteName.equals(strkey);
    return vaildstr;
    } //end of Class Music

    >
    What part can't you figure out? The compiler is
    telling you that it can't resolve "middlec", which it
    can't, because you apparently didn't define it
    anywhere. Actually he did define it, but he defined it after he passed it to those methods. If that's not simply an oversight on his part, I can't begin to understand what he was thinking.

  • Can we create .CSV files through documaker

    Hi,
    Is it possible to create .csv files through documaker apart from pdf's
    Thanks

    With apologies, it is still unclear (to me) what you are asking.
    It is possible to create files using DAL, but to offer more specific guidance requires a better understanding of what it is that you want.
    A CSV is a Comma-Separate Value file. A PDF file is a printed document file containing formatted text content, graphics, lines, boxes, etc - in other words a fully-composed document.  I'm not exactly sure how a PDF and a CSV file could contain the same data.
    Are you perhaps asking to get an index of the created PDF files written as a CSV file? Something that contains a row of key transaction data along with the file name of the generated PDF? Perhaps something akin to the batch (BCH) files that can be produced per transaction recipient?
    Are you asking for an export file of all the field data that went into the creation of the document and included in the PDF? Normally a CSV has a header that describes the columns and then each row of data would be consistent with that header. Without knowing that every PDF file you create will have exactly the same number of fields defined, it is difficult to imagine that a single CSV file would be sufficient. And depending upon the number of fields and the size of the data assigned to each, this could be quite a long record per PDF in the resulting CSV file.
    Or perhaps you had in mind to get a name / value pair written for each field with data written on separate lines? This would not a be a true CSV file, but could have the name and values separated by commas if that is what you require.
    You have something specific in mind and yet, we are not in your mind.  We need more specific information on exactly what you are trying to accomplish.

  • Creating a file in a network drive

    Hi,
    Is it possible to create a file in a shared folder present in a different network drive(a folder in a system other that MII server which is neither FTP nor a webserver) and is there a way to get the list of files present in the same folder(a folder in a system other that MII server).
    Thanks,

    Hi,
    For Write action to be successful, the Internet Guest Account user for the machine must have write access to the directory.
    *This obviously only applies to 11.5 which used Windows IIS*
    Check and let me know.
    Thanks
    Rajesh Sivaprakasam.
    Edited by: Jeremy Good on Dec 10, 2008 9:02 AM

Maybe you are looking for