You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Derrick Koes <De...@skillsoft.com> on 2009/01/06 17:25:59 UTC

file upload file location lost on validation failure

Using the demo app (struts2-showcase-2.0.14/fileupload) and entering an
empty file, for example, will correctly cause validation to fail.
However, the file location disappears from the input.

 

Is this as designed?

 

Thanks,

Derrick


RE: file upload file location lost on validation failure

Posted by Derrick Koes <De...@skillsoft.com>.
That's what I was wondering.  I couldn't make the connection between the
value attribute and the actual HTML.

Thank you for the explanation.

Derrick

-----Original Message-----
From: Dave Newton [mailto:newton.dave@yahoo.com] 
Sent: Tuesday, January 06, 2009 1:06 PM
To: Struts Users Mailing List
Subject: Re: file upload file location lost on validation failure

Derrick Koes wrote:
> There is a value attribute on the file tag from which you can preset
the
> value according to docs.
> 
> http://struts.apache.org/2.0.14/docs/file.html
> 
> It seems like the value could be "updated" from the user input, if the
> input data is available.

File input values cannot be preloaded. This is a browser issue and has 
nothing to do with Struts.

There's a "value" attribute because the tag is extended from a bean that

has a "value" property; that doesn't necessarily mean it's meaningful 
once it gets to the HTML level, and since HTML file input elements are 
one of the only elements that don't allow pre-loading it's arguable that

it doesn't make sense to create a bean without the "value" property just

for it, particularly since it's well-known they can't be pre-loaded.

Dave


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



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


Re: file upload file location lost on validation failure

Posted by Dave Newton <ne...@yahoo.com>.
Derrick Koes wrote:
> There is a value attribute on the file tag from which you can preset the
> value according to docs.
> 
> http://struts.apache.org/2.0.14/docs/file.html
> 
> It seems like the value could be "updated" from the user input, if the
> input data is available.

File input values cannot be preloaded. This is a browser issue and has 
nothing to do with Struts.

There's a "value" attribute because the tag is extended from a bean that 
has a "value" property; that doesn't necessarily mean it's meaningful 
once it gets to the HTML level, and since HTML file input elements are 
one of the only elements that don't allow pre-loading it's arguable that 
it doesn't make sense to create a bean without the "value" property just 
for it, particularly since it's well-known they can't be pre-loaded.

Dave


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


RE: file upload file location lost on validation failure

Posted by Derrick Koes <De...@skillsoft.com>.
There is a value attribute on the file tag from which you can preset the
value according to docs.

http://struts.apache.org/2.0.14/docs/file.html

It seems like the value could be "updated" from the user input, if the
input data is available.

Derrick

-----Original Message-----
From: Dave Newton [mailto:newton.dave@yahoo.com] 
Sent: Tuesday, January 06, 2009 12:29 PM
To: Struts Users Mailing List
Subject: Re: file upload file location lost on validation failure

Derrick Koes wrote:
> Understood.  However, if the value used to populate the field is on
the
> value stack, the input will be populated with the value on validation
> failure, except in this case it seems as the data necessary to
> repopulate is not available.

I think we're talking past each other--file inputs can't be repopulated,

AFAIK. This is a browser issue. What am I missing here?

Dave


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



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


Re: file upload file location lost on validation failure

Posted by Dave Newton <ne...@yahoo.com>.
Derrick Koes wrote:
> Understood.  However, if the value used to populate the field is on the
> value stack, the input will be populated with the value on validation
> failure, except in this case it seems as the data necessary to
> repopulate is not available.

I think we're talking past each other--file inputs can't be repopulated, 
AFAIK. This is a browser issue. What am I missing here?

Dave


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


RE: file upload file location lost on validation failure

Posted by Derrick Koes <De...@skillsoft.com>.
Understood.  However, if the value used to populate the field is on the
value stack, the input will be populated with the value on validation
failure, except in this case it seems as the data necessary to
repopulate is not available.

Derrick

-----Original Message-----
From: Dave Newton [mailto:newton.dave@yahoo.com] 
Sent: Tuesday, January 06, 2009 11:54 AM
To: Struts Users Mailing List
Subject: Re: file upload file location lost on validation failure

Derrick Koes wrote:
> Using the demo app (struts2-showcase-2.0.14/fileupload) and entering
an
> empty file, for example, will correctly cause validation to fail.
> However, the file location disappears from the input.
> 
> Is this as designed?

Do you mean in the file input field? If so, that's normal browser
behavior.

Dave

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



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


Re: file upload file location lost on validation failure

Posted by Dave Newton <ne...@yahoo.com>.
Derrick Koes wrote:
> Using the demo app (struts2-showcase-2.0.14/fileupload) and entering an
> empty file, for example, will correctly cause validation to fail.
> However, the file location disappears from the input.
> 
> Is this as designed?

Do you mean in the file input field? If so, that's normal browser behavior.

Dave

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