Java code to clear screen

i am in need of a method to call which clears the screen of a dos based java program which utilzes java.io*; ....checked the API could not find anything suitable can you help.
thanks

Did you see this thread?
http://forum.java.sun.com/thread.jsp?thread=383624&forum=54&message=1646711

Similar Messages

  • Clear the Filter Criteria from java code programmatically

    Hi All,
    I am using jdev version 11.1.1.6.0.
    I do have ADF table for which I have added filter to each column .
    I created table using java class data control.
    Filter is working Fine .
    My use case is-
    When I click on search button data is populated in table.
    When anybody enters filter value in column suppose product and hit enter ,it filters data.
    if he clears and do not hit enter key and search again then it does not show all data it only show filtered data.
    So how can I programmatically clear all filters so on click of  search it will show all the values not filtered values.
    I have not used default Filter Behavior.
    Please check below code for reference
      <af:table value="#{bindings.AfMyAccOrderStatusHistorySearchVO.rangeSet}"
                                  var="row"
                                  rows="#{bindings.AfMyAccOrderStatusHistorySearchVO.rangeSize}"
                                  emptyText="#{bindings.AfMyAccOrderStatusHistorySearchVO.viewable ? 'No data to display.' : 'Access Denied.'}"
                                  fetchSize="#{bindings.AfMyAccOrderStatusHistorySearchVO.rangeSize}"
                                  rowBandingInterval="0" id="tblStatusHistoryList"
                                  autoHeightRows="#{bindings.AfMyAccOrderStatusHistorySearchVO.rangeSize}"
                                  rowSelection="single"      
                                  width="100%"
                                  partialTriggers="::cb5 ::cb8 ::cb1 ::cb2"
                                  filterModel="#{bindings.AfMyAccOrderStatusHistorySearchVO1Query.queryDescriptor}"
                                  queryListener="#{bindings.AfMyAccOrderStatusHistorySearchVO1Query.processQuery}"
                                  filterVisible="true" varStatus="vs"
                                  binding="#{AfMyAccOrderStatusHistoryAction.orderStatusHistorySearchList}">
    <af:column headerText="#{alfaprojectBundle['ordstatushistory.column.invoiceDate']}"
                                      width="70"
                                      sortProperty="invoiceDate"
                                      sortable="true" filterable="true"
                                      id="c7" filterFeatures="caseInsensitive">
                              <af:outputText value="#{row.invoiceDate}" id="ot16"/>
                            </af:column>                     
                            <af:column headerText="#{alfaprojectBundle['ordstatushistory.column.soldto']}"
                                       width="100"   
                                       sortProperty="soldTo"
                                       sortable="true" filterable="true"
                                       id="c14" filterFeatures="caseInsensitive">
                              <af:outputText value="#{row.soldTo}"
                                             visible="#{row.visibilityIsOrdrFirstItem}"
                                             id="ot23"/>
                            </af:column>
    So how to clear all filter values from java code.

    I can't get the example "Programmatically Manipulating a Table's QBE Filter Fields"
    Where is it ?
    https://smuenchadf.samplecode.oracle.com/samples/ClearTableColumnFilterFields.zip
    Thks

  • IS IT POSSIBLE to change SCREEN's RESOLUTION thru JAVA code?

    Can I change the screen resolution of the PC (through my Java code) where my application will run? is there any possible way to do this?

    Hi.
    Sure it's possible if you use JDK 1.4, you can switch to fullscreen mode and change the displayModes throug methods like :
    java.awt.GraphicsDevice :
    public void setDisplayMode(DisplayMode dm)
    public DisplayMode getDisplayMode()
    public DisplayMode[] getDisplayModes()
    You can browse to for more information
    http://java.sun.com/j2se/1.4/docs/guide/awt/AWTChanges.html
    Regards, Mart�n

  • How to write java code to read the pixel color in some place of screen?

    Hello all:
    How to write java code to read the pixel color in some place of screen?
    The java application iteself doesn't have any GUI.
    thank you
    -Danel

    See java.awt.Robot

  • Clearing screen using java

    In java, how can i clear the console screen while running the program?

    It depends on what you mean by "using Java". There are Java libraries to do screen control.
    Of course, there are different kinds of consoles, and some can't be cleared at all.

  • Calling Java code inside JSP page and sending toString on object to Servlet

    Hi.
    I am trying to setup a way to make testing my application easier. Using a web-based method will work best. Here is what I am trying to accomplish:
    - Have a web page that will prompt the user to enter data, fill in text fields, make choices, etc. When done, they press the Submit button. I don't need to keep info between sessions. Just open browser, execute, view results, close browser, repeat.
    - I then want to take this data and use some Java Classes I have to create a Java object.
    - I then want to send the toString() results of this Java object to a known Java servlet. The result of the servlet's actions should be displayed as a response on the screen.
    This is what I currently have (Ignore the
    's - I don't know why they are showing up - its not important):
    Web page:
    <html>
    <head><title>TestGroup</title></head>
    <body>
    <form name=f method=post action=http://localhost:100/Servlet>
    Name: <br>
    Group: <input name=group type=text><br>
    <br>
    <input type=submit value=Submit>
    <input type=reset value=Reset>
    </form>
    </body>
    </html>The Java code in the JSP (where to put it?):
    <%
    Group g = new Group();
    g.setGroupName(request.getParameter("group"));
    String output = g.toString(); // I want this to go to the Servlet.
    %>But, now I am stuck as to how to piece these together. I have some JSP experience, but not quite like this.
    As I said, when the user presses the Submit button, I want to perform the Java code above, and have the results of the toString method sent to the Servlet, plus clear all other parameters (so they are not sent to the servlet).
    Does anyone have any advice/comments? I am open to alternative designs too, this is just the simplest one I could think of. If another JSP page is needed, that's fine too.
    Thanks.

    Hi.
    I am trying to setup a way to make testing my application easier. Using a web-based method will work best. Here is what I am trying to accomplish:
    - Have a web page that will prompt the user to enter data, fill in text fields, make choices, etc. When done, they press the Submit button. I don't need to keep info between sessions. Just open browser, execute, view results, close browser, repeat.
    - I then want to take this data and use some Java Classes I have to create a Java object.
    - I then want to send the toString() results of this Java object to a known Java servlet. The result of the servlet's actions should be displayed as a response on the screen.
    This is what I currently have (Ignore the
    's - I don't know why they are showing up - its not important):
    Web page:
    <html>
    <head><title>TestGroup</title></head>
    <body>
    <form name=f method=post action=http://localhost:100/Servlet>
    Name: <br>
    Group: <input name=group type=text><br>
    <br>
    <input type=submit value=Submit>
    <input type=reset value=Reset>
    </form>
    </body>
    </html>The Java code in the JSP (where to put it?):
    <%
    Group g = new Group();
    g.setGroupName(request.getParameter("group"));
    String output = g.toString(); // I want this to go to the Servlet.
    %>But, now I am stuck as to how to piece these together. I have some JSP experience, but not quite like this.
    As I said, when the user presses the Submit button, I want to perform the Java code above, and have the results of the toString method sent to the Servlet, plus clear all other parameters (so they are not sent to the servlet).
    Does anyone have any advice/comments? I am open to alternative designs too, this is just the simplest one I could think of. If another JSP page is needed, that's fine too.
    Thanks.

  • How to provide value to a User Defined field thru java code

    I am using OIM 11.1.1.5.
    I have a user defined field called Unique-Customer-Number. This field need to be pre-populated during user creation (using OIM Web UI) and the value comes from a java code.
    Can any of you tell me the high level steps to implement this.
    Thanks!
    Kabi

    Thanks Rajiv,
    I just followed everything on metalink 1262803.1. My console shows the followings during Metadata import.
    weblogicImportMetadata.bat :-
    Starting import metadata script ....
    Please enter your username :weblogic
    Please enter your password :
    Please enter your server URL [t3://localhost:7001] :t3://10.10.99.99:7001
    Connecting to t3://10.10.99.99:7001 with userid weblogic ...
    Successfully connected to Admin Server 'adm_server01' that belongs to domain 'server01'.
    Warning: An insecure protocol was used to connect to the server. To ensure on-the-wire security, the SSL port or Admin port should be used instead.
    Location changed to domainRuntime tree. This is a read-only tree with DomainMBean as the root.For more help, use help(domainRuntime)
    Disconnected from weblogic server: adm_eimsdv1s01
    End of importing metadata script ...
    Exiting WebLogic Scripting Tool.
    How I will I know that my plugin/ event-Handler is registered successfully. Is there any screen where I can see all registered plugins ?

  • Error while sending Email through Java Code in OIM

    Hi All,
    I have created a java code using tcEmailNotificationUtil, and integrated the same with the adapter.
    I am triggering this adapter when an approval process gets completed.
    As soon as the approval process gets completed my email task is triggering but the task is getting rejected.
    I have checked my system configuration for mail server settings.Everything seems working fine.
    Can you please help me in this issue how to debug?
    Thanks in advance.

    Hi,
    Here is my log file:
    DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/insertTaskHistory left.
    DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/run entered.
    DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: ReIssueAuditMessage/execute entered.
    DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: ReIssueAuditMessage/initialize entered.
    DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/getAttribute entered.
    DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/getAttribute left.
    DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/getUtility entered.
    DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/getUtility left.
    DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.ACCOUNTMANAGEMENT] - Class/Method: tcUtilityFactory/getRemoteUtility - Data: moUtil - Value: Thor.API.Operations.tcAuditOperationsClient
    DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: ReIssueAuditMessage/initialize left.
    DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: ReIssueAuditMessage/processAllByIdentifier entered.
    DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isStopped entered.
    DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isStopped left.
    DEBUG,25 Apr 2011 10:40:00,100,[XELLERATE.DATABASE] - select A.* from (select aud_jms_key, aud_class, identifier from aud_jms order by aud_jms_key) A where rownum <= ?
    INFO,25 Apr 2011 10:40:00,101,[XELLERATE.PERFORMANCE] - Query: DB: 1, LOAD: 0, TOTAL: 1
    DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isStopped entered.
    DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isStopped left.
    DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isStopped entered.
    DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isStopped left.
    DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: ReIssueAuditMessage/execute left.
    DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/run left.
    DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isSuccess entered.
    DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isSuccess left.
    DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SERVER] - Class/Method: SchedulerTaskLocater /removeLocalTask entered.
    DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SERVER] - Class/Method: SchedulerTaskLocater /removeLocalTask left.
    DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/updateStatusToInactive entered.
    DEBUG,25 Apr 2011 10:40:00,104,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/updateStatusToInactive left.
    DEBUG,25 Apr 2011 10:40:00,104,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/updateTaskHistory entered.
    DEBUG,25 Apr 2011 10:40:00,106,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/updateTaskHistory left.
    DEBUG,25 Apr 2011 10:40:00,106,[XELLERATE.SERVER] - Clearing Security Associations with thread executing Scheduled task
    DEBUG,25 Apr 2011 10:40:00,106,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/run left.
    DEBUG,25 Apr 2011 10:40:00,106,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/execute left.
    and I just wanted to ensure that my coding part is also fine.
    Posting the code even:
    tcDataProvider ioDatabase = new tcDataBaseClient();
    tcEmailNotificationUtil sendMail = new tcEmailNotificationUtil(ioDatabase);
    sendMail.setBody("Sample Message");
    sendMail.setSubject("subject");
    sendMail.setFromAddress("fromemailaddress");
    sendMail.sendEmail("recepient");
    Thanks in Advance.

  • Running a java program in another java code

    Hello,
    I have a question.I wrote a java server code named server.java. In this server code, I receive another java class code called "HelloWorld.class" from another node. What I want to do is to execute the class HelloWorld inside server.java.
    Briefly, I would like to run a compiled java code (class code)in another executing class code. How can I achieve this?
    Thanks in advance
    �ebnem Bora

    Hi,
    Sorry but your terminology isn't that clear. Are you trying:
    1. To call methods on another class or
    2. To launch a separate process that will run another class?
    If it's either of these then they're not 'Advanced Language Topics' but simple:
    // Scenario 1
    // in Server class
    HelloWorld hw = new HelloWorld();
    hw.sayHello(); // or whatever the method is
    // Scenario 2
    Runtime.exec(new String [] {"java", "HelloWorld"}); // or whateverIs that of any help?
    Dom.

  • Running Oracle startup or shutdown bat file from Java code

    I have two bat files for the startup and shutdown of Oracle instance which works fine from the command prompt. But my requirement is to run it through a Java program. Please reply with full Java code. Also mention how I would get the status of the bat files that it is successfully executed or not and if not what is the error.

    Your program is working fine, but there is another problem. What's happening now is I have to open the Login screen after the startup of oracle server is complete, but the next line of my program after Runtime.exec is the LoginScreen.show which immediately shows the login screen after executing Runtime.exec and when I am giving the login name and password and press enter, it shows Oracle not available exception, because the startup process is still in progress. I want to stop the execution of my next line of code until and unless my process of Oracle startup is complete.

  • [UCCx] Change volume of an audio file (java code)

    Hello guys,
    Thanks to the many examples I compiled on the subject, I was able to create a script that mixes 2 audio wav files into a 3rd one. Basically the goal is to mix a first audio file containing some speech with a second one containing some music, these files being encoded identically (8 bits, 8KHz, mono wav files). The resulting file must be encoded in the same format than the initial ones.
    The mixing operation is performed thanks to the MixingAudioInputStream library found online (it can be found here).
    It is not the most beautiful Java code (I am no developer), but it works:
    Document doc1 = (Document) promptFlux1;
    Document doc2 = (Document) promptFlux2;
    Document docFinal = (Document) promptFinal;
    javax.sound.sampled.AudioFormat formatAudio = null;
    java.util.List audioInputStreamList = new java.util.ArrayList();
    javax.sound.sampled.AudioInputStream ais1 = null;
    javax.sound.sampled.AudioInputStream ais2 = null;
    javax.sound.sampled.AudioInputStream aisTemp = null;
    javax.sound.sampled.AudioFileFormat formatFichierAudio = javax.sound.sampled.AudioSystem.getAudioFileFormat(new java.io.BufferedInputStream(doc1.getInputStream()));
    java.io.File fichierTemp = java.io.File.createTempFile("wav", "tmp");
    ais1 = javax.sound.sampled.AudioSystem.getAudioInputStream(doc1.getInputStream());
    formatAudio = ais1.getFormat();
    aisTemp = javax.sound.sampled.AudioSystem.getAudioInputStream(doc2.getInputStream());
    byte[] bufferTemp = new byte[(int)ais1.getFrameLength()];
    int nbOctetsLus = aisTemp.read(bufferTemp, 0, bufferTemp.length);
    java.io.ByteArrayInputStream baisTemp = new java.io.ByteArrayInputStream(bufferTemp);
    ais2 = new javax.sound.sampled.AudioInputStream(baisTemp, formatAudio, bufferTemp.length/formatAudio.getFrameSize());
    audioInputStreamList.add(ais1);
    audioInputStreamList.add(ais2);
    MixingAudioInputStream mixer = new MixingAudioInputStream(formatAudio, audioInputStreamList);
    javax.sound.sampled.AudioSystem.write(mixer, formatFichierAudio.getType(), fichierTemp);
    return fichierTemp;
    The only downside to this is that the music can be a little loud comparing to the speech. So I am now trying to use the AmplitudeAudioInputStream library to adjust the volume of the second file (it can be found here).
    Here are the additional lines I wrote to do this:
    ais2 = new javax.sound.sampled.AudioInputStream(baisTemp, formatAudio, bufferTemp.length/formatAudio.getFrameSize());
    org.tritonus.dsp.ais.AmplitudeAudioInputStream amplifiedAudioInputStream = new org.tritonus.dsp.ais.AmplitudeAudioInputStream(ais2, formatAudio);
    amplifiedAudioInputStream.setAmplitudeLinear(0.2F);
    audioInputStreamList.add(ais1);
    audioInputStreamList.add(amplifiedAudioInputStream);
    MixingAudioInputStream mixer = new MixingAudioInputStream(formatAudio, audioInputStreamList);
    javax.sound.sampled.AudioSystem.write(mixer, formatFichierAudio.getType(), fichierTemp);
    return fichierTemp;
    The problem is I always get the following exception when executing the code:
    could not write audio file: file type not supported: WAVE; nested exception is: java.lang.IllegalArgumentException: could not write audio file: file type not supported: WAVE (line 30, col:2)
    The error is on the last line (the write method), but after many hours of tests and research I cannot understand why this is not working... so I have added some "debugging" information to the code:
    System.out.println("file1 audio file format: " + formatFichierAudio.toString());
    System.out.println("file1 file format: " + ais1.getFormat().toString());
    System.out.println("file2 file format: " + ais2.getFormat().toString());
    System.out.println("AIS with modified volume file format: " + amplifiedAudioInputStream.getFormat().toString());
    System.out.println("Mixed AIS (final) file format: " + mixer.getFormat().toString());
    AudioFileFormat.Type[] typesDeFichiers = AudioSystem.getAudioFileTypes(mixer);
    for (int i = 0; i < typesDeFichiers.length ; i++) {
    System.out.println("Mixed AIS (final) #" + i + " supported file format: " + typesDeFichiers[i].toString());
    System.out.println("Is WAVE format supported by Mixed AIS (final): " + AudioSystem.isFileTypeSupported(AudioFileFormat.Type.WAVE, mixer));
    System.out.println("Destination file format: " + (AudioSystem.getAudioFileFormat((java.io.File)f)).toString());
    AudioInputStream aisFinal = AudioSystem.getAudioInputStream(f);
    System.out.println("Is WAVE format supported by destination file: " + AudioSystem.isFileTypeSupported(AudioFileFormat.Type.WAVE, aisFinal));
    try {
    // Ecriture du flux résultant dans un fichier
    javax.sound.sampled.AudioSystem.write(mixer, formatFichierAudio.getType(), fichierTemp);
    return fichierTemp;
    catch (Exception e) {
    System.err.println("Caught Exception: " + e.getMessage());
    Which gives the following result during execution:
    file1 audio file format: WAVE (.wav) file, byte length: 146964, data format: ULAW 8000.0 Hz, 8 bit, mono, 1 bytes/frame, , frame length: 146906
    file1 file format: ULAW 8000.0 Hz, 8 bit, mono, 1 bytes/frame,
    file2 file format: ULAW 8000.0 Hz, 8 bit, mono, 1 bytes/frame,
    AIS with modified volume file format: ULAW 8000.0 Hz, 8 bit, mono, 1 bytes/frame,
    Mixed AIS (final) file format: ULAW 8000.0 Hz, 8 bit, mono, 1 bytes/frame,
    Mixed AIS (final) #1 supported file format: WAVE
    Mixed AIS (final) #2 supported file format: AU
    Mixed AIS (final) #3 supported file format: AIFF
    Is WAVE format supported by Mixed AIS (final): true
    Destination file format: WAVE (.wav) file, byte length: 146952, data format: ULAW 8000.0 Hz, 8 bit, mono, 1 bytes/frame, , frame length: 146906
    Is WAVE format supported by destination file: true
    So everything tends to show that the format should be supported and the mixed AIS should be written to the file... but I still get the error.
    I am really confused here, if someone could help it would be great.
    Thanks in advance!
    PS: I have attached print screens of the actual script, without the "volume adjustment" code.

    Hi,
    well I started writing a similar solution but it did not work either so I just put it on hold.
    I also tried to get hold of the streaming "device" abstraction of UCCX to adjust the volume while "playing" but that was a dead end, too, unfortunately.
    Sorry about my previous comment on your StackOverflow post, that time I thought it was kind of out of context but I believe you only wanted to ask about this issue on all available forums.
    G.

  • I need an Array in my JAVA CODE

    I need an array in my java code for my last class in my Java 1 course
    my code does compile in dos using javac,....and it does work
    It is a mortgage calculator for 3 loans of 3 different years loaned,.... and each have a different interest rate.
    I need to have my code in an ARRAY for my last week .
    any help would be appreciated
    here is my code :
    import java.text.*;           //20 May 2008, Revision ...many
    import java.io.IOException;
    class memortgage     //program class name
      public static void main(String[] args) throws IOException
        double amount,moPay,totalInt,principal = 200000; //monthly payment, total interest and principal
        double rate [ ] = {.0535, .055, .0575};          //the three interest rates
        int [ ] term = {7,15,30};                        //7, 15 and 30 year term loans
        int time,ratePlace = 0,i,pmt=1,firstIterate = 0,secondIterate = 0,totalMo=0;
        char answer,test;
        boolean validChoice;
        System.in.skip(System.in.available());           //clear the stream for the next entered character
        do
          validChoice = true;
          System.out.println("What Choice would you Like\n");
          System.out.println("1-Interest rate of 5.35% for 7 years?");       //just as it reads for each to select from
          System.out.println("2-Interest rate of 5.55% for 15 years?");
          System.out.println("3-Interest rate of 5.75% for 30 years?");
          System.out.println("4-Quit");
          answer = (char)System.in.read();
          if (answer == '1')  //7 yr loan at 5.35%
            ratePlace = 0;
            firstIterate = 4;
            secondIterate = 21;
            totalMo= 84;
          else if (answer == '2') //15 yr loan at 5.55%
            ratePlace = 1;
            firstIterate = 9;      //it helps If I have the correct numbers to calcualte as in 9*20 to equal 180...that why I was off -24333.76
            secondIterate = 20;    //now it is only of -0.40 cents....DAMN ME
            totalMo = 180;
          else if (answer == '3') //30 yr loan at 5.75%
            ratePlace = 2;
            firstIterate = 15;
            secondIterate = 24;
            totalMo = 360;
          else if (answer == '4') //exit or quit
            System.exit(0);
          else
            System.in.skip(System.in.available());               //validates choice
            System.out.println("Invalid choice, try again.\n\n");
            validChoice = false;
        }while(!validChoice);  //when a valid choice is found calculate the following, ! means not, similar to if(x != 4)
        for(int x = 0; x < 25; x++)System.out.println();
        amount = (principal + (principal * rate[ratePlace] * term[ratePlace] ));
        moPay = (amount / totalMo);
        totalInt = (principal * rate[ratePlace] * term[ratePlace]);
        DecimalFormat df = new DecimalFormat("0.00");
        System.out.println("The Interest on $" + (df.format(principal) + " at " + rate[ratePlace]*100 +
        "% for a term of "+term[ratePlace]+" years is \n" +"$"+ (df.format(totalInt) +" Dollars\n")));
        System.out.println("\nThe total amount of loan plus interest is $"+(df.format(amount)+" Dollars.\n"));
        System.out.println("\nThe Payments spread over "+term[ratePlace]* 12+" months would be $"+
        (df.format (moPay) + " Dollars a month\n\n"));
        System.in.skip(System.in.available());
        System.out.println("\nWould you like to see a planned payment schedule? y for Yes, or x to Exit");
        answer = (char)System.in.read();
        if (answer == 'y')
          System.out.println((term[ratePlace]*12) + " monthly payments:");
          String monthlyPayment = df.format(moPay);
          for (int a = 1; a <= firstIterate; a++)
            System.out.println(" Payment Schedule \n\n ");
            System.out.println("Month Payment Balance\n");
            for (int b = 1; b <= secondIterate; b++)
              amount -= Double.parseDouble(monthlyPayment);
              System.out.println(""+ pmt++ +"\t"+ monthlyPayment + "\t"+df.format(amount));
            System.in.skip(System.in.available());
            System.out.println(("This Page Is Complete Press [ENTER] to Continue"));
            System.in.read();
    }

    here is what was commented from my instructor for my week 4...is what you sen in the code....but I fixed loan 2 tonight
    "Week 4 Great work, the numbers were a little off on the 1st and 2nd loans. Next time
    try putting the values you displayed in an array. "
    import java.text.*;           //20 May 2008, Revision ...many
    import java.io.IOException;
    class memortgage     //program class name
      public static void main(String[] args) throws IOException
        double amount,moPay,totalInt,principal = 200000; //monthly payment, total interest and principal
        double rate [ ] = {.0535, .055, .0575};          //the three interest rates
        int [ ] term = {7,15,30};                        //7, 15 and 30 year term loans
        int time,ratePlace = 0,i,pmt=1,firstIterate = 0,secondIterate = 0,totalMo=0;
        char answer,test;
        boolean validChoice;
        System.in.skip(System.in.available());           //clear the stream for the next entered character
        do
          validChoice = true;
          System.out.println("What Choice would you Like\n");
          System.out.println("1-Interest rate of 5.35% for 7 years?");       //just as it reads for each to select from
          System.out.println("2-Interest rate of 5.55% for 15 years?");
          System.out.println("3-Interest rate of 5.75% for 30 years?");
          System.out.println("4-Quit");
          answer = (char)System.in.read();
          if (answer == '1')  //7 yr loan at 5.35%
            ratePlace = 0;
            firstIterate = 4;
            secondIterate = 21;
            totalMo= 84;
          else if (answer == '2') //15 yr loan at 5.55%
            ratePlace = 1;
            firstIterate = 9;      //it helps If I have the correct numbers to calcualte as in 9*20 to equal 180...that why I was off -24333.76
            secondIterate = 20;    //now it is only of -0.40 cents....DAMN ME
            totalMo = 180;
          else if (answer == '3') //30 yr loan at 5.75%
            ratePlace = 2;
            firstIterate = 15;
            secondIterate = 24;
            totalMo = 360;
          else if (answer == '4') //exit or quit
            System.exit(0);
          else
            System.in.skip(System.in.available());               //validates choice
            System.out.println("Invalid choice, try again.\n\n");
            validChoice = false;
        }while(!validChoice);  //when a valid choice is found calculate the following, ! means not, similar to if(x != 4)
        for(int x = 0; x < 25; x++)System.out.println();
        amount = (principal + (principal * rate[ratePlace] * term[ratePlace] ));
        moPay = (amount / totalMo);
        totalInt = (principal * rate[ratePlace] * term[ratePlace]);
        DecimalFormat df = new DecimalFormat("0.00");
        System.out.println("The Interest on $" + (df.format(principal) + " at " + rate[ratePlace]*100 +
        "% for a term of "+term[ratePlace]+" years is \n" +"$"+ (df.format(totalInt) +" Dollars\n")));
        System.out.println("\nThe total amount of loan plus interest is $"+(df.format(amount)+" Dollars.\n"));
        System.out.println("\nThe Payments spread over "+term[ratePlace]* 12+" months would be $"+
        (df.format (moPay) + " Dollars a month\n\n"));
        System.in.skip(System.in.available());
        System.out.println("\nWould you like to see a planned payment schedule? y for Yes, or x to Exit");
        answer = (char)System.in.read();
        if (answer == 'y')
          System.out.println((term[ratePlace]*12) + " monthly payments:");
          String monthlyPayment = df.format(moPay);
          for (int a = 1; a <= firstIterate; a++)
            System.out.println(" Payment Schedule \n\n ");
            System.out.println("Month Payment Balance\n");
            for (int b = 1; b <= secondIterate; b++)
              amount -= Double.parseDouble(monthlyPayment);
              System.out.println(""+ pmt++ +"\t"+ monthlyPayment + "\t"+df.format(amount));
            System.in.skip(System.in.available());
            System.out.println(("This Page Is Complete Press [ENTER] to Continue"));
            System.in.read();
    }

  • Show errors on UIX page from Java code?

    Hello all:
    I've got a simple Login page in Jdev 10g (9.0.5.2) that I'm setting up. The basics work fine -- if I type in a valid login/password, it works. If I type in an incorrect login/password, it loops back to the login page. The problem is that I can't seem to get my Invalid Login error message to appear.
    The loginPage.uix is based on a template. The template contains the following code:
    <messages>
    <messageBox automatic="true" />
    </messages>
    as a named child inside a <pageLayout> UIX node. The login page is:
    <?xml version="1.0" encoding="windows-1252"?>
    <page xmlns="http://xmlns.oracle.com/uix/controller"
    xmlns:ui="http://xmlns.oracle.com/uix/ui"
    xmlns:ctrl="http://xmlns.oracle.com/uix/controller"
    xmlns:html="http://www.w3.org/TR/REC-html40"
    xmlns:pas="http://www.paslists.com/pas/templates"
    expressionLanguage="el">
    <templates xmlns="http://xmlns.oracle.com/uix/ui">
    <templateImport source="pasPageLayout.uit"/>
    </templates>
    <content>
    <dataScope xmlns="http://xmlns.oracle.com/uix/ui"
    xmlns:data="http://xmlns.oracle.com/uix/ui" >
    <contents>
    <document>
    <metaContainer>
    <!-- Set the page title -->
    <head title="PAS Login Page"/>
    </metaContainer>
    <contents>
    <body>
    <contents>
    <pas:pasPageLayout selectedGlobalHeader="3">
    <contents>
    <stackLayout>
    <contents>
    <spacer height="10"/>
    <styledText text="Please enter your Web ID and Password, then press the Log In button."/>
    <spacer height="10"/>
    <flowLayout>
    <contents>
    <styledText text="If you don't have an ID, please send an e-mail to our "/>
    <link destination="mailto:[email protected]" text="Web Administrator" />
    <styledText text=" requesting one."/>
    </contents>
    </flowLayout>
    <spacer height="10"/>
    <form name="loginForm" method="POST">
    <contents>
    <labeledFieldLayout labelWidth="25%" fieldWidth="80%" columns="2" width="80%" >
    <contents>
    <messageTextInput prompt="ID:" name="username" columns="20" />
    <messageTextInput prompt="Password:" name="password" secret="true" columns="20" />
    </contents>
    </labeledFieldLayout>
    <rowLayout hAlign="right">
    <contents>
    <submitButton text="Log In" formName="loginForm" event="goLogin"/>
    <spacer width="10" />
    <resetButton text="Reset" formName="loginForm" />
    <spacer width="10" />
    </contents>
    </rowLayout>
    </contents>
    </form>
    </contents>
    </stackLayout>
    </contents>
    <start>
    <flowLayout>
    <contents>
    <sideNav selectedIndex="0">
    <contents>
    <link destination="login.do" text="Logging In"/>
    <link destination="logoff.do" text="Log Off"/>
    </contents>
    </sideNav>
    </contents>
    </flowLayout>
    </start>
    </pas:pasPageLayout>
    </contents>
    </body>
    </contents>
    </document>
    </contents>
    </dataScope>
    </content>
    <handlers>
    <!-- Add EventHandlers (<event> elements) here -->
    <event name="goLogin">
    <go name="login"/>
    </event>
    </handlers>
    </page>
    My Java code is:
    public class LoginAction extends DataAction
    public void findForward(DataActionContext actionContext) throws Exception
    HttpServletRequest request = actionContext.getHttpServletRequest();
    HttpSession session = request.getSession();
    ActionErrors errors = actionContext.getActionErrors();
    String target = "fail";
    //Get the result of the Model Method Call
    JUCtrlActionBinding method = actionContext.getCustomMethod();
    boolean successfulLogon = ((Boolean)method.getResult()).booleanValue();
    Integer attempts = (Integer)session.getAttribute("loginAttempts");
    int intAttempts = 0;
    if (attempts != null)
    intAttempts = attempts.intValue();
    if (!successfulLogon || intAttempts > 3)
    // If the Logon fails we need to do the follwoing
    // 1. Increment the counter. Once this exceeds 3 any logon will fail
    // 2. Create an error message to display on the logon screen.
    // Be sure that this is non-specific so crackers can't tell if
    // a portion if the username is correct or that there is a
    // Max attempts value.
    session.setAttribute("loginAttempts",new Integer(++intAttempts));
    errors.add("InvalidLogin",new ActionError("loginerr.invalid"));
    actionContext.setActionErrors(errors);
    else
    session.setAttribute("loginStatus", new String("true"));
    target = "success";
    actionContext.setActionForward(target);
    This goes to a "success" actionForward if the login works and a "fail" actionForward if the login fails.
    My ApplicationResources.properties file contains:
    loginerr.invalid=Invalid username/password. Please try again.
    This matches up with the key I used in the new ActionError() statement above.
    My structs-config.xml for this section looks like this:
    <action path="/mainAction" className="oracle.adf.controller.struts.actions.DataActionMapping" type="oracle.adf.controller.struts.actions.DataAction" name="DataForm">
    <set-property property="modelReference" value="loginUIModel"/>
    <forward name="success" path="/loginPage.do"/>
    <forward name="login" path="/loginAction.do"/>
    </action>
    <action name="DataForm" path="/loginAction" className="oracle.adf.controller.struts.actions.DataActionMapping" type="com.paslists.view.LoginAction">
    <set-property property="modelReference" value="loginUIModel"/>
    <set-property property="methodName" value="loginUIModel.login"/>
    <set-property property="resultLocation" value="${requestScope.methodResult}"/>
    <set-property property="numParams" value="2"/>
    <set-property property="paramNames[0]" value="${param.username}"/>
    <set-property property="paramNames[1]" value="${param.password}"/>
    <forward name="fail" path="/mainAction.do"/>
    <forward name="success" path="/getHomePageAction.do"/>
    </action>
    <action name="DataForm" path="/loginPage" forward="/loginPage.uix" validate="false"/>
    mainAction has a success forward to loginPage.uix. loginPage.uix has a "login" event attached to the submit button, which forwards to loginAction. loginAction executes the code declaratively and forwards to success or fail. If success, it continues on. If fail, it loops back to mainAction.
    Again -- this all works (almost). The only thing that does not work is that my ActionErrors() are not displaying on the web page.
    What am I doing wrong here?

    Solved my own problem. See the following thread for the answer:
    Displaying Struts messages/errors in 10g
    I modified my error code to be:
    actionContext.getActionErrors().add(ActionErrors.GLOBAL_ERROR,new ActionError("loginerr.invalid"));
    this.saveErrors(request,actionContext.getActionErrors());
    I modified my template to contain:
    <struts:dataScope xmlns="http://xmlns.oracle.com/uix/ui"
    xmlns:data="http://xmlns.oracle.com/uix/ui">
    <contents>
    <messageBox messageType="error" automatic="true"/>
    </contents>
    </struts:dataScope>
    I also added xmlns:struts="http://xmlns.oracle.com/uix/struts" to the templateDefinition.
    It now works.

  • How to use a variable of jsp custom tag in my java code?

    hi folks,
    i got a folderList tag like this:
    ArrayList list = new ArrayList(20);
    %>
    <foo:folderList path="${attributes.newsPath}" var="year" contentType="folder">
    <%
              list.add(${year.contentEntryName});   // of course, this doesn't work
    %>
    </foo:folderList>I think, its clear what I want to do. I am just wondering how I can use my Variable "year" in the Java code between <% %>...

    <% list.add(year.getContentEntryName()); %>
    You have to have defined in the custom tag that "var" relates to a scripting variable that you want defined.
    <tag>
      <variable>
        <name-given>var</name-given>
        <variable-class>myPackage.myClass</variable-class>
        <declare>true</declare>
        <scope>NESTED</scope>
      </variable>
    </tag> Cheers,
    evnafets

  • How Can I execute a java program using java code?

    {color:#000000}Hello,
    i am in great trouble someone please help me. i want to execute java program through java code i have compiled the java class using Compiler API now i want to execute this Class file through java code please help me, thanks in advance
    {color}

    Thanks Manko.
    i think my question was not clear enough.. actually i want to run this class using some java code . like any IDE would do i am making a text editor for java, as my term project i have been able to complie the code usign compiler api and it genertaes the class file but now i want to run this class file "THROUGH JAVA CODE" instead of using Java command. I want to achive it programatically. do you have any idea about it.. thanks in advance

Maybe you are looking for

  • Cannot delete file from iPod

    I use my iPod as a portable storage device for avi files, but I cannot seem to delete one of the files. There was an error when I captured this file live via firewire, so it has a filename but its size is 0kb. After going to My Computer, Drive F:, I

  • Unmountable_boot_volume error message - XP refuses to boot

    When attempting to boot a Satellite Pro A60 I get an unmountable_boot_volume error message on a blue screen and the PC loops without booting. It will not boot in Safe Mode, nor boot from the Last Working Configuration. It is running Windows XP Profes

  • Inserting strings in a database

    Hello all! I am trying to insert string values in a database with this metode.     public void insertData(){    try{ String url = "jdbc:odbc":"+database; Connection connection = DriverManager.getConnection(url, user, password); Statement status = con

  • Web service report problem

    Hi All. I am trying to get a report based on a web service to work. I have created my web service and page as per the instructions in http://download.oracle.com/docs/cd/E14373_01/appdev.32/e13363/web_serv.htm#CHDIDJFH. When I test my web service in a

  • ITunes error message:  The Network Connection Timed Out???

    New 30GB and Nano for Christmas. Per the instructions, I downloaded the Itunes update, 7.0.2. Since then, we can't get on Itunes store. Apple support said the site was too busy. I've downloaded it on my work computer and laptop and the store opens, b