Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Changing property value of an object in session with Struts2 tags

 
Santhosh Kg
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Is there any struts2 tag that i can use inside a jsp,to change the property of an object in session?.

Here is my requirement.

I have an object A in session(attribute name "A") which has 2 properties say name and age.

class A{
String name;
int age;
}

I want to change A.name inside a jsp using struts2 tags.

What i want to know is,is there any tag which does the below inside a jsp(don't want to use any scriptlet),
((A)session.getAttribute("A")).setName("Santhosh");

rgds,
Santhosh.
 
Santhosh Kg
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Should have used <jsp:setProperty> instead.
<jsp:setProperty name="A" property="name" value="adaa"/>
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To be honest I'm not sure why you'd want to--to me it seems like that kind of functionality belongs in an action.
 
Santhosh Kg
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi David,
Ya,it looks dirty ..
But the thing is,i had to toggle one property after the page is loaded.

rgds,
Santhosh.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic