aspose file tools*
The moose likes Struts and the fly likes Update user profile Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Update user profile" Watch "Update user profile" New topic
Author

Update user profile

natasa jones
Ranch Hand

Joined: Aug 20, 2006
Posts: 45
Hi all!
in my application i use struts and jsp.what i would like to ask is,how i could let the user change his registration data.more precisely,i dont know how i can show this information in jsp..what tags can i use?what i have in mind is for example a form where on the right message "name" for example appears and on the right is a text box which is not empty but has the current saved users name..how can i show this database information in the way i described above?
any help appreciated!
RoshaniG Gopal
Ranch Hand

Joined: May 15, 2006
Posts: 180
Originally posted by natasa jones:
Hi all!
in my application i use struts and jsp.what i would like to ask is,how i could let the user change his registration data.more precisely,i dont know how i can show this information in jsp..what tags can i use?what i have in mind is for example a form where on the right message "name" for example appears and on the right is a text box which is not empty but has the current saved users name..how can i show this database information in the way i described above?
any help appreciated!


Hi natasa,
From what I could comprehend, You want a "Name:TestUser". You may do it by saving the information in a bean and then on the jsp use <bean:write> to do so.
eg:
FIRST NAME:
<input name="name" value="<bean:write name="result" property="name"/>" >

The bean:write will write from the bean(result) and it will write the name of the user. The bean result may contain all the information of the user.

Hope it helps!
Regds,
Roshani


Regards,<br />Roshani
RoshaniG Gopal
Ranch Hand

Joined: May 15, 2006
Posts: 180
Hi natasa,
From what I could comprehend, You want a "Name:TestUser". You may do it by saving the information in a bean and then on the jsp use <bean:write> to do so.
eg:
FIRST NAME:
<input name="name" value="<bean:write name="result" property="name"/>" >

The bean:write will write from the bean(result) and it will write the name of the user. The bean result may contain all the information of the user.

Hope it helps!
Regds,
Roshani
natasa jones
Ranch Hand

Joined: Aug 20, 2006
Posts: 45
thanks very much for your answer!i will try it!as soon as i figure out the prblem with my struts-cobfig!i have written this code


what is wrong with that?because i am getting an error wich says that an instance of this action could not be created!
how should my struts cofig be?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The type attribute must contain the fully-qualified name of the class used by your action including the package name. You must also make sure that this class exists and is in your /WEB=INF/classes directory.

While the method described by RosthaniG will work, it is not the best way to do this in a Struts application. The best, or recommended way is to create a JavaBean that extends org.apache.struts.action.ActionForm that has a corresponding property for every input field in your form. You then declare that ActionForm in the <form-beans> section of your struts-config.xml file. You then associate the name attribute used by the <form-bean> declaration with the name attribute of the action mapping to create an association between the form bean and the action.

Once this configuration is in place, you can populate the form bean in the Action class that forwards to the JSP. If you do this, you can use <html:text> tags for all your input fields and they will automatically be popluated with data from the form bean by Struts.

In order to more fully understand how this process works, I'd suggest you work through a tutorial such as this one.


Merrill
Consultant, Sima Solutions
natasa jones
Ranch Hand

Joined: Aug 20, 2006
Posts: 45
thank you very much for all the information and the link!
natasa jones
Ranch Hand

Joined: Aug 20, 2006
Posts: 45
could you please tell me how i could fill in the input fields using html:text?
the form appears but the input text fields dont fill in with the values....any solutions???
thanks in advance!
rakshini nithya
Ranch Hand

Joined: Jun 15, 2006
Posts: 39
Hi i think this code would help you



I have stored the details of a member in the list called member info in my action class from the data base and i have used scriptlets to display the values in the text box.
As struts does not allow nested tags inside a tag i think this is the possible way.
try this
 
Consider Paul's rocket mass heater.
 
subject: Update user profile
 
Similar Threads
Design Dilemma
Clarification on OOP-4
How do i gather user requirements?
Show user name on pages
Struts 1.3 how to send data from database to the jsp page!