Malsup's jQuery form plugin and JSF 2.2

不羁的心 提交于 2019-12-04 06:49:51

问题


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.

来源:https://stackoverflow.com/questions/28098968/malsups-jquery-form-plugin-and-jsf-2-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!