Friday, 10 February 2012

Struts2 FileUpload & Save




This is the layout of the project (in Netbeans 6.9)

struts.xml
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
<!-- Configuration for the default package. -->
<package name="default" extends="struts-default" namespace="/">

<action name="userImage" class="FileUploadAction">
<interceptor-ref name="i18n"/>
<interceptor-ref name="fileUpload">
<param name="allowedTypes">
image/png,image/gif,image/jpeg,image/pjpeg
</param>
<param name="maximumSize">2097152</param>
</interceptor-ref>
<interceptor-ref name="defaultStack"></interceptor-ref>

<result name="success">UserImage.jsp</result>
<result name="input">UserImage.jsp</result>
</action>
</package>
</struts>

No comments:

Post a Comment