• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2.x : How to call method in the bean using bean tag

 
shukla raghav
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to call a method in the bean class using the bean tag.
 
shukla raghav
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
another question. refer to the code below



In the <s:param> i am passing value="phone", i want this value to be picked up from the value stack like value="%{phone}". But his is not working what should i do?

 
dhoni Gibson
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you please provide me the exception which you are getting and whole jsp code
 
shukla raghav
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well let me make things a bit clear. The name of my action class is UserDetailAction. UserDetail action has two members name and phone. the action hits this action class and the result is returned to a success.jsp.

In success.jsp, a bean class - ContactBean is called. The ContactBean has 4 members 1. phone 2. country_code 3. area_code 4. subscriber_code.

Now when action hits the UserDetailAction.java, the member name and phone are set and put in the value stack. when the success.jsp is called i want to pass UserDetailAction.phone to ContactBean.phone via using param tag. UserDetailAction.phone is now at the value stack so i wish to access it and send it to the bean.hence the following code



there is no exception that is generated only null is set to the ContactBean.phone
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic