struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amit Rana" <amit.r...@gmail.com>
Subject Re: Struts 2, file tag, accept attribute not working?
Date Thu, 13 Dec 2007 12:53:54 GMT
Martin,
 Thanks for the response but unless I am missing something how do you
expect this to work?
> if("%{uploadContentType}%"=="'text/xml'")
When this server side code runs you dont have any information about
what the user is going to upload......

Has anyone got accept or size attribute of s:file tag to work?

Thanks,
Amit.

---------- Forwarded message ----------
From: "Martin Gainty" <mgainty@hotmail.com>
To: "Struts Users Mailing List" <user@struts.apache.org>
Date: Wed, 12 Dec 2007 21:59:17 -0500
Subject: Re: Struts 2, file tag, accept attribute not working?
you can hook the submit event to JS function and then test the content type
before submitting
<head>
 <script language="JavaScript" type="text/javascript">
function doSubmit()
{
 if("%{uploadContentType}%"=="'text/xml'")
 {
 document.form.action="WhateverAction";
 document.form.submit();
 }
}
   </script>
</head>
<s:form action="'javascript:doSubmit()'">
   <s:file
           tooltip="Upload Your XML file"
           label="XML file"
           name="XML file" />
   <s:submit onclick="javascript:doSubmit()" />
</s:form>

----- Original Message -----
From: "Amit Rana" <amit.rana@gmail.com>
To: <user@struts.apache.org>
Sent: Wednesday, December 12, 2007 5:48 AM
Subject: Re: Struts 2, file tag, accept attribute not working?


> Hi Anton,
>  Were you able to finally get it to work?
>
>  I am using 2.0.9 and accept just doens't seem to be doing anything.
>
> Regards,
> Amit.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message