werpu commented on PR #356:
URL: https://github.com/apache/myfaces/pull/356#issuecomment-1311626485
Ok I have fixed both reported "issues"
The multiple files upload now works as expected:
Example:
```
<h:form id="testForm" type="multipart/form-data"
enctype="multipart/form-data">
<h:inputFile id="bla" value="#{fileupload.uploaded3}"
multiple="true">
</h:inputFile>
<h:commandLink id="bla2" value="Upload"
action="#{fileupload.doUpload2}" type="button">
<f:ajax execute="@form" render="successfield" />
</h:commandLink>
<h:outputText id="successfield"
value="#{fileupload.msg}"></h:outputText>
</h:form>
```
```java
@Named
@RequestScoped
public class Fileupload {
private List<Part> uploaded3;
...
public void doUpload2() {
if(uploaded3 != null) {
msg = "success";
}
}
```
Results in a success message and the number of incoming parts as well as
their dats looks correct.
also if you want to pass outside passthrough data, the implementation
follows now closely the spec:
```javascript
faces.ajax.request(element, null, {
execute: "input_1",
resetValues: true,
render: "@form",
params: {
pass1: "pass1",
pass2: "pass2"
}
});
```
It used to be:
```javascript
faces.ajax.request(element, null, {
execute: "input_1",
resetValues: true,
render: "@form",
pass1: "pass1",
pass2: "pass2"
});
```
Atm I support both formats, but I marked the second one (the old one in our
code as deprecated to take it out once it is clear we do not have to support
this anymore)
We also have this issue in our old code, this is clearly a spec breach from
our side, so it needs to be fixed.
Will take care of that on monday, by adding the option 1 of the two to our
old code and still allow the "faulty" way to pass those parameters.
Also to solve the issue for @volosied I added an option to allow the
passthrough of parameters as tuple arrays:
For now only this construct (which is really bending the spec) works:
```javascript
faces.ajax.request(element, null, {
execute: "input_1",
render: "@form",
params: [["pass1", "pass1"],
["pass2", "pass2"]],
```
I hope this resolves the test problem from @volosied but in the end I would
recommend to shift the parameter passing to an associative array instead of
tuple arrays. Because the RI definitely will break on such a construct.
(I can take it out again, if not wanted, it is just 3 loc and a test)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]