multiple input form editing problem

2003-08-23 Thread Flo
>LO,
>
>I have a form with multiple input as this
>
>
>
>
>
>
>
>...
>
>i made a usersForm as this :
>
>private String[] name = null;
>private String[] surname = null;
>...
>
>I would like to show the content of a the "usersForm " object preloaded
from
>an Action for editing datas
>
>
>I tried as this :
><%
>int i=0;
>%>
>
>
><%
>String surname = "surname["+i+"]";
>String name = "name["+i+"]";
>i++;
>%>
>
>
>
>
>
>This show magically the correct values on screen but as this in HTML code :
>
>
>
>
>
>
>
>So when i submit this form
>The usersForm can't retrieve new values because of the bad name of property
>(surname[0], name[0], surname[1], name[1],...)

I also tried this :
I tried this ( see between /***/):

public class EditDroitsAction extends Action {

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
 HttpServletResponse response) throws
IOException, ServletException {

String cible = new String("fin");
ActionErrors erreurs = new ActionErrors();
HttpSession session = request.getSession();
MBMMembre membre =(MBMMembre) session.getAttribute("membre");
//
DynaActionForm dynaForm = (DynaActionForm)form;
//
if(membre!=null) {
if(membre.isMBMBaseStarted()) {
try{


DroitsForm formulaire = new DroitsForm();
MBMGestionMembre gestionM=new MBMGestionMembre();
int nbMembres = gestionM.getListSize();
String base = "";
base = request.getParameter("base");
Vector listeMembres = new Vector();
MBMDroitsBean[] droitsBTab = new
MBMDroitsBean[nbMembres];
for(int i=0;i









...

Struts config :













>I think it must exist a simpliest solution using "indexed" attribute or
>others but i don't know what.
>And the documentations on struts are so poor for this kind of problem.
>
>sincerly
>
>Florent

Looking for File Upload Example

2003-06-26 Thread Flo
Hi

i'm looking for un example of using File UPLOAD whith Struts API

The servlet and JSP code

Thanks

Flo


Upload Error

2003-06-26 Thread Flo
I applied the folowing example to my project but a get an error :

java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileUploadException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:1590)
at java.lang.Class.getConstructor0(Class.java:1762)
at java.lang.Class.newInstance0(Class.java:276)
at java.lang.Class.newInstance(Class.java:259)

http://jakarta.apache.org/struts/faqs/actionForm.html

<[EMAIL PROTECTED] language="java">
<[EMAIL PROTECTED] 
uri="/WEB-INF/struts-html.tld"
   prefix="html">



Please Input Text: 
Please Input The File You Wish to Upload: 
   
   






The next step is to create your ActionForm bean: 





import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.upload.FormFile;

public class UploadForm extends ActionForm {

protected String myText;
protected FormFile myFile;

public void setMyText(String text) {
myText = text;
}

public String getMyText() {
return myText;
}

public void setMyFile(FormFile file) {
myFile = file;
}

public FormFile getMyFile() {
return myFile;
}

}