wood burning stoves 2.0*
The moose likes Struts and the fly likes Struts 2.x : How to call method in the bean using bean tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2.x : How to call method in the bean using bean tag" Watch "Struts 2.x : How to call method in the bean using bean tag" New topic
Author

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

shukla raghav
Ranch Hand

Joined: Aug 03, 2008
Posts: 200
Is it possible to call a method in the bean class using the bean tag.
shukla raghav
Ranch Hand

Joined: Aug 03, 2008
Posts: 200
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

Joined: Feb 10, 2011
Posts: 30
can you please provide me the exception which you are getting and whole jsp code
shukla raghav
Ranch Hand

Joined: Aug 03, 2008
Posts: 200
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
 
Consider Paul's rocket mass heater.
 
subject: Struts 2.x : How to call method in the bean using bean tag
 
Similar Threads
Asynchronous calls to Session Bean?
how do i solve this error caused due to problem in spring initiation on tomcat
Calling init()
Is there alternative method to access a bean
Simple JSP question