BUG in org.apache.struts.util.ResponseUtils.filter(String value) method in v.1.0.2

2002-03-21 Thread Serge A. Redchuk

Hello all !

I think there is a bug in BUG in
org.apache.struts.util.ResponseUtils.filter(String value) method in v.1.0.2

This useful method states:

public static String filter(String value) {

if (value == null)
return (null);

char content[] = new char[value.length()];
value.getChars(0, value.length(), content, 0);
StringBuffer result = new StringBuffer(content.length + 50);
for (int i = 0; i < content.length; i++) {
switch (content[i]) {
case '<':
result.append("<");
break;
case '>':
result.append(">");
break;
case '&':
result.append("&");
break;
case '"':
result.append(""");
break;
default:
result.append(content[i]);
}
}
return (result.toString());

}

All ok, but why this method does not converts '\n' to  ?


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




BUG in org.apache.struts.util.ResponseUtils.filter(String value) method in v.1.0.2

2002-03-21 Thread Serge A. Redchuk

Hello all !

I think there is a bug in BUG in
org.apache.struts.util.ResponseUtils.filter(String value) method in v.1.0.2

This useful method states:

public static String filter(String value) {

if (value == null)
return (null);

char content[] = new char[value.length()];
value.getChars(0, value.length(), content, 0);
StringBuffer result = new StringBuffer(content.length + 50);
for (int i = 0; i < content.length; i++) {
switch (content[i]) {
case '<':
result.append("<");
break;
case '>':
result.append(">");
break;
case '&':
result.append("&");
break;
case '"':
result.append(""");
break;
default:
result.append(content[i]);
}
}
return (result.toString());

}

All ok, but why this method does not converts '\n' to  ?


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




PLEASE, HELP !!! upload problem

2002-02-22 Thread Serge A. Redchuk

Hello All !

I use the Struts v.1.0.2

Unfortunatelly I can't realize file uploading.

And the most confusing that I have 2 different errors on different
files with the same code.

Here's my form:









Here's form bean:
...
public final class ImagesPartnerForm extends ActionForm {
  private String pkPartner = null;
  private FormFile imgFile = null;
  ...
  public FormFile getImgFile(){
return this.imgFile;
  }
  public void setImgFile( FormFile imgFile ){
this.imgFile = imgFile;
  }
  public void reset( ActionMapping mapping, HttpServletRequest request ){
pkPartner = (String)request.getAttribute( "pkPartner" );
imgFile = null;
  }
...

Here's action that handles form data:
public final class AddImage extends ActionExt {
  public ActionForward perform( ActionMapping mapping, ActionForm form,
 HttpServletRequest request, HttpServletResponse response, String userName )
throws IOException, ServletException
  {
String subpath = "/partner";
String targetDir = ResourceHandler.getProperty( "global",
  "pictures.dyn.abs-root" ) + subpath;
String dbPath = ResourceHandler.getProperty( "global",
  "pictures.dyn.rel-root" ) + subpath;
ImagesPartnerForm iform = (ImagesPartnerForm)form;
FormFile ff = iform.getImgFile();
//
String name = ff.getFileName();
String targetFile = targetDir + "/" + name;
String dbFile = dbPath + "/" + name;
// Save file to filesystem
java.io.DataInputStream dis = new java.io.DataInputStream(
  ff.getInputStream() );
java.io.DataOutputStream dos = new java.io.DataOutputStream(
  new java.io.FileOutputStream( targetFile ) );
for( int i = 0; i < ff.getFileSize(); i++ ){
  dos.writeByte( dis.readByte() );
}
dos.flush();
dos.close();
dis.close();

return new ActionForward( "/jsp/partner/test.jsp" );
  }
}

ERRORS:
0) short text file was uploaded without any corruption, but:

1) One jpeg file was uploaded, but had less size then source.

2) Other jpeg file uploading caused an exception:

javax.servlet.ServletException: IOException while reading file element: Premature end 
of stream while reading multipart request
at 
org.apache.struts.upload.MultipartIterator.getNextElement(MultipartIterator.java:222)
at 
org.apache.struts.upload.DiskMultipartRequestHandler.handleRequest(DiskMultipartRequestHandler.java:76)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:735)
at 
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:2061)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1564)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




PLEASE, HELP !!! upload problem

2002-02-22 Thread Serge A. Redchuk

Hello All !

I use the Struts v.1.0.2

Unfortunatelly I can't realize file uploading.

And the most confusing that I have 2 different errors on different
files with the same code.

Here's my form:









Here's form bean:
...
public final class ImagesPartnerForm extends ActionForm {
  private String pkPartner = null;
  private FormFile imgFile = null;
  ...
  public FormFile getImgFile(){
return this.imgFile;
  }
  public void setImgFile( FormFile imgFile ){
this.imgFile = imgFile;
  }
  public void reset( ActionMapping mapping, HttpServletRequest request ){
pkPartner = (String)request.getAttribute( "pkPartner" );
imgFile = null;
  }
...

Here's action that handles form data:
public final class AddImage extends ActionExt {
  public ActionForward perform( ActionMapping mapping, ActionForm form,
 HttpServletRequest request, HttpServletResponse response, String userName )
throws IOException, ServletException
  {
String subpath = "/partner";
String targetDir = ResourceHandler.getProperty( "global",
  "pictures.dyn.abs-root" ) + subpath;
String dbPath = ResourceHandler.getProperty( "global",
  "pictures.dyn.rel-root" ) + subpath;
ImagesPartnerForm iform = (ImagesPartnerForm)form;
FormFile ff = iform.getImgFile();
//
String name = ff.getFileName();
String targetFile = targetDir + "/" + name;
String dbFile = dbPath + "/" + name;
// Save file to filesystem
java.io.DataInputStream dis = new java.io.DataInputStream(
  ff.getInputStream() );
java.io.DataOutputStream dos = new java.io.DataOutputStream(
  new java.io.FileOutputStream( targetFile ) );
for( int i = 0; i < ff.getFileSize(); i++ ){
  dos.writeByte( dis.readByte() );
}
dos.flush();
dos.close();
dis.close();

return new ActionForward( "/jsp/partner/test.jsp" );
  }
}

ERRORS:
0) short text file was uploaded without any corruption, but:

1) One jpeg file was uploaded, but had less size then source.

2) Other jpeg file uploading caused an exception:

javax.servlet.ServletException: IOException while reading file element: Premature end 
of stream while reading multipart request
at 
org.apache.struts.upload.MultipartIterator.getNextElement(MultipartIterator.java:222)
at 
org.apache.struts.upload.DiskMultipartRequestHandler.handleRequest(DiskMultipartRequestHandler.java:76)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:735)
at 
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:2061)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1564)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




PLEASE, HELP !!! upload problem

2002-02-22 Thread Serge A. Redchuk

Hello All !

I use the Struts v.1.0.2

Unfortunatelly I can't realize file uploading.

And the most confusing that I have 2 different errors on different
files with the same code.

Here's my form:









Here's form bean:
...
public final class ImagesPartnerForm extends ActionForm {
  private String pkPartner = null;
  private FormFile imgFile = null;
  ...
  public FormFile getImgFile(){
return this.imgFile;
  }
  public void setImgFile( FormFile imgFile ){
this.imgFile = imgFile;
  }
  public void reset( ActionMapping mapping, HttpServletRequest request ){
pkPartner = (String)request.getAttribute( "pkPartner" );
imgFile = null;
  }
...

Here's action that handles form data:
public final class AddImage extends ActionExt {
  public ActionForward perform( ActionMapping mapping, ActionForm form,
 HttpServletRequest request, HttpServletResponse response, String userName )
throws IOException, ServletException
  {
String subpath = "/partner";
String targetDir = ResourceHandler.getProperty( "global",
  "pictures.dyn.abs-root" ) + subpath;
String dbPath = ResourceHandler.getProperty( "global",
  "pictures.dyn.rel-root" ) + subpath;
ImagesPartnerForm iform = (ImagesPartnerForm)form;
FormFile ff = iform.getImgFile();
//
String name = ff.getFileName();
String targetFile = targetDir + "/" + name;
String dbFile = dbPath + "/" + name;
// Save file to filesystem
java.io.DataInputStream dis = new java.io.DataInputStream(
  ff.getInputStream() );
java.io.DataOutputStream dos = new java.io.DataOutputStream(
  new java.io.FileOutputStream( targetFile ) );
for( int i = 0; i < ff.getFileSize(); i++ ){
  dos.writeByte( dis.readByte() );
}
dos.flush();
dos.close();
dis.close();

return new ActionForward( "/jsp/partner/test.jsp" );
  }
}

ERRORS:
0) short text file was uploaded without any corruption, but:

1) One jpeg file was uploaded, but had less size then source.

2) Other jpeg file uploading caused an exception:

javax.servlet.ServletException: IOException while reading file element: Premature end 
of stream while reading multipart request
at 
org.apache.struts.upload.MultipartIterator.getNextElement(MultipartIterator.java:222)
at 
org.apache.struts.upload.DiskMultipartRequestHandler.handleRequest(DiskMultipartRequestHandler.java:76)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:735)
at 
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:2061)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1564)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




PLEASE, HELP !!! upload problem

2002-02-22 Thread Serge A. Redchuk

Hello All !

I use the Struts v.1.0.2

Unfortunatelly I can't realize file uploading.

And the most confusing that I have 2 different errors on different
files with the same code.

Here's my form:









Here's form bean:
...
public final class ImagesPartnerForm extends ActionForm {
  private String pkPartner = null;
  private FormFile imgFile = null;
  ...
  public FormFile getImgFile(){
return this.imgFile;
  }
  public void setImgFile( FormFile imgFile ){
this.imgFile = imgFile;
  }
  public void reset( ActionMapping mapping, HttpServletRequest request ){
pkPartner = (String)request.getAttribute( "pkPartner" );
imgFile = null;
  }
...

Here's action that handles form data:
public final class AddImage extends ActionExt {
  public ActionForward perform( ActionMapping mapping, ActionForm form,
 HttpServletRequest request, HttpServletResponse response, String userName )
throws IOException, ServletException
  {
String subpath = "/partner";
String targetDir = ResourceHandler.getProperty( "global",
  "pictures.dyn.abs-root" ) + subpath;
String dbPath = ResourceHandler.getProperty( "global",
  "pictures.dyn.rel-root" ) + subpath;
ImagesPartnerForm iform = (ImagesPartnerForm)form;
FormFile ff = iform.getImgFile();
//
String name = ff.getFileName();
String targetFile = targetDir + "/" + name;
String dbFile = dbPath + "/" + name;
// Save file to filesystem
java.io.DataInputStream dis = new java.io.DataInputStream(
  ff.getInputStream() );
java.io.DataOutputStream dos = new java.io.DataOutputStream(
  new java.io.FileOutputStream( targetFile ) );
for( int i = 0; i < ff.getFileSize(); i++ ){
  dos.writeByte( dis.readByte() );
}
dos.flush();
dos.close();
dis.close();

return new ActionForward( "/jsp/partner/test.jsp" );
  }
}

ERRORS:
0) short text file was uploaded without any corruption, but:

1) One jpeg file was uploaded, but had less size then source.

2) Other jpeg file uploading caused an exception:

javax.servlet.ServletException: IOException while reading file element: Premature end 
of stream while reading multipart request
at 
org.apache.struts.upload.MultipartIterator.getNextElement(MultipartIterator.java:222)
at 
org.apache.struts.upload.DiskMultipartRequestHandler.handleRequest(DiskMultipartRequestHandler.java:76)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:735)
at 
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:2061)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1564)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




checkbox

2002-01-15 Thread Serge A. Redchuk

Hello struts-user,

  I'm newbie in Struts and encountered a problem when tried to get
  boolean value of checkbox state from my form bean.

  I always have 'true', even if I unchecked my checkbox on form.
  
   In JSP I wrote:
   Published: 

   In Action that must handle the form data:
   ...
   ef.getPublished() - ever true !
   ...

What have I done in wrong way ?

-- 
Best regards,
 Serge  mailto:[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   
For additional commands, e-mail: