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
| @Name("componentLayoutAddAction")
| @Scope(ScopeType.SESSION)
| public class ComponentLayoutAddAction implements Serializable{
|
| /**
| *
| */
| private static final long serialVersionUID = 3749007088722731841L;
|
| @In
| Session ses;
|
| @Logger
| Log log;
|
| @DataModel
| List<ArticleLinker> articlesInComponent;
|
| @In(required = false)
| ViewArticle viewArticle;
|
| @In(required = false)
| ArticleLinker articleLinker;
|
| @In
| ComponentLayout componentLayout;
|
| @SuppressWarnings("unchecked")
| @Factory("articlesInComponent")
| public void init() {
| if (componentLayout == null)
| return;
| if (componentLayout.getArticles().size() > 0) {
| articlesInComponent = componentLayout.getArticles();
| }
|
| }
|
| public String addArticle() {
| log.info("adding article: #0", articleLinker);
|
| componentLayout.getArticles().add(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";
| }
|
| @Destroy
| @Remove
| public void end() {
|
| }
| }
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4054714#4054714
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4054714
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user