tags:

views:

924

answers:

1

Hi all, I am working on struts2 application. I have following in my jsp (say main.jsp) –

<s:file name="sampleDocument"/>
<s:submit action="uploadSample" value="Upload" />

See here how my struts.xml handling the action -

<action name=" uploadSample " class=" UploadFiles">                 
        <result name="success"> /main.jsp</result>
        <result name="input"> /error.jsp</result>
</action>

Its all running well. As required file is uploading. But as you have seen I am calling same jsp page (i.e main.jsp) on SUCCESS. Its coming but textbox in empty. I mean its there is no file name that I have browse before uploading. Can anyone know how to get this?

A: 

You need properties on your action that reflect the names of the parameters in your JSP. Have a look at this documentation for an explanation of which properties to look for.

Peter Kelley
Same I have done but after uploading file when same jsp page appears it does not show the name of the file browsed, i.e textbox of <s:file> tag comes empty. Suggest.
vivmal
Do you have the value attribute of the tag set?
Peter Kelley