I saw a post in the thread 
http://www.mail-archive.com/[email protected]/msg49234.html

I have the same problem and I can�t get it working. Perhaps someone can help me? It�d 
be very nice.

I have the problems that the data in my formbean isn�t updated. I mean, I get the data 
form my formbean in the jsp page. But when I edit it and press submit, it is not 
updated. I get the same data as I got before.

Do you see perhaps an error? (I reviewed it now 7 hours with the sample source 
attached in the upper thread, and I can�t find any error. Thank you)

It�s kind of urgent, because my thesis should be finished at the end of december. 
Thanks!!!!

Take care Michael

**************************************************************************************************************
This is my projekterfassung.jsp:

<html:form action="saveProjekterfassung" name="timeProofForm" 
type="de.proway.zerf.web.bean.TimeProofFormBean">
<table width="100%">
<logic:iterate id="element" indexId="listIdx" name="timeProofForm" property="vector">
<tr>
  <td> <bean:write name="element" property="date" /> </td>
  <td> <html:text name="element" property="fromHour" size="2" maxlength="2" 
indexed="true"/> : <html:text name="element" property="fromMinute" size="2" 
maxlength="2" indexed="true"/> </td>
  <td> <html:text name="element" property="toHour" size="2" maxlength="2" 
indexed="true"/>   : <html:text name="element" property="toMinute" size="2" 
maxlength="2" indexed="true"/>   </td>
</logic:iterate>
<html:submit property="submit"/>
</html:form>
**************************************************************************************************************

My struts-config.xml:

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
          "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd";>

<struts-config>


  <!-- ========== Data Source Configuration =============================== -->

  <!-- ========== Form Bean Definitions =================================== -->
  <form-beans>

    <form-bean
   name="timeProofForm"
   type="de.proway.zerf.web.bean.TimeProofFormBean"/>

</form-beans>


  <!-- ========== Global Forward Definitions ============================== -->
  <global-forwards>

     <forward   name="done"              path="/projekterfassung.jsp"/>

  </global-forwards>


  <!-- ========== Action Mapping Definitions ============================== -->
  <action-mappings>

 <action path="/projekterfassung"
                     type="de.proway.zerf.web.controller.ShowTimeProofAction"
                     name="timeProofForm"
                     scope="request"
                     input="/projekterfassung.jsp">
 </action>

  <action path="/saveProjekterfassung"
                     type="de.proway.zerf.web.controller.SaveTimeProofAction"
                     name="timeProofForm"
                     scope="request"
                     input="/projekterfassung.jsp">
 </action>


    <action    path="/admin/addFormBean"
               type="org.apache.struts.actions.AddFormBeanAction"/>
    <action    path="/admin/addForward"
               type="org.apache.struts.actions.AddForwardAction"/>
    <action    path="/admin/addMapping"
               type="org.apache.struts.actions.AddMappingAction"/>
    <action    path="/admin/reload"
               type="org.apache.struts.actions.ReloadAction"/>
    <action    path="/admin/removeFormBean"
               type="org.apache.struts.actions.RemoveFormBeanAction"/>
    <action    path="/admin/removeForward"
               type="org.apache.struts.actions.RemoveForwardAction"/>
    <action    path="/admin/removeMapping"
               type="org.apache.struts.actions.RemoveMappingAction"/>


  </action-mappings>

</struts-config>
**************************************************************************************************************
SaveTimeProofAction.java

package de.proway.zerf.web.controller;

import javax.servlet.http.*;
import org.apache.struts.action.*;
import de.proway.zerf.web.bean.*;
import de.proway.zerf.app.controller.*;
import de.proway.zerf.web.util.*;
import de.proway.zerf.app.bean.*;
import java.util.*;
import java.text.*;

public final class SaveTimeProofAction extends LoginCheckAction {
    public ActionForward perform( ActionMapping mapping,
    ActionForm form, HttpServletRequest request,
    HttpServletResponse res ) {

        TimeProofFormBean tpf = (TimeProofFormBean) form;

        System.out.println(tpf.toString());
        System.out.println(tpf.getVector().toString());
        for( int i=0; i < tpf.getVector().size(); ++i ) {
          System.out.println( ((TimeProofTableBean) tpf.getVector().get(i)).getDate()  
);
          System.out.println( ((TimeProofTableBean) 
tpf.getVector().get(i)).getFromHour()  );
          System.out.println( ((TimeProofTableBean) 
tpf.getVector().get(i)).getFromMinute()  );
        }

        return mapping.findForward( "done" );
    }
}

**************************************************************************************************************
Show TimeProofAction.java

package de.proway.zerf.web.controller;

import javax.servlet.http.*;
import org.apache.struts.action.*;
import de.proway.zerf.web.bean.*;
import de.proway.zerf.app.controller.*;
import de.proway.zerf.web.util.*;
import de.proway.zerf.app.bean.*;
import java.util.*;
import java.text.*;

public final class ShowTimeProofAction extends LoginCheckAction {
     public ActionForward perform( ActionMapping mapping,
    ActionForm form, HttpServletRequest request,
    HttpServletResponse res ) {

        Vector newCollection = new Vector();
        TimeProofFormBean tpfb = ( TimeProofFormBean )form;
        TimeProofTableBean tptb1 = new TimeProofTableBean();
        TimeProofTableBean tptb2 = new TimeProofTableBean();
        tptb1.setFromMinute(3);
        tptb2.setFromMinute(4);
        newCollection.add(tptb1);
        newCollection.add(tptb2);
        tpfb.setVector(newCollection);
        return mapping.findForward( "done" );
    }
}

**************************************************************************************************************
TimeProofFormBean.java

package de.proway.zerf.web.bean;

import java.util.*;

import org.apache.struts.action.*;

public class TimeProofFormBean extends ActionForm {

    public TimeProofFormBean() {
    }

    public Vector getVector() {
        return this.vector;
    }

    public void setVector( Vector v ) {
        this.vector = v;
    }

    public int getEmployeeID() { return employeeID; }

    public void setEmployeeID( int employeeID ) { this.employeeID = employeeID; }

    public int getProjectID() { return projectID; }

    public void setProjectID( int projectID ) { this.projectID = projectID; }

    private int employeeID;
    private int projectID;
    private Vector vector = new Vector();
}
**************************************************************************************************************
TimeProofTableBean.java

package de.proway.zerf.web.bean;


import java.util.*;
import java.io.Serializable;

public class TimeProofTableBean implements Serializable  {
public TimeProofTableBean(){}

public String getFromHour(){
        return FromHour;
    }

public void setFromHour(String FromHour){
        this.FromHour = FromHour;
    }

public String getToHour(){
        return ToHour;
    }

public void setToHour(String ToHour){
        this.ToHour = ToHour;
    }

public String getFromMinute(){
        return FromMinute;
    }

public void setFromMinute(String FromMinute){
        this.FromMinute = FromMinute;
    }

public String getToMinute(){
        return ToMinute;
    }

public void setToMinute(String ToMinute){
        this.ToMinute = ToMinute;
    }

public String getDate(){
        return Date;
    }

public void setDate(String Date){
        this.Date = Date;
    }


private String FromHour;
private String ToHour;
private String FromMinute;
private String ToMinute;
private String Date;
}







--
Fehlerfreie Software wirkt weniger komplex und diskreditiert damit den Entwickler!

Reply via email to