Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4613196
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:30:46+00:00 2026-05-22T01:30:46+00:00

I am implementing a shopping website through JSP. I have a Java object called

  • 0

I am implementing a shopping website through JSP. I have a Java object called ShoppingCart and one called Item. In ShoppingCart there is a vector which holds Item objects. The idea is when I make a call to the addItem() method, I use:-

cart.addItem(name, image, price, details);

ensuring that the ShoppingCart has already been declared:-

ShoppingCart cart = new ShoppingCart("file_path_to_file"); 

and the the content of addItem is:-

public void addItem(String name, String image, String price, String detail) throws IOException  
{  
     items.add(new Item(name, image, price, detail));  
     this.saveMe();  
}  

where items is the vector. This works absolutely fine. I have, however, now created a new method called clear:-

public void clear() throws IOException  
{  
    items.clear();  
    this.saveMe();  
}  

The saveMe method simply saves to an Object file:-

private void saveMe() throws IOException  
{  
     FileOutputStream fos = new FileOutputStream(this.filename);  
     ObjectOutputStream oos = new ObjectOutputStream(fos)  
     oos.writeObject(this.items);  
     oos.close();  
}  

When I call the clear method using:-

cart.clear();

I get the error message:-

An error occurred at line: 108 in the jsp file: /project/cart.jsp
The method clear() is undefined for the type ShoppingCart

Can anybody help with any ideas I can try to resolve this issue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T01:30:46+00:00Added an answer on May 22, 2026 at 1:30 am

    If that method was newly added and you get this error, you’re apparently still using an old version of the class lacking the method in the classpath. You need to save the source code file, recompile/rebuild the class/project, redeploy the project and restart the server to get the new changes to work.

    A bit decent IDE with a bit decent server plugin will do that automagically by the way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When implementing Quicksort, one of the things you have to do is to choose
I am implementing a shopping cart site. When the user add the item, it
I have a shopping cart in my app. I also have a UIBarButton called
I am implementing a shopping cart for my website, using a pseudo-AJAX Lightbox-esque effect.
Am in the process of implementing a fairly conventional shopping checkout flow. Currently it
When implementing a needle search of a haystack in an object-oriented way, you essentially
So i am going to take my first hack at implementing a shopping cart
Im implementing a site with shopping cart features and want the user to be
I'm creating a shopping cart application and I'm having some issues with implementing a
Implementing a low pass FIR filter, when should one use FFT and IFFT instead

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.