Please help to use my class in a JSP

Hi
Please could someone help me i've started a new job and need to create like a "Add to shortlist" functionality to their website.
I have created a class to create a cookie using the offerid specific to that page which is done in the doGet() method.
Now, the problem is that i don't know how to basically make the cookie be created when the button is pressed.
I have thought of using <jsp:useBean> and putting my class in there but don't know how to call the doGet() method, if you know what i mean.
Otherwise i've thought of doing the cookie creating in the JSP but then also i don't know how to make by the click of a button, it creates a cookie with that offerid.
PLEASE help!? If you need more info pls let me know,
Btw i am new to this so sorry if this sounds stupid, but thanks in advance for ANY help!

There is only one thing to do in your case: hit the books and learn how to properly program servlets and JSPs - until you know at least the very basics (clicking a button and "doing something" falls in that category), it will be impossible to guide you to anything productive. I've seen it happen before many times; an answer is given, the answer is not understood and then the demand for "sample code" pops up, after which it all goes downhill fast.
I always recommend this free online book, because it is quite good:
[http://pdf.coreservlets.com/|http://pdf.coreservlets.com/]
If you buckle down, you should be able to get things up and running in a few days. Good luck!

Similar Messages

  • I have updated my iPhone 4s to iOS7 but when i connect it to itunes on my PC it give me a msg to restore your iPhone in summary tab, Please help m using win 7 and updated itunes.

    I have updated my iPhone 4s to iOS7 but when i connect it to itunes on my PC it give me a msg to restore your iPhone in summary tab, Please help m using win 7 and updated itunes.

    What is showing on the screen of the iPhone?
    Does iTunes say the iPhone is in recovery mode?

  • I have to upload video from my hewlett packard t200 camcorder to my mac. but mac won't recognize the camcorder files. i even bought flip4mac by tele stream which so far is useless. please help me use my camcorder with my iMac os mountain lion 10.8.2

    i have to upload video from my hewlett packard t200 camcorder to my mac. but mac won't recognize the camcorder files. i even bought flip4mac by tele stream which so far is useless. please help me use my camcorder with my iMac os mountain lion 10.8.2
    i tried to get the installation disc for the camcorder but mac wont' recognize it becaue it is windows based i guess.
    i just bought the camcorder a few months ago and when my computer crashed thought i'm finally getting a mac...it's been a costly venture which has resulted in more frustration than before my pc.
    now the things i want to use with my mac that i thought would be even simpler...are not even useable...
    help

    That camera shoots H.264 in an .avi wrapper.
    You will have to transfer the files via the Finder.
    Get a free copy of MPEG Streamclip and convert them to QuickTime .mov using the H.264 codec if you are presumably editing in iMovie.
    Note that your list of video codecs won't look like mine as I have Final Cut Pro, but H.264 is definitely an option for you.

  • I have been able to access a site regularly but in the last few days get a message: "cookies required to access this site." please help, I use this site for work daily:)

    I have been able to access a site regularly but in the last few days get a message: "cookies required to access this site." please help, I use this site for work daily:)

    Goto > Settings > Safari... Enable Cookies > Always
    Good luck!

  • Please help. Using Ipad 2 . No connection error iPad 2 Wi-Fi, iOS 7

    Please help. Using Ipad 2 . No connection error
    iPad 2 Wi-Fi, iOS 7
    how to start back my i pad

    Please see: iOS: Restore errors 4005, 4013, and 4014
    Regards,
    Steve

  • Please help, i used to have various colors to select from when selecting FILL in Keynote such as red, now I only have a few pastel colors. I cannot seem to fix this problem to get the original colors back. Can someone please advise what I need to do.

    Please help, i used to have various colors to select from when selecting FILL in Keynote such as red, now I only have a few pastel colors. I cannot seem to fix this problem to get the original colors back. Can someone please advise what I need to do.

    i have on my ipad2 and re-download it - but I can't afford to loose the presentation that I currently have ....??
    Are you using Keynote on an iPad?
    If so you posted in the wrong forum, this is the Keynote Mac discussion and it is a different application. I dont know how the iPad works at all, so I cant help you, post in the Keynote iOS discussion.
    If you are using a Mac, the colours palette is accesed by clicking on the colour well (arrowed) and then selecting a colour chip or changing the color in the colour wheel.

  • Using normal classes in a JSP

    I have written a library of classes for use in a standard application. In a completely separate project I need to use these classes in a JSP page. Under %tomcat/webapps/myproject is the JSP file. Where do I place the "normal" class files and how do I reference them in the JSP page? Do I need to import them or add them to the classpath and should they be pre-compiled ?
    All help most appreciated
    Thanks
    Bob

    Where do I place the "normal" class files and how do
    I reference them in the JSP page?Just like you use any other class in a JSP.
    Do I need to import them or add them to the classpath and should they be pre-compiled ?Yes, yes and yes. The first thing is something you need to do for your stuff to compile (technically, you don't need to do it, but it's better than always using the fully qualified class names in the code). The second is something the servlet container will do for you when you deploy your WAR. The this is something you need to do with classes anyway. You don't need to do it for JSPs because the container will do it later, but that's all the difference there is.

  • Please help me for Calendar class

    Now i am working in SAP.Now we are doing Internal project for Company Timesheet of the employee,they are using Java,javascript,html,jsp,mysql.
    Please give Support for developing this task
    I am trying to do employee's timesheet( i.e. daily working hours).Here i attach my documents.here in that screen i am selecting fig1 calendar date for 19th july 2006 now we can see it in fig2 there we will see 15th july 2006 to 21st july 2006 is visible. The scnario is when ever we select the any of the day of the week we need to display whole week sun,mon to sat.
    when i am selecting (select week days by using javascript) total weekly working hours should come.please guide me and give me sample code.
    I think you understand what i am asking. using javascript calendar i am selecting the date.and from database i have to get the daily working hours of the perticular employee. I am not so familiar in java,that's why only i am asking .Please help me
    Advance thanks for You
    code i am pasting here
    thanks&Regards
    Vijaya
    ********** Java code******************
    import java.util.Calendar;
    import java.util.Date;
    class FirstAndLastDay4
    public static void main(String[] args)
    //int i=1;
    try{
    Calendar date=Calendar.getInstance();
    int day = date.get(Calendar.DAY_OF_WEEK);
    switch(day){
    case(1):
    { System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK));
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    break;
    case(2):
    { System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)-1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    break;
    case(3):
    { System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)-2);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    break;
    case(4):
    { System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)-3);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    break;
    case(5):
    { System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)-4);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    /*for(int i=0,j=1;i<7;i++)
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+i);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    break;
    case(6):
    { System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)-5);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+6);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    break;
    case(7):
    { System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)-6);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+6);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+1);
    System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
    break;
    }catch(Exception e){
    e.printStackTrace();
    }

    Hi All,
    I am trying to do employee's timesheet( i.e. daily working hours).Here i attach my documents.here in that screen i am selecting fig1 calendar date for 19th july 2006 now we can see it in fig2 there we will see 15th july 2006 to 21st july 2006 is visible. The scnario is when ever we select the any of the day of the week we need to display whole week sun,mon to sat.
    when i am selecting (select week days by using javascript) total weekly working hours should come.please guide me and give me sample code.
    Thanks in advance
    thanks & regards
    <code>
    import java.util.Calendar;
    import java.util.Date;
    class FirstAndLastDay
         public static void main(String[] args)
              try{
                   Calendar date=Calendar.getInstance();
                   int day = date.get(Calendar.DAY_OF_WEEK);
                   switch(day){
                        case(1):
                        {     System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK));
                             System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+6);                         
                             System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             break;
                        case(2):
                        {     System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)-1);
                             System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+6);                         
                             System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             break;
                        case(3):
                        {     System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)-2);
                             System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+6);                         
                             System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             break;
                        case(4):
                        {     System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)-3);
                             System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+6);                         
                             System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             break;
                        case(5):
                        {     System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)-4);
                             System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+6);                         
                             System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             break;
                        case(6):
                        {     System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)-5);
                             System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+6);                         
                             System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             break;
                        case(7):
                        {     System.out.println("\n Input date [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)-6);
                             System.out.println("First day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             date.set(Calendar.DAY_OF_WEEK, date.get(Calendar.DAY_OF_WEEK)+6);                         
                             System.out.println("Last day [" + new java.util.Date(date.getTimeInMillis()) + "]");
                             break;
              }catch(Exception e){
                   e.printStackTrace();
    </code>

  • Please Help - Permutations using recursion..

    Please some body help me in generating permutaions using recursion..exact guidelines are as follows..
    Producing consecutive permutations.Need to develop a method that lists one by one all permutations of the numbers 1, 2, �, n (n is a positive integer).
    (a) Recursive method . Given a verbal description of the algorithm listing all permutations one by one, you are supposed to develop a recursive method with the following header:
    public static boolean nextPermutation(int[] array)The method receives an integer array parameter which is a permutation of integers 1, 2, �, n. If there is �next� permutation to the permutation represented by the array, then the method returns true and the array is changed so that it represents the �next� permutation. If there is no �next� permutation, the method returns false and does not change the array.
    Here is a verbal description of the recursive algorithm you need to implement:
    1. The first permutation is the permutation represented by the sequence (1, 2, �, n).
    2. The last permutation is the permutation represented by the sequence (n, �, 2, 1).
    3. If n a ,...,a 1 is an arbitrary permutation, then the �next� permutation is produced by
    the following procedure:
    (i) If the maximal element of the array (which is n) is not in the first position of the array, say i n = a , where i > 1, then just swap i a and i-1 a . This will give you the �next� permutation in this case.
    (ii) If the maximal element of the array is in the first position, so 1 n = a , then to find
    the �next� permutation to the permutation ( ,..., ) 1 n a a , first find the �next�
    permutation to ( ,..., ) 2 n a a , and then add 1 a to the end of thus obtained array of (n-1) elements.
    (iii) Consecutively applying this algorithm to permutations starting from (1, 2, �, n),you will eventually list all n! possible permutations. The last one will be (n, �, 2, 1).For example, below is the sequence of permutations for n = 3 .
    Please help...i have trying this for long time
    plesae help...i apreciate your time..and help..thank you

    public class Permu {
        public static boolean nextPermutation(int a[]) {
                return(permute(a, 0));
        public static boolean permute(int v[], int start) {
             int n = v.length;
             if (start == (n - 1)) {       //if its the end of the sequence genereated then print them
                count++;
                //print(v,n);
                return false;
            } else {
                for (int i = start; i < n; i++) { //swap the start element with the ith element to get n first sequeces
                    int temp = v[start];
                    v[start] = v;
    v[i] = temp;
    permute(v, start + 1);
    //of the n the first is kept constant the same is applied for the rest sequence
    //int tmp = v[i];
    v[i] = v[start];
    v[start] = temp;
    return true;
         public static void main(String[] args) {
    int v[] = {1, 2};//this is the array which should contain the items      to be permuted
    do{
    for(int i=0;i<2;i++)
    System.out.print(v[i]);
    System.out.println();
    }while(nextPermutation(v));
    [i]Output:
    123
    123
    123
    123
    123
    This is exact code i am trying to run...pls someone help me out...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Help for using java class in forms 9i

    hi
    i have been trying to use java class in forms9i but unable to execute ,i have encountered exceptions,for which exception handlers have been declared like ora_java.java_error and exception_thrown but failed to handle run time errors , i have tried all ways from my side.
    my java class returns a simple string
    i need help on various work arounds
    thanks in advance
    yash

    sir
    i have written a simple java class which returns a string hello imported using a java importer in forms 9i
    and i call my class in when button press trigger
    i have also imported java.lang.Exception for my exception handlers,i have no compile errors,but when i run my forms i get run time error and my exception handlers fail to trap it . ihave no idea how to proceed .
    should i use bean area in form and call the class using fbean from custom item rigger if so please explain
    can i get sample code example for calling a java class methods from forms.
    thanks
    yash

  • Please help with correcting calling class and method errors

    Hi All,
    I have created a game (like battleship) for 2 tanks. I can't seem to connect the classes and methods to get the values for the last die face rolled; last direction rolled on a 4 headed dice; the x and y position for each tank; the armour value and the firePower (or hit value) to print.
    Each row of these values is supposed to print 50 times using a while loop.
    (N.B. The code is appended below my name.)
    Could anyone please help me? I would be most grateful. Thank you.
    Steve
    import java.util.*;
    class Client
    static Die die;
    static Direction dir;
    static Tank tk1;
    static Tank tk2;
    public static final
    void main( String[] argv)
    die = new Die();
    dir = new Direction();
    tk1 = new Tank();
    tk2 = new Tank();
    int lastFace;
    int setfaceLast;
    int x;
    int y;
    int armourVal;
    int firePower;
    int battleNum=0;
    int battles;
    int moves = 0;
    System.out.println("Tank");
    System.out.println("'\t' Number");
    System.out.println("'\t' Dir");
    System.out.println("'\t' xValue");
    System.out.println("'\t' yValue");
    System.out.println("'\t' Armour");
    System.out.println("Firepower"+'\n');
    int i=0;
    //int getLastFace();
    //int LastDirName();
    while (i <= 50);
    int XPos;
    int YPos;
    Pos p = new Pos();
    p.setXPos(x);
    p.setYPos(y);
    System.out.println ("'\t' Tank 1-");
    //System.out.println ( die.getLastFace());
    //System.out.println( dir.getLastDirName());
    System.out.println(Pos(x));
    System.out.println(Pos(y));
    System.out.println(armourVal);
    System.out.println(firePower+'\n');
    System.out.println ("Tank 2-");
    System.out.println ( lastFace);
    //System.out.println(LastDir);
    System.out.println(x);
    System.out.println(y);
    System.out.println(armourVal);
    System.out.println(firePower+'\n');
    moves++;
    System.out.println(" '\n' + BATTLE");
    class Tank
    public static final int MINGRID;
    public static final int MAXGRID;
    static Die die = new Die();
    static Direction dir = new Direction();
    private static int battleCount;
    private static int moveCount;
    private int x;
    private int y;
    private int armourVal;
    private int firePower;
    public Tank()
    int MINGRID=-10;
    int MAXGRID=10;
    battleCount=0;
    moveCount=0;
    x=0;
    y=0;
    armourVal=10;
    firePower=1;
    public
    int getmove()
    die.roll();
    dir.roll();
    dir.getLastDir();
    die.getLastFace();
    int x;
    int y;
    int Pos;
    switch( dir.getLastDir() )
    case Direction.UP:
    y += die.getLastFace();
    break;
    case Direction.DOWN:
    y -= die.getLastFace();
    break;
    case Direction.RIGHT:
    x += die.getLastFace();
    case Direction.LEFT:
    x-= die.getLastFace();
    break;
    if ( x > MAXGRID )
    x = (2 * MAXGRID) - x;
    else if ( x < MINGRID )
    x = (-2 * MINGRID) - x;
    if ( y > MAXGRID )
    y = (-2 * MAXGRID) - y;
    else if ( y < MINGRID )
    y = (-2 * MINGRID) - y;
    if ( x == -3 && y == -3 )
    firePower++;
    System.out.println("Yipee - more firepower.");
    if ( x == 3 && y == 3)
    this.armourVal += 10;
    System.out.println("Yipee - more armour.");
    return Pos;
    //printDetails();
    public boolean getcontinueBattle(Tank tk2)
    moveCount++;
    if ( x == tk2.x && y == tk2.y)
    battleCount++;
    System.out.println("Battle");
    tk2.armourVal -= firePower;
    armourVal -= tk2.firePower;
    if (tk2.armourVal < 0 )
    int moveCount, battleCount;
    return false;
    if ( armourVal < 0 )
    int moveCount, battleCount;
    return false;
    return true;
    public int getprintDetails()
    int ptDet;
    return ptDet;
    class Direction
    private int lastFaceDir;
    private Random rnd;
    public static final int UP = 1;
    public static final int DOWN = 2;
    public static final int LEFT = 3;
    public static final int RIGHT = 4;
    String direction;
    private
    int getRandomNum()
    int raw = rnd.nextInt();
    raw = Math.abs( raw );
    raw %= 4;
    raw++;
    return raw;
    public
    Direction()
    rnd = new Random();
    roll();
    public
    int roll()
    lastFaceDir = getRandomNum();
    if (lastFaceDir == UP)
    direction = "up";
    else if (lastFaceDir == DOWN)
    direction= "down";
    else if (lastFaceDir == LEFT)
    direction = "left";
    else if (lastFaceDir == RIGHT)
    direction= "right";
    return lastFaceDir;
    public
    int getLastFaceDir()
    return lastFaceDir;
    }// end class
    class Die
    private int lastFace;
    private Random rnd;
    private
    int getRandomNum()
    int raw = rnd.nextInt();
    raw = Math.abs( raw );
    raw %= 6;
    raw++;
    return raw;
    public
    Die()
    rnd = new Random();
    roll();
    public
    int roll()
    lastFace = getRandomNum();
    return lastFace;
    public
    int getLastFace()
    return lastFace;
    }// end class

    I got this sorted!
    I unzipped the JAR and loaded the classes individually - so now the "reference" issue went away. Instead I now have a new problem, but I will post that seperately.

  • Need help in using Runtime class

    Hi all,
    I am facing problem with JRE versions of websphere and SUN JRE. Let me explain my problem.
    We have an application working fine in websphere, Now my organization wants to migrate this app to websphere. This application downloads some set of jar files to the client side when the user hits the server with some url. These jar files starts th swing based application in the client side , at the same it will try to communicate with EJB's deployed in the server(Now websphere) to get the data for menus and trees in the swing application. Because of different JRE in the websphere commucation problems like class cast exception are happening. Now we are downloading the the Websphere JRE to the client side and trying to start the application with the downloaded JRE(Even it is not required in case of weblogic in the exiting application also they are downloading the sun JRE). Here the problem starts for me. The execute method of Process class is not able to detect the main class. The waitFor method is returning non zero value. Here is my method.
    Can anybody guess what's wrong going on with this code.
    public Process spawnProcess(String szSpawnCommand) throws
    Exception
              szSpawnCommand = "C:\\ccc\\JRE\\bin\\javaw.exe com.att.suite.client.SuiteAppManager";
              System.out.println("starting processs "+szSpawnCommand);
    Process oProcess = null;
    try
    // oProcess = Runtime.getRuntime().exec(szSpawnCommand);
         Runtime rt = Runtime.getRuntime();
         System.out.println("Got runtime.....");
         oProcess = rt.exec("c:/ccc/JRE/bin/java com.att.suite.client.SuiteAppManager");
         //oProcess.waitFor();
    //oProcess = rt.exec("c:/ccc/JRE/bin/javaw -version");
    catch (Exception ex)
    // Throw an exception with the reason why the process
    // couldn't be spawned
    // The original message here confused end users - almost always
    // occurs due to lack of memory and we cannot determine actual
    // reason OS failed to spawn a process.
    // Changed to correct LCR MR#: 437
    // throw new Exception("Unable to spawn process with command: \"" +
    // szSpawnCommand + "\".\nSystem Reason: " + ex.getMessage());
    /*throw new Exception("You have insufficient memory to " +
    "launch this program. \nPlease quit some other " +
    "applications and try again.");*/
         System.out.println("In oProcess.... ");
    ex.printStackTrace();
    // Wait for a second to give the new process a chance
    // to run properly
    try
    Thread.sleep(1000);
    catch (Exception ex)
    final DataInputStream oProcStdOutStream = new DataInputStream(
    oProcess.getInputStream());
    final DataInputStream oProcStdErrStream = new DataInputStream(
    oProcess.getErrorStream());
    Thread oProcStdOutStreamThread = new Thread()
    public void run()
    try
    String szLine = null;
    while ((szLine = oProcStdOutStream.readLine()) != null)
    System.out.println("[FromProc1] " + szLine);
    catch (Exception ex)
         System.out.println("In oProcStdOutStream");
    ex.printStackTrace();
    oProcStdOutStreamThread.start();
    Thread oProcStdErrStreamThread = new Thread()
    public void run()
    try
    String szLine;
    while ((szLine = oProcStdErrStream.readLine()) != null)
    System.out.println("[FromProc2] " + szLine);
    catch (Exception ex)
    ex.printStackTrace();
    oProcStdErrStreamThread.start();
    // See if the process is still running properly
    int nProcessExitValue = 0;
    try
    nProcessExitValue = oProcess.exitValue();
         // nProcessExitValue = oProcess.waitFor();
         System.out.println("nProcessExitValue : "+nProcessExitValue);
    catch (Exception ex)
    // This means that the process is still running which
    // we'll consider a good sign.
    nProcessExitValue = 0;
    System.out.println("In nProcessExitValue");
    ex.printStackTrace();
    // Check the process exit value
    if (nProcessExitValue != 0)
    // Throw an exception with the return value of the spawned
    // process.
    // The original message here confused end users - almost always
    // occurs due to lack of memory and we cannot determine actual
    // reason OS failed to spawn a process.
    // Changed to correct LCR MR#: 437
    // throw new Exception("Unable to spawn process with command: \"" +
    // szSpawnCommand + "\".\nProcess Exit Value: " +
    // nProcessExitValue);
    throw new Exception("You have insufficient memory to " +
    "launch this program. \nPlease quit some other " +
    "applications and try again.");
         //System.out.println("In nProcessExitValue!=0");
    Here is the error :
    starting processs C:\ccc\JRE\bin\javaw.exe com.att.suite.client.SuiteAppManager
    Class loaded...
    Got runtime.....
    nProcessExitValue : 1
    [FromProc2] The java class is not found: com/att/launch/jre/Sample
    java.lang.Exception: You have insufficient memory to launch this program.
    Please quit some other applications and try again.
         at com.att.launch.jre.LaunchApp.spawnProcess(LaunchApp.java:525)
         at com.att.launch.jre.LaunchApp.spawnCJAS(LaunchApp.java:366)
         at com.att.launch.jre.LaunchApp.main(LaunchApp.java:171)
    Please help me, I am struggling with this problem from the long time. Or can any body suggest different way to solve this problem instead of downloading the JRE to the client side.
    Bhaskar

    Hi ,
    I am facing problem with JRE versions of websphere and SUN JRE. Let me explain my problem.
    We have an application working fine in websphere, Now my organization wants to migrate this app to websphere. This application downloads some set of jar files to the client side when the user hits the server with some url. These jar files starts th swing based application in the client side , at the same it will try to communicate with EJB's deployed in the server(Now websphere) to get the data for menus and trees in the swing application. Because of different JRE in the websphere commucation problems like class cast exception are happening.
         Now we are downloading the the Websphere JRE to the client side and trying to start the application with the downloaded JRE(Even it is not required in case of weblogic in the exiting application also they are downloading the sun JRE).
    Here the problem starts for me. The execute method of Process class is not able to detect the main class. The waitFor method is returning non zero value. Here is my method.
    Can anybody guess what's wrong going on with this code
    public Process spawnProcess(String szSpawnCommand) throws
    Exception
              System.out.println("starting processs "+szSpawnCommand);
    Process oProcess = null;
    try
         Runtime rt = Runtime.getRuntime();
         System.out.println("Got runtime.....");
         oProcess = rt.exec("c:/ccc/JRE/bin/java com.att.suite.client.SuiteAppManager");
    catch (Exception ex)
    throw new Exception("You have insufficient memory to " +
    "launch this program. \nPlease quit some other " +
    "applications and try again.");      
    // Wait for a second to give the new process a chance
    // to run properly
    try
    Thread.sleep(1000);
    catch (Exception ex)
    final DataInputStream oProcStdOutStream = new DataInputStream(oProcess.getInputStream());
    final DataInputStream oProcStdErrStream = new DataInputStream(oProcess.getErrorStream());
    Thread oProcStdOutStreamThread = new Thread()
    public void run()
    try
    String szLine = null;
    while ((szLine = oProcStdOutStream.readLine()) != null)
    System.out.println("[FromProc1] " + szLine);
    catch (Exception ex)
         System.out.println("In oProcStdOutStream");
    ex.printStackTrace();
    oProcStdOutStreamThread.start();
    Thread oProcStdErrStreamThread = new Thread()
    public void run()
    try
    String szLine;
    while ((szLine = oProcStdErrStream.readLine()) != null)
    System.out.println("[FromProc2] " + szLine);
    catch (Exception ex)
    ex.printStackTrace();
    oProcStdErrStreamThread.start();
    // See if the process is still running properly
    int nProcessExitValue = 0;
    try
    nProcessExitValue = oProcess.exitValue();
         // nProcessExitValue = oProcess.waitFor();
         System.out.println("nProcessExitValue : "+nProcessExitValue);
    catch (Exception ex)
    // This means that the process is still running which
    // we'll consider a good sign.
    nProcessExitValue = 0;
    System.out.println("In nProcessExitValue");
    ex.printStackTrace();
    // Check the process exit value
    if (nProcessExitValue != 0)
    throw new Exception("You have insufficient memory to " +
    "launch this program. \nPlease quit some other " +
    "applications and try again.");
    Here is the error :
    starting processs C:\ccc\JRE\bin\javaw.exe com.att.suite.client.SuiteAppManager
    Class loaded...
    Got runtime.....
    nProcessExitValue : 1
    [FromProc2] The java class is not found: com/att/launch/jre/Sample
    java.lang.Exception: You have insufficient memory to launch this program.
    Please quit some other applications and try again.
         at com.att.launch.jre.LaunchApp.spawnProcess(LaunchApp.java:525)
         at com.att.launch.jre.LaunchApp.spawnCJAS(LaunchApp.java:366)
         at com.att.launch.jre.LaunchApp.main(LaunchApp.java:171)
    Please help me, I am struggling with this problem from the long time. Or can any body suggest different way to solve this
    problem instead of downloading the JRE to the client side.
    Bhaskar

  • Please help! using a macbook pro mid 2010 with 10.9.2 maverick and bootcamp 5.1.2 - I want to have Windows on my notebook. I have a Windows 8.1 AIO x64.ISO - just an iso, i dont have a Win DVD!

    Hi guys
    I tried the last two days everything from this forum. Run bootcamp, after restart (hold alt) go to the mac HD and delete or replace the bootcamp device (tried both options). had it almost done, at the end when it was installing/finnishing windows the error code "could not prepare the computer to boot into the next phase...... " and of course after that the "no bootable device insert boot disk and press any key boot camp".
    Please help me to fix this thing!
    Thanks a lot!
    hopelessdumb

    Please only use 1 thread https://discussions.apple.com/message/25160426#25160426

  • Please help. im using a macbook pro versian 10.6.8 every website works on the laptop except for facebook for some reason anyone know why?

    its been a couple days now since my macbooks been playing up someone please help me. ive got firefox, google chrome etc none of them are loading facebook every other websites works fine, facebook takes 5 minutes to load and it goes to a mobile website without loading anyone know why? im using a macbook pro 2011 with ios 10.6.8

    Make sure your Java and Flash are up to date from http://www.java.com/ and http://www.adobe.com/
    Clear your cookies for Facebook as long as you remember the password for it.
    Try a different web browser * if none of the above work.

  • Please help with writing a class

    i need help getting started with this assignment. i haven't done anything with writing classes, so i don't know where to start.
    i need to create a bank account class that will keep a name, balance, up to 50 deposits, and up to 50 withdrawls. i need to include 2 arrays for the deposits and withdrawls.
    Here's what i know:
    I need a constructor that takes zero arguments. This constructor would initialize the numeric value to zero.
    I need a 2nd constructor that takes one argument, a name as a String value. This constructor would initialize the numeric value to zero.
    I need a 3rd constructor that takes two arguments, a name as a String value and a starting "balance" as a double value

    Sorry, I was watching a movie with my wife ...imagine that. Study my examples here and try to understand what I have done. You will follow the same methodology for the rest of the program. Use main to test the methods in your program.
    public class mdlAccount {
      String name;
      double balance;
      int currentDeposit = 0;
      int currentWithdrawl = 0;
      double[] deposits = new double[50];
      double[] withdrawals = new double[50];
      public mdlAccount() {
        name = "";
        balance = 0.0;
      public mdlAccount(String name) {
        this.name = name;
        balance = 0.0;
      public mdlAccount(String name, double balance) {
        this.name = name;
        this.balance = balance;
      // When the instructor says: Have a method that does deposits...
      // You need to create a method, similar to the constructors,
      // but with a return value, even if it returns void (nothing).
      // Like this:
      public void deposit( double amount ) {
        // Do some error checking.
        if ( currentDeposit < 50 && amount > 0 ) { // > is a greater than sign
          // If all is ok, add to the balance...
          balance += amount;
          // and add the entry to the array of deposits
          deposits[currentDeposit] = amount;
          // Finally, add 1 to the currentDeposit variable.
          currentDeposit++;
      // We need the 'return the balance' method so we can see if
      // the program runs correctly. This time we return a double,
      // instead of void. (void means don't return anything at all).
      public double getBalance() {
        return balance;
    // Now you create the next method for withdrawals...
    //  if ( currentWithdrawl < 50 ) {
    //    deposits[currentWithdrawl] = amount;
    //    currentWithdrawl++;
      // You want a main method so this class can be executed.
      // You can remove it later if you want to use this class
      // from within another larger program.
      public static void main(String[] args) {
        mdlAccount acct = new mdlAccount( "GumB", 100.0 );
        System.out.println("Initial balance is " + acct.getBalance());
        acct.deposit( 50.0 );
        System.out.println("Current balance is " + acct.getBalance());

Maybe you are looking for

  • Adobe Premiere Tech Problems

    Mid project editing a short film when the video files werent visible to edit.  Saved my project and closed the program.  When I went to re-open Adobe Premiere nothing happens.  There is no error message just nothing.  ADobe Cloud Desktop told me ther

  • Ipod cannot be recognized and a weird symbol!

    I accidentally dropped my ipod on the ground once. Then after that, my ipod cannot be recognized by my computer.It has been ttached to the computer for nearly an hour and nothing has happened. Usually, my computer recognizes my ipod and then itunes s

  • How to merge two Apple accounts by migration

    Hello to you all My question relates about merging two apple accounts. Having two accounts is an issue (for instance when you start setting up Family sharing, or trying to get phone calls on your Mac) As we know, merging two accounts is alas (still ?

  • Af:clientlistener not working in af:column header

    Hi I am using jdeveloper 11.1.1.5.0 and my browser is IE 8. i have added client listener property in af:column to show the tooltip message on 'mouseover' action. This property is working fine If i am using inside the af:inputDate components. but, sam

  • List of records in one field

    Hi All, I have a requirement which I am not sure if can be done. To simply the stuff, assume I have a field which gives me the PO number. I have a VO which has some query in the results table based on that PO. Now I need that PO field to be such that