Struts question

J

Java_Forum

hi,
i am trying to do a simple thing without success!!!
in my web application (designed under the struts framework), i have a logon
action which check the username and password of a user, if it's ok i create
and store an object User with a session scope.
i have a another item at my menu wich enable a user to display his
information (stored in the user object), here is the code. theres is 3 files
EditmonCompteAction wich display the user information.
User bean wich store information about the user.
MoncompteForm is the bean form used in the mapping-action.
and finally of course the struts-config.xml


EDITMONCOMPTEACTION********************public class EditMonCompteAction
extends Action { public ActionForward execute(ActionMapping
mapping,ActionForm form,HttpServletRequest request,HttpServletResponse
response)throws Exception { //Recupere l'utilisateur 'user' en cours
User user = (User) (request.getSession()).getAttribute(Globals.USER_KEY);
if (user == null) return mapping.findForward("logon"); //Creation du
form bean "moncompteForm" s'il n'existe pas if (form==null) { //Creation
du from-bean form = new MoncompteForm(); //Ajout a la requets ou session
selon l'attribut "scope" de <action-mapping> if
("request".equals(mapping.getScope()))
request.setAttribute(mapping.getAttribute(),form); else
request.getSession().setAttribute(mapping.getAttribute(),form); }
//Copie de user vers form MoncompteForm moncompteForm = (MoncompteForm)
form; PropertyUtils.copyProperties(moncompteForm, user); //Attache un
synchroniser token pour eviter le double posting saveToken(request);
//Renvoie vers moncompte return mapping.findForward("moncompte"); } }
STRUTS-CONFIG.XML
*****************

.....<!-- ========== Global Forward Definitions
============================== --> <global-forwards> <forward name="index"
path="/index.jsp"/> <forward name="logon" path="/logon.jsp"/> <forward
name="acceuilUser" path="/acceuilUser.jsp"/> <forward name="moncompte"
path="/moncompte.jsp"/> </global-forwards>......<!-- process an edit
moncompte --> <action path="/editMonCompte"
type="eshop.actions.EditMonCompteAction" attribute="moncompteForm"
scope="request" validate="false"/> ......
MONCOMPTEFORM
*************

public class MoncompteForm extends ValidatorForm{.... private String nom;
private String prenom; private String password;.... public void
setNom(String nom) {this.nom=nom;} public void setPassword(String password)
{this.password = password;} public void setPrenom(String prenom)
{this.prenom=prenom;}.... public String getNom() {System.out.println("entr?e
dans MonCOmpteForm.getNom");return nom;} public String getPassword(){return
password;} public String getPrenom() {return prenom;}}

USER
****

public class User {... private String nom; private String prenom; private
String password;... public void setNom(String nom) {this.nom=nom; public
void setPassword(String password) {this.password = password;} public void
setPrenom(String prenom) {this.prenom=prenom;}....ublic String getNom()
{return nom;} public String getPassword(){return password;} public String
getPrenom() {return prenom;}}
when the editMonCompte.execute() methode is performed, i have display the
content of the form, and its property reflected those of the object USER,
but nothing is displayed in the moncompte.jsp, which use ofcourse the struts
html taglib (html:text, html:submit....)

i don't understand what's wrong with my code
thanks for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,008
Latest member
HaroldDark

Latest Threads

Top