Hello,

I know that my question might sound naive but I realy need your help.
Unfortunately I couldn't  find out from the archieves what I'm doing wrong.
So here I go.
I need to submit a form (SearchForm) retrieve some data from the database depending on 
the values entered in the SearchForm
(SearchFormAction)and then edit the data returned by the query in the 
database(userform.jsp). This is how I have implemented the previous.

struts-config
==============

 <!-- Edit mail subscription -->
    <action    path="/search"
               type="ait.app.SearchFormAction"
         name="searchForm"
               scope="request"
               validate="false">
      <forward name="success"              path="/editUser"/>
    </action>
     
      
    <action   path="/editUser"
           type="ait.app.EditUserAction"   
           name="userForm"
           scope="request"
           validate="false">
     <forward name="success"            path="/userform.jsp"/>
     </action>
     
SearchFormAction
================

 data.createpool();
 data.open("SELECT * FROM "+role+" WHERE username='"+id+"'"); //get the data form 
database
 .........................................
 
 servlet.getServletContext().setAttribute(Constants.USER_KEY,usef); //set the bean to 
the values returned by the query
  
 return (mapping.findForward("/editUser")); //call the EditUserAction befor displaying 
the userform.jsp      
 
EditUserAction 
==============

 UserBean user=(UserBean) servlet.getServletContext().getAttribute(Constants.USER_KEY);
 HttpSession session = request.getSession();
 
 
 // Populate the user registration form
 if (form == null) {
            
     form = new UserForm();
            if ("request".equals(mapping.getScope()))
                request.setAttribute(mapping.getAttribute(), form);
            else
                session.setAttribute(mapping.getAttribute(), form);
 }
 UserForm userform = (UserForm) form;
        try {
         PropertyUtils.copyProperties(userform, user); // Shouldn't this populate the 
user to the form?????
         
                
            } catch (InvocationTargetException e) {//Handle the exception   }
                
              return (new ActionForward("/userform.jsp"));
              

userform.jsp
============
............................
     <td><html:text  property="fname" value=""/></td>
     <td><html:text  property="sname" value=""/></td>
     <td><html:text  property="bdate" value=""/> </td>
   ...........................................       

UserForm
========
.................
  public void setFname(String name){
    this.fname=name;
    }

   public String getFname(){
    return this.fname;
    }
   
   
   public void setSname(String myname){
    this.sname=myname;
    } 
 .................
 
 UserBean
 =========
 
 public class UserBean {
 String fname;
 String sname;
 String bdate; 
 String address;
 String region;
 String post;
 String phone;
 String faculty;
 String dregister;
 String email;
 String username;
 String password; 
   
 
 public void setFname(String first){
  this.fname=first;
 }
 
 public String getFname(){
  return this.fname;
 }
 ................................
   
   
   After doing all the above I get an empty userform.jsp. Can someome please tell me 
what I'm missing?
   
   Thank you in advance,
   Konstantina

Reply via email to