Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-03-2008, 01:43 AM
Member
 
Join Date: Nov 2008
Posts: 3
Rep Power: 0
nel636 is on a distinguished road
Default Desperately need help
Hi guys,

Hoping you can help me. I have a client server program where you enter a new item via a client interface which then appears in the server interface using the below method:

Code:
public String addItem(){
    String serialNo = (String) receive();
    String desc = (String) receive();
    Integer stock = (Integer) receive();
    String location = (String) receive();
    String dateTime = (String) receive();
 
    // creates new serial number
    //serialNo = new Integer(server.getReposSize() + 1).toString();
 
    //creates new stockitem from stockitem class
    StockItem item = new StockItem(serialNo, desc, stock, location) ;
 
     if (item == null)
      return "Item does not exist";
 
    //Lock the object
    item = (StockItem) server.lock(serialNo);
    if (item != null){
      String status ="";
 
      //Carry out deposit on the locked account
      if (item.addItem(stock.intValue(),dateTime))
        status = "Stock Added";
      else
        status = "Failed to add new stock";
     server.unlock(serialNo);
     return status;
 
    
}
server.put(serialNo, item);
return "Item added";
}
Everything compiles and shows on the server interface, however where "item" is used it shows in the server interface as "null". Im not sure how as i though the line: "StockItem item = new StockItem(serialNo, desc, stock, location) ;" would recieve the value's sent and insert them into the interface like it has for the serialNo value.

Is there anything i could replace "if (item.addItem(stock.intValue(),dateTime))" to basically state i want the data recieved for the "item" object inserting in there?

Could anyone advise on this?

Thanks in advance.
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I desperately need help dc2acgsr99 Java Applets 4 04-30-2008 09:18 AM


All times are GMT +2. The time now is 10:19 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org