Author: musachy Date: Wed May 21 06:44:40 2008 New Revision: 658683 URL: http://svn.apache.org/viewvc?rev=658683&view=rev Log: WW-2651 FileUploadInterceptor.java javadoc is not formatted correctly for Confluence snippets
Thanks to Matthieu Chase Heimer for the patch Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java?rev=658683&r1=658682&r2=658683&view=diff ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java Wed May 21 06:44:40 2008 @@ -108,7 +108,7 @@ * * <!-- START SNIPPET: extending --> * - * You can extend this interceptor and override the [EMAIL PROTECTED] #acceptFile} method to provide more control over which files + * You can extend this interceptor and override the acceptFile method to provide more control over which files * are supported and which are not. * * <!-- END SNIPPET: extending --> @@ -116,27 +116,41 @@ * <p/> <u>Example code:</u> * * <pre> - * <!-- START SNIPPET: example --> - * <action name="doUpload" class="com.examples.UploadAction"> + * <!-- START SNIPPET: example-configuration --> + * <action name="doUpload" class="com.example.UploadAction"> * <interceptor-ref name="fileUpload"/> * <interceptor-ref name="basicStack"/> - * <result name="success">good_result.ftl</result> + * <result name="success">good_result.jsp</result> * </action> + * <!-- END SNIPPET: example-configuration --> * </pre> * - * And then you need to set encoding <code>multipart/form-data</code> in the form where the user selects the file to upload. + * <!-- START SNIPPET: multipart-note --> + * + * You must set the encoding to <code>multipart/form-data</code> in the form where the user selects the file to upload. + * + * <!-- END SNIPPET: multipart-note --> + * * <pre> + * <!-- START SNIPPET: example-form --> * <s:form action="doUpload" method="post" enctype="multipart/form-data"> * <s:file name="upload" label="File"/> * <s:submit/> * </s:form> + * <!-- END SNIPPET: example-form --> * </pre> * * And then in your action code you'll have access to the File object if you provide setters according to the * naming convention documented in the start. * * <pre> - * public com.examples.UploadAction implemements Action { + * <!-- START SNIPPET: example-action --> + * package com.example; + * + * import java.io.File; + * import com.opensymphony.xwork2.ActionSupport; + * + * public UploadAction extends ActionSupport { * private File file; * private String contentType; * private String filename; @@ -153,10 +167,13 @@ * this.filename = filename; * } * - * ... + * public String execute() { + * //... + * return SUCCESS; + * } * } + * <!-- END SNIPPET: example-action --> * </pre> - * <!-- END SNIPPET: example --> * */ public class FileUploadInterceptor extends AbstractInterceptor {