This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes How assign to null an obj that contains other objs as attributes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How assign to null an obj that contains other objs as attributes" Watch "How assign to null an obj that contains other objs as attributes" New topic
Author

How assign to null an obj that contains other objs as attributes

Leonidas Savvides
Ranch Hand

Joined: Jan 31, 2010
Posts: 402
How assign to null an obj eg cart, but that includes attributes/vars eg total, totalTax... AND other objs of kind lineItem,... all these to null assign?


supposing that below provides the xml file as server to another script ajax(non shown) bookrss.xml where in netbeans must be???
the below AjaxRSSServlet.java is in:
Source Packages>default Package or
C:\Users\User\Documents\TextBooksDataFiles\JAVA\xml-java\ParsonsWebServicesAjax\src\java\AjaxRSSServlet.java


Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60071
    
  65

Not a servlet question. Moved to the Java beginner forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18133
    
  39

Leonidas Savvides wrote:How assign to null an obj eg cart, but that includes attributes/vars eg total, totalTax... AND other objs of kind lineItem,... all these to null assign?


Not sure what you mean by "assign to null". A null is a literal. Its not a variable. And it can't be assigned anything. You can, however, assign its value to object references though.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Leonidas Savvides
Ranch Hand

Joined: Jan 31, 2010
Posts: 402
in my case then, how make cart empty?
please tell about and the 2nd ajax[server side] Q...?
Martin Vanyavchich
Ranch Hand

Joined: Sep 16, 2008
Posts: 241
If I understand you correctly, you could do something like


This would assign a new, possibly empty, cart to the cart variable. The other option is to make a function that would set all the variables in a cart to null, zero ...

SCJP 6, OCMJD 6, OCPJWSD 6
I no good English.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36563
    
  16
Why does your Cart class not have an empty() method?
Leonidas Savvides
Ranch Hand

Joined: Jan 31, 2010
Posts: 402
no, what empty method normally do?

ajax forum where is? in webservices forum?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36563
    
  16
Leonidas Savvides wrote:no, what empty method normally do?
Empty the cart?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36563
    
  16
Leonidas Savvides wrote:ajax forum where is?
Try here.
Leonidas Savvides
Ranch Hand

Joined: Jan 31, 2010
Posts: 402
Campbell Ritchie wrote:
Leonidas Savvides wrote:no, what empty method normally do?
Empty the cart?


i mean how empty it, what technic used?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36563
    
  16
You are writing the class; you decide how to empty it.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18133
    
  39

Campbell Ritchie wrote:
Leonidas Savvides wrote:ajax forum where is?
Try here.


Be careful here. From the posts so far, this topic is not very closely related to ajax. And there is currently a book promotion going on in that forum.



EDIT... Anyway, it looks like you have posted there... And...

1. The topic is not an ajax topic. A server side code that happens to support a client that happens to be using ajax to make the call doesn't make it an ajax question.

2. Duplicate topic. The post is an exact post of this one. With the same vague reference to carts, but nothing in the code that shows anything related to it. And ... cross posting wastes people's time and effort.

3. Book promotion in progress.


So... the other topic was trashed. Please continue the discussion here. Please elaborate your question more -- specifically what you have been asked here.

Henry
Leonidas Savvides
Ranch Hand

Joined: Jan 31, 2010
Posts: 402
Martin Vanyavchich wrote:If I understand you correctly, you could do something like


This would assign a new, possibly empty, cart to the cart variable. The other option is to make a function that would set all the variables in a cart to null, zero ...


if I have in JSP the
<jsp:useBean id="AddChoosePlant" scope="session" class="beans.OrderTotals" />
as cart obj that contains lineItem objs and total vars,
then how to act?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36563
    
  16
Sorry, Henry. I hadn't noticed the duplicate post.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How assign to null an obj that contains other objs as attributes
 
Similar Threads
Reading and displaying Strings from a file
When servlet compiles it can't find bean
Can you find the bug in <div> I do NOT get sample xml data[bookrss.xml]... RSS Client/Server
reading XML file
unbale to view xml file in browser