Malsup's jQuery form plugin and JSF 2.2

2019-03-06 01:43发布

Is it possible to use Malsup's plugin to upload files like this example using JSF 2.2 so I can use its progress bar?

On html forms, it seems to work around the 'name' attribute from the <input type="file">s, all 3 being "myfile[]" in the example. Unfortunately, its equivalent in jsf is <h:inputFile>, which doesn't have a name attribute. Well, <h:inputFile> can have an id and then its name will have the same value in the generated html, but since ids are unique, so will be their names.

The thing is, I don't know how/if the names impact on how the plugin handles a submit with multiple inputs. That's what got me thinking in the first place.

The same "no-name attribute" goes for the <h:form>, but it isn't that bad, since I'll only have 1 form anyway, thus I can just give it an id for a name. It doesn't have an action either, which seems to be used by the plugin, but I can overcome that with a <h:commandButton type="submit" action="someaction">, although I don't know if that's ok with the plugin. At least for the example, it looks good.

I've been playing with this plugin for a couple of days now, but I guess it's time to ask for an explanation. Can someone shed some light on those points? If it's possible with jsf, how would the example's form look like? Bear in mind that my ultimate goal is to try the plugin's progress bar out. Setting those inputs adequately is just a means to achieve that.

0条回答
登录 后发表回答