tags:

views:

29

answers:

0

I have this jsp

<s:form action="saveOrUpdateProduct" method="post" enctype="multipart/form-data" validate="true" theme="css_xhtml ">
    <s:textfield name="product.productName" label="Name" required="true" requiredposition="left" labelposition="left"></s:textfield>
    <br>
    <s:textfield name="product.productPrice" label="Price" required="true" requiredposition="left" value="1.0" labelposition="left"></s:textfield>
    <br>
    <s:hidden name="product.available" value="true"></s:hidden>
    <s:textarea name="product.productDescription" label="Description" required="true" requiredposition="left" labelposition="left"></s:textarea>
    <br>
    <s:action name="populate" executeResult="true"/>
    <s:file name="userImage" label="Picture" required="true" requiredposition="left" labelposition="left"/>
    <br>
    <s:submit value="Add"></s:submit>
    <br>
    </div>
</s:form>

If the file uploaded isn't a picture i would like to return to the same page with an error message, but when i try this, it shows the same page without executing <s:action name="populate"> that populates 2 <s:select>

I couldn't find an example that works. The example from Struts 2 documentation works for result name="success", but not for "input".