Hi Paul, As per Oracle : *invalidate<http://docs.oracle.com/javaee/5/api/javax/servlet/http/HttpSession.html#invalidate()> *() Invalidates this session then unbinds any objects bound to it.
My target is to remove only the cart object. Thanks, Srineel On Fri, Sep 13, 2013 at 7:44 AM, Martin Gainty <mgai...@hotmail.com> wrote: > session.invalidate() > > http://docs.oracle.com/javaee/5/api/javax/servlet/http/HttpSession.html > > Martin > > > > > Date: Thu, 12 Sep 2013 16:58:45 -0400 > > Subject: Re: Value not persisting in domain object > > From: smaz19...@gmail.com > > To: user@struts.apache.org > > > > Hi Umesh, Paul and Martin, > > > > Thanks a lot for you help. Finally using session aware I could save and > > retrieve the shopping cart across pages. PFB the code : > > > > To save : > > > > Use implements SessionAware > > > > public void setSession(Map sessionMap) { > > map = sessionMap; > > map.put("ShoppingCart", getCart()); > > > > To retrieve : > > > > HttpServletRequest request = ServletActionContext.getRequest(); > > setCart((Cart)request.getSession().getAttribute("ShoppingCart")); > > > > How to clean up the session : session.removeAttribute ("ShoppingCart") ?? > > > > Thanks, > > Srineel > > > > > > On Wed, Sep 4, 2013 at 11:16 AM, Martin Gainty <mgai...@hotmail.com> > wrote: > > > > > your best solution is stuff the entire Cart into Session > > > I will need a few items if you want us to help you get this running > > > > > > package com.home.practice.shop; > > > import com.home.practice.shop.domain.Cart; > > > import com.home.practice.shop.domain.Item; > > > //where is com.home.practice.shop.domain.Item ? > > > > > > public class AddItemToCartAction extends BaseAction { > > > //where is BaseAction? > > > > > > There is great difficulty experienced to make this webapp work for you > when > > > > > > all of the jsps are missing > > > all of the config files are missing > > > -web.xml > > > -struts-config*.xml > > > -*validation.xml > > > *.ftl > > > *.vm > > > > > > the majority of the java source classes seem to be missing > > > > > > if you REALLY want us to help you out...zip up everything in the > > > ShoppingCartApp folder and email it to us (or put it on dropbox and > send us > > > a link) > > > > > > Also you will need some way to build the webapp..I took the liberty of > > > creating this q&d pom.xml for you > > > <project> > > > <modelVersion>4.0.0</modelVersion> > > > <groupId>com.home.practice</groupId> > > > <artifactId>Cart</artifactId> > > > <version>1.0</version> > > > <packaging>war</packaging> > > > <description>a q&d pom.xml for Sunil</description > > > <dependencies> > > > <dependency> > > > <groupId>org.springframework</groupId> > > > <artifactId>spring-beans</artifactId> > > > <version>3.2.0</version> > > > </dependency> > > > <dependency> > > > <groupId>javax.servlet</groupId> > > > <artifactId>servlet-api</artifactId> > > > <version>2.5</version> > > > </dependency> > > > <dependency> > > > <groupId>org.apache.struts</groupId> > > > <artifactId>struts2-core</artifactId> > > > <version>2.3.4</version> > > > </dependency> > > > </dependencies> > > > <build> > > > <plugins> > > > <plugin> > > > <artifactId>maven-war-plugin</artifactId> > > > <version>2.4</version> > > > <configuration> > > > <archive> > > > <manifest> > > > <addClasspath>true</addClasspath> > > > <classpathPrefix>lib/</classpathPrefix> > > > </manifest> > > > </archive> > > > <!-- if not ear we can pull from lib folder --> > > > <defaultLibBundleDir>lib/</defaultLibBundleDir> > > > </configuration> > > > </plugin> > > > </plugins> > > > </build> > > > </project> > > > > > > thanks, > > > Martin > > > ______________________________________________ > > > Verzicht und Vertraulichkeitanmerkung/Note de déni et de > confidentialité > > > > > > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene > > > Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede > unbefugte > > > Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese > Nachricht > > > dient lediglich dem Austausch von Informationen und entfaltet keine > > > rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von > > > E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. > > > > > > Ce message est confidentiel et peut être privilégié. Si vous n'êtes > pas le > > > destinataire prévu, nous te demandons avec bonté que pour satisfaire > > > informez l'expéditeur. N'importe quelle diffusion non autorisée ou la > copie > > > de ceci est interdite. Ce message sert à l'information seulement et > n'aura > > > pas n'importe quel effet légalement obligatoire. Étant donné que les > email > > > peuvent facilement être sujets à la manipulation, nous ne pouvons > accepter > > > aucune responsabilité pour le contenu fourni. > > > > > > > > > Date: Mon, 2 Sep 2013 20:15:30 -0400 > > > Subject: Re: Value not persisting in domain object > > > From: smaz19...@gmail.com > > > To: user@struts.apache.org > > > > > > Hi Umesh and Paul, > > > I have attached the code. Cart.java is my domain class where itemlist > will > > > have all the items added in the cart. AddItemToCartAction will add to > > > itemList and UpdateCartQuantitiesAction will fetch it from itemList. I > > > agree to what Paul ..but can you suggest a workaround?? > > > > > > This is actually the JPetstore project I am working on. I am rewritting > > > the code in Struts 2 . I select FISH,Add to Cart and then Update Cart. > In > > > Update Cart, it shows Cart is Empty. > > > > > > Please help with a solution. > > > > > > On Sun, Sep 1, 2013 at 10:14 PM, Paul Benedict <pbened...@apache.org> > > > wrote: > > > > > > Every Action class is instantiated per request. If you're updating a > > > > > > collection in one action, it will, of course, not be around in the next > > > > > > collection. It sounds like you need to stuff your shopping cart into > the > > > > > > session. > > > > > > > > > > > > > > > > > > On Sun, Sep 1, 2013 at 8:39 PM, Srineel Mazumdar <smaz19...@gmail.com > > > >wrote: > > > > > > > > > > > > > Hi All, > > > > > > > > > > > > > > Can anyone please help ? > > > > > > > > > > > > > > Thanks.. > > > > > > > > > > > > > > > > > > > > > On Fri, Aug 30, 2013 at 10:23 PM, Srineel Mazumdar < > smaz19...@gmail.com > > > > > > > >wrote: > > > > > > > > > > > > > > > Yes.. the same collection. > > > > > > > > > > > > > > > > > > > > > > > > On Wed, Aug 28, 2013 at 6:55 PM, Paul Benedict < > pbened...@apache.org > > > > > > > >wrote: > > > > > > > > > > > > > > > >> Are you retrieving the same collection? > > > > > > > >> > > > > > > > >> > > > > > > > >> On Wed, Aug 28, 2013 at 8:22 AM, Srineel Mazumdar < > > > smaz19...@gmail.com > > > > > > > >> >wrote: > > > > > > > >> > > > > > > > >> > Hi, > > > > > > > >> > > > > > > > > >> > I am creating a shopping cart application in Struts 2. I am > > > updating a > > > > > > > >> list > > > > > > > >> > in Cart domain object when the user selects some items in > shopping > > > > > > > list > > > > > > > >> > using checkboxes and clicks Next. In the CheckOut page those > items > > > > > > > >> would be > > > > > > > >> > shown. But in my case it shows empty list. Upon debugging, I > find > > > that > > > > > > > >> list > > > > > > > >> > is updated finally, but an empty list is fetched in Check Out > page. > > > > > > > >> > > > > > > > > >> > Can somebody help me by giving some pointers ? > > > > > > > >> > > > > > > > > >> > Thanks., > > > > > > > >> > Srineel > > > > > > > >> > > > > > > > > >> > > > > > > > >> > > > > > > > >> > > > > > > > >> -- > > > > > > > >> Cheers, > > > > > > > >> Paul > > > > > > > >> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > Cheers, > > > > > > Paul > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > > > For additional commands, e-mail: user-h...@struts.apache.org > > > > >