struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Darryl Nortje <Darr...@astrolabegroup.com>
Subject RE: How to retrieve value from actionservlet?
Date Thu, 29 Aug 2002 09:27:02 GMT
yes you can. Let's say your user object, is you form class. or similar
bean....... it has in particular a getFullname() method. You store this user
bean on the request or session as "userstuff". Then when you want to write
out the username on a jsp page all you do is this -->   <bean:write
name="userstuff" property="fullname"/>.

I don't see why this shouldn't work

Hi Daryl,

Thank you for your help. But, please bear with me
because I am trying very hard to make some sense out
of it. Is there any way that I can store the
information associated to a particular user in a user
object and then retrieve it later on my JSP page? In
other words, can I do the following? 

<bean:write name="User" property="fullname"/> ??

Thank you!!!!!!

Thanks,
Lee
--- Darryl Nortje <DarrylN@astrolabegroup.com> wrote:
> try this in your action class.
> 
> You have an instance of the form object.
> 
> UserInfoForm userForm = (UserInfoForm) form;
> then...
> String fullName = userForm.setFullName(fullName);
> return mapping.findForward("success");
> 
> then on your userInfoConfirm jsp you say
> <bean:write name="userInfoForm"
> property="fullname"/>
> 
> That should work...
> 
> -----Original Message-----
> From: struts user [mailto:struts_user@yahoo.com]
> Sent: Tuesday, August 27, 2002 6:21 PM
> To: struts-user@jakarta.apache.org
> Subject: How to retrieve value from actionservlet?
> 
> 
> 
> Hello everyone,
> 
> I am new to struts and I hope anyone out there can
> help me, please!
> 
> In my struts-config.xml file, I have:
> 
> <form-beans> 
>    <form-bean          name="userInfoForm" 
>                       
> type="com.mycompany.mydept.mypackage.UserInfoForm"/>
> </form-beans>
> 
> 
> <action-mappings>
>    <action path="/userInfoConfirm"
>           
> type="com.mycompany.mydept.mypackage.UserInfoAction"
>            name="userInfoForm"
>            scope="request"
>            input="/userInput.jsp">
>       <forward name="success"    
> path="/userInfoConfirm.jsp"/>
>    </action>
> </action-mappings>
> 
> In my UserInfoForm, I have the following setter and
> getter:
> 
> public void setFullname(String fullname){
> 	     this.fullName = fullname;
> }
> 
> public String getFullname(){
> 	     return (fullName);
> }
> In my UserInfoAction servlet, I did the following:
> 
> User myUser = new User(fullName);
> 
> I have a user object and I would like to retrive the
> user object value i.e. fullName and display it on my
> JSP page. How do I do that? I will have a
> collections
> of users and store them in a Hashtable eventually
> and
> retrieve user information associated to the user.
> But,
> I would like to know how to achieve my initial
> attempt
> above. Please help!!!!
> 
> Thank you,
> Lee
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Finance - Get real-time stock quotes
> http://finance.yahoo.com
> 
> --
> To unsubscribe, e-mail:
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:  
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message