Page 2 of 3 FirstFirst 123 LastLast
Results 21 to 40 of 51
  1. #21
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  2. #22
    fiqueudrue's Avatar
    fiqueudrue is offline Member
    Join Date
    Dec 2008
    Location
    Singapore
    Posts
    55
    Rep Power
    0

    Default

    i manage to debug this code and remove the sqldata overflow error.
    but right now, im not be able to show the result

    public String btnResult_action() {

    try {

    org.hogauctionwebservice.AuctionServiceSoap port = service.getAuctionServiceSoap();

    javax.xml.datatype.XMLGregorianCalendar dtStart;
    dtStart = javax.xml.datatype.DatatypeFactory.newInstance().n ewXMLGregorianCalendar();

    javax.xml.datatype.XMLGregorianCalendar dtEnd ;
    dtEnd = javax.xml.datatype.DatatypeFactory.newInstance().n ewXMLGregorianCalendar();

    Date st = cldStart.getSelectedDate();
    Date en = cldEnd.getSelectedDate();

    java.util.Calendar stc = java.util.Calendar.getInstance();
    stc.setTime(st);

    java.util.Calendar enc = java.util.Calendar.getInstance();
    enc.setTime(en);

    int day = stc.get( stc.DAY_OF_MONTH);
    int month = stc.get(stc.MONTH);
    int year = stc.get( stc.YEAR);

    int eDay = enc.get(enc.DAY_OF_MONTH);
    int eMonth = enc.get(enc.MONTH);
    int eYear = enc.get( enc.YEAR);

    dtStart.setDay(day);
    dtStart.setMonth(month);
    dtStart.setYear(year);

    dtEnd.setDay(eDay);
    dtEnd.setMonth(eMonth);
    dtEnd.setYear(eYear);

    org.hogauctionwebservice.ArrayOfAveragePricePerDay result = port.getHogAuctionPrices(dtStart, dtEnd);

    List<org.hogauctionwebservice.AveragePricePerDay> d = result.getAveragePricePerDay();

    for(int i = 0; i < d.size(); i++){
    org.hogauctionwebservice.AveragePricePerDay tm = d.get(i);
    lblResult.setText("Transaction ID = " + tm.getTransactionID() + " Date = " + tm.getDate() + " Average Price = " + tm.getAvePrice().toString());

    }

    } catch (Exception ex) {
    lblEx.setText(ex);
    }

    return null;
    }

  3. #23
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Lol, you should explain what happen more clearly. Reason is that I cannot test your code and see what happen. Only thing I can do is just go through the code see what can be happen.

    You saying that still cannot get the current date time?

  4. #24
    fiqueudrue's Avatar
    fiqueudrue is offline Member
    Join Date
    Dec 2008
    Location
    Singapore
    Posts
    55
    Rep Power
    0

    Default

    haha .. ok.
    now, i manage to debug and the code manage to get the date to process.

    but it did not step into this code:

    for(int i = 0; i < d.size(); i++){
    org.hogauctionwebservice.AveragePricePerDay tm = d.get(i);
    lblResult.setText("Transaction ID = " + tm.getTransactionID() + " Date = " + tm.getDate() + " Average Price = " + tm.getAvePrice().toString());
    }


    however, it straight away jump to this line:

    } catch (Exception ex) {
    lblEx.setText(ex);
    }
    Last edited by fiqueudrue; 12-30-2008 at 02:05 AM.

  5. #25
    fiqueudrue's Avatar
    fiqueudrue is offline Member
    Join Date
    Dec 2008
    Location
    Singapore
    Posts
    55
    Rep Power
    0

    Default

    i150.photobucket.com/albums/s90/fiqueudrue/ss.jpg

    this is my gui with the catch exception with error msg.
    Last edited by fiqueudrue; 12-30-2008 at 02:04 AM.

  6. #26
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Quote Originally Posted by fiqueudrue View Post
    haha .. ok.
    now, i manage to debug and the code manage to get the date to process.

    but it did not step into this code:

    for(int i = 0; i < d.size(); i++){
    org.hogauctionwebservice.AveragePricePerDay tm = d.get(i);
    lblResult.setText("Transaction ID = " + tm.getTransactionID() + " Date = " + tm.getDate() + " Average Price = " + tm.getAvePrice().toString());
    }


    however, it straight away jump to this line:

    } catch (Exception ex) {
    lblEx.setText(ex);
    }
    Did you debug this code and find that on which line cause for this exception?

    Is this your package? Basically I think this is a class you have, right?

    Java Code:
    org.hogauctionwebservice.AveragePricePerDay
    If so tm is an object. What your collection framework d returns there.

  7. #27
    fiqueudrue's Avatar
    fiqueudrue is offline Member
    Join Date
    Dec 2008
    Location
    Singapore
    Posts
    55
    Rep Power
    0

    Default

    hey bro, i manage to fixed the exception catch.
    but now, it did not show my result.

    basically, the debugger manage to step into the green colored text.
    but then it would not step into the red colored text and skip straight away to the orange colored text and the exception did not state any error, just blank also

    for(int i = 0; i < d.size(); i++){
    org.hogauctionwebservice.AveragePricePerDay tm = d.get(i);
    lblResult.setText("Transaction ID = " + tm.getTransactionID() + " Date = " + tm.getDate() + " Average Price = " + tm.getAvePrice().toString());
    lblResult.setText(tm.getAvePrice() + tm.getDate());


    }

    } catch (Exception ex) {
    lblEx.setText(ex);
    }
    Last edited by fiqueudrue; 12-30-2008 at 02:34 AM.

  8. #28
    fiqueudrue's Avatar
    fiqueudrue is offline Member
    Join Date
    Dec 2008
    Location
    Singapore
    Posts
    55
    Rep Power
    0

    Default

    this is my package

    package hogauctionwebservice;

    import com.sun.rave.web.ui.appbase.AbstractPageBean;
    import com.sun.webui.jsf.component.Button;
    import com.sun.webui.jsf.component.Calendar;
    import com.sun.webui.jsf.component.Label;
    import java.util.Date;
    import java.util.GregorianCalendar;
    import java.util.List;
    import javax.faces.FacesException;
    import javax.xml.ws.WebServiceRef;
    import org.hogauctionwebservice.AuctionService;




    and d collection should return (from wsdl):

    <s:complexType name="AveragePricePerDay">
    <s:sequence>
    <s:element minOccurs="1" maxOccurs="1" name="transactionID" type="s:int" />
    <s:element minOccurs="1" maxOccurs="1" name="avePrice" type="s:decimal" />
    <s:element minOccurs="0" maxOccurs="1" name="date" type="s:string" />
    </s:sequence>
    </s:complexType>
    Last edited by fiqueudrue; 12-30-2008 at 02:35 AM.

  9. #29
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Quote Originally Posted by fiqueudrue View Post
    hey bro, i manage to fixed the exception catch.
    but now, it did not show my result.

    basically, the debugger manage to step into the green colored text.
    but then it would not step into the red colored text and skip straight away to the orange colored text and the exception did not state any error, just blank also

    for(int i = 0; i < d.size(); i++){
    org.hogauctionwebservice.AveragePricePerDay tm = d.get(i);
    lblResult.setText("Transaction ID = " + tm.getTransactionID() + " Date = " + tm.getDate() + " Average Price = " + tm.getAvePrice().toString());
    lblResult.setText(tm.getAvePrice() + tm.getDate());


    }

    } catch (Exception ex) {
    lblEx.setText(ex);
    }
    What's the error you have on that for loop. I don't see any difference on this post and previous post.

  10. #30
    fiqueudrue's Avatar
    fiqueudrue is offline Member
    Join Date
    Dec 2008
    Location
    Singapore
    Posts
    55
    Rep Power
    0

    Default

    Quote Originally Posted by Eranga View Post
    What's the error you have on that for loop. I don't see any difference on this post and previous post.
    yea cos i edited this line here in the forum but not in the code:

    for(int i = 0; i <= d.size(); i++){
    org.hogauctionwebservice.AveragePricePerDay tm = d.get(i);
    lblResult.setText("Transaction ID = " + tm.getTransactionID() + " Date = " + tm.getDate() + " Average Price = " + tm.getAvePrice().toString());
    }

  11. #31
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Now what you say is on that lblResult label doesn't show the result, is it? First of all check that all methods you call there return the correct data types. ie: tm.getTransactionID() and tm.getDate()

  12. #32
    fiqueudrue's Avatar
    fiqueudrue is offline Member
    Join Date
    Dec 2008
    Location
    Singapore
    Posts
    55
    Rep Power
    0

    Default

    Quote Originally Posted by Eranga View Post
    Now what you say is on that lblResult label doesn't show the result, is it? First of all check that all methods you call there return the correct data types. ie: tm.getTransactionID() and tm.getDate()
    err .. how to check?
    cause when i debug, it wun even step into:
    tm.getDate(); or tm.getTransactionID();

  13. #33
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Read more about that on the document. Or simply go to the source code and see what's it return.

    Are you working on any IDE or on the command prompt?

  14. #34
    fiqueudrue's Avatar
    fiqueudrue is offline Member
    Join Date
    Dec 2008
    Location
    Singapore
    Posts
    55
    Rep Power
    0

    Default

    Quote Originally Posted by Eranga View Post
    Read more about that on the document. Or simply go to the source code and see what's it return.

    Are you working on any IDE or on the command prompt?
    doing Visual Web jsf with/using netbeans IDE 6.5

  15. #35
    fiqueudrue's Avatar
    fiqueudrue is offline Member
    Join Date
    Dec 2008
    Location
    Singapore
    Posts
    55
    Rep Power
    0

    Default

    when i right click, go to definitioin/source, it show this for both:

    public String getDate() {
    return date;
    }

    public int getTransactionID() {
    return transactionID;
    }

  16. #36
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Then IDE should be pointed the error if have done anything in your code. Didn't you get any error message?

  17. #37
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Quote Originally Posted by fiqueudrue View Post
    when i right click, go to definitioin/source, it show this for both:

    public String getDate() {
    return date;
    }

    public int getTransactionID() {
    return transactionID;
    }
    It's fine. Then you have to check on the first line of code.

    Java Code:
    org.hogauctionwebservice.AveragePricePerDay tm = d.get(i);
    Debug and see what values it's return.

    And also, you are working on a for loop with a collection call d what the size of it. Say you have size of 100, what happen, in very short period of time that for loop is executed and it can mess to set the text as well. Actually it's depends with your implementation.

  18. #38
    fiqueudrue's Avatar
    fiqueudrue is offline Member
    Join Date
    Dec 2008
    Location
    Singapore
    Posts
    55
    Rep Power
    0

    Default

    this is the requirement:

    Test Client for HogAuction WebService
    =========================================
    TEST INPUT : Start Date 17 MAR 2008
    TEST INPUT : End Date 20 MAR 2008

    EXPECTED OUTPUT :

    DATE AVERAGEPRICEPERKG
    2008/03/17 2.96
    2008/03/18 3.15
    2008/03/19 3.21
    2008/03/20 3.21

  19. #39
    fiqueudrue's Avatar
    fiqueudrue is offline Member
    Join Date
    Dec 2008
    Location
    Singapore
    Posts
    55
    Rep Power
    0

  20. #40
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Quote Originally Posted by fiqueudrue View Post
    this is the requirement:

    Test Client for HogAuction WebService
    =========================================
    TEST INPUT : Start Date 17 MAR 2008
    TEST INPUT : End Date 20 MAR 2008

    EXPECTED OUTPUT :

    DATE AVERAGEPRICEPERKG
    2008/03/17 2.96
    2008/03/18 3.15
    2008/03/19 3.21
    2008/03/20 3.21
    You said that the result format is not what you expecting?

    What that images explain, not clear those things.

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Is it possible to code like this?
    By Orange in forum New To Java
    Replies: 8
    Last Post: 08-13-2008, 10:29 AM
  2. Need help with web code
    By nemutah1 in forum New To Java
    Replies: 1
    Last Post: 07-10-2008, 08:33 PM
  3. I need help fixing my code.. or non code?
    By MrHuggykins in forum New To Java
    Replies: 1
    Last Post: 03-19-2008, 10:12 PM
  4. tic tac toe code
    By zoe in forum New To Java
    Replies: 1
    Last Post: 07-23-2007, 04:36 PM
  5. Replies: 1
    Last Post: 04-26-2007, 03:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •