Results 21 to 40 of 51
Thread: Help: strike out in my code
- 12-29-2008, 03:12 AM #21
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
So the time you get there is not valid. Can you debug and see at what point this is happen?
- 12-29-2008, 08:06 AM #22
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;
}
- 12-29-2008, 02:15 PM #23
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
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?
- 12-30-2008, 01:42 AM #24
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.
- 12-30-2008, 02:02 AM #25
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.
- 12-30-2008, 02:12 AM #26
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
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?
If so tm is an object. What your collection framework d returns there.Java Code:org.hogauctionwebservice.AveragePricePerDay
- 12-30-2008, 02:29 AM #27
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.
- 12-30-2008, 02:31 AM #28
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.
- 12-30-2008, 02:41 AM #29
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 12-30-2008, 02:55 AM #30
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());
}
- 12-30-2008, 03:03 AM #31
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
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-30-2008, 03:22 AM #32
- 12-30-2008, 03:27 AM #33
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
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?
- 12-30-2008, 03:29 AM #34
- 12-30-2008, 03:30 AM #35
when i right click, go to definitioin/source, it show this for both:
public String getDate() {
return date;
}
public int getTransactionID() {
return transactionID;
}
- 12-30-2008, 03:31 AM #36
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Then IDE should be pointed the error if have done anything in your code. Didn't you get any error message?
- 12-30-2008, 03:36 AM #37
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
It's fine. Then you have to check on the first line of code.
Debug and see what values it's return.Java Code:org.hogauctionwebservice.AveragePricePerDay tm = d.get(i);
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.
- 12-30-2008, 04:15 AM #38
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
- 12-30-2008, 04:19 AM #39
for the value it return or holds is like these:
AveragePricePerDay:
http://i150.photobucket.com/albums/s...eudrue/1-1.jpg
tm:
http://i150.photobucket.com/albums/s...eudrue/2-1.jpg
i:
http://i150.photobucket.com/albums/s90/fiqueudrue/3.jpg
- 12-30-2008, 01:33 PM #40
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Similar Threads
-
Is it possible to code like this?
By Orange in forum New To JavaReplies: 8Last Post: 08-13-2008, 10:29 AM -
Need help with web code
By nemutah1 in forum New To JavaReplies: 1Last Post: 07-10-2008, 08:33 PM -
I need help fixing my code.. or non code?
By MrHuggykins in forum New To JavaReplies: 1Last Post: 03-19-2008, 10:12 PM -
tic tac toe code
By zoe in forum New To JavaReplies: 1Last Post: 07-23-2007, 04:36 PM -
Generating Code Automatically Using Custom code Template In Eclipse
By JavaForums in forum EclipseReplies: 1Last Post: 04-26-2007, 03:52 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks