4 Replies Latest reply on Jun 15, 2007 9:33 AM by Miloslav Vlach

    Session scoped component and usage

    Miloslav Vlach Novice

      Hi all,

      i have problem with SESSION scoped component.

      I have an action which create one entity and add children to it. Name of the entity is ComponentLayout and I would like to this component exits until the save method is invoked.

      But problem is: when I call the action addArticle and add article to the ComponentLayout the collection contains only one item.

      The instance of the ComponentLayout is destroyed and new instance is created.

      Can somebody help me ?

      Thanks Mila

      public class ComponentLayoutAddAction implements Serializable{
       private static final long serialVersionUID = 3749007088722731841L;
       Session ses;
       Log log;
       List<ArticleLinker> articlesInComponent;
       @In(required = false)
       ViewArticle viewArticle;
       @In(required = false)
       ArticleLinker articleLinker;
       ComponentLayout componentLayout;
       public void init() {
       if (componentLayout == null)
       if (componentLayout.getArticles().size() > 0) {
       articlesInComponent = componentLayout.getArticles();
       public String addArticle() {
       log.info("adding article: #0", articleLinker);
       articlesInComponent = null;
       return "success";
       public String save() {
       log.info("saving component: #0", componentLayout);
       return "success";
       public String remove() {
       log.info("removing article: #0", viewArticle);
       return "success";
       public void end() {