File upload with Spring Web Flow
I have searched and read multiple answers on file upload
using Spring Web Flow
but all seems to give same result. Hence posting.
public class FileUploadForm {
private transient MultipartFile file;
//Additional fields
}
Flow
<view-state id="start" model="fileUploadForm">
<transition on="submit" to="submit"/>
<transition on="cancel" to="cancel"/>
</view-state>
<action-state id="submit">
<evaluate expression="someActions.review(fileUploadForm)" />
<transition on="success" to="home"/>
</action-state>
JSP
<form:form modelAttribute="fileUploadForm" enctype="multipart/form-data">
<input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}"/>
<form:label path="file">Upload File</form:label>
<form:input type="file" path="file"/>
<button name="_eventId_upload">Upload Button</button>
</form:form>
XML
<!--<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">-->
<!--<property name="maxUploadSize" value="100000"/>-->
<!--</bean>-->
<bean id="filterMultipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize" value="100000" />
</bean>
JAVA
public String review(FileUploadForm fileUploadForm) {
LOG.info("{}", fileUploadForm.getFile().getContentType());
return "success";
}
At LOG.info
getFile
is null. I do get other fields filled in the form, but not the file field.
Can someone please point me in the right direction. Using Webflow 2.5.1
spring-mvc spring-webflow-2
add a comment |
I have searched and read multiple answers on file upload
using Spring Web Flow
but all seems to give same result. Hence posting.
public class FileUploadForm {
private transient MultipartFile file;
//Additional fields
}
Flow
<view-state id="start" model="fileUploadForm">
<transition on="submit" to="submit"/>
<transition on="cancel" to="cancel"/>
</view-state>
<action-state id="submit">
<evaluate expression="someActions.review(fileUploadForm)" />
<transition on="success" to="home"/>
</action-state>
JSP
<form:form modelAttribute="fileUploadForm" enctype="multipart/form-data">
<input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}"/>
<form:label path="file">Upload File</form:label>
<form:input type="file" path="file"/>
<button name="_eventId_upload">Upload Button</button>
</form:form>
XML
<!--<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">-->
<!--<property name="maxUploadSize" value="100000"/>-->
<!--</bean>-->
<bean id="filterMultipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize" value="100000" />
</bean>
JAVA
public String review(FileUploadForm fileUploadForm) {
LOG.info("{}", fileUploadForm.getFile().getContentType());
return "success";
}
At LOG.info
getFile
is null. I do get other fields filled in the form, but not the file field.
Can someone please point me in the right direction. Using Webflow 2.5.1
spring-mvc spring-webflow-2
do you have getters and setters inFileUploadForm
?
– rptmat57
Jan 2 at 18:05
Yes, its a regular POJO
– java_dude
Jan 3 at 18:53
add a comment |
I have searched and read multiple answers on file upload
using Spring Web Flow
but all seems to give same result. Hence posting.
public class FileUploadForm {
private transient MultipartFile file;
//Additional fields
}
Flow
<view-state id="start" model="fileUploadForm">
<transition on="submit" to="submit"/>
<transition on="cancel" to="cancel"/>
</view-state>
<action-state id="submit">
<evaluate expression="someActions.review(fileUploadForm)" />
<transition on="success" to="home"/>
</action-state>
JSP
<form:form modelAttribute="fileUploadForm" enctype="multipart/form-data">
<input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}"/>
<form:label path="file">Upload File</form:label>
<form:input type="file" path="file"/>
<button name="_eventId_upload">Upload Button</button>
</form:form>
XML
<!--<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">-->
<!--<property name="maxUploadSize" value="100000"/>-->
<!--</bean>-->
<bean id="filterMultipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize" value="100000" />
</bean>
JAVA
public String review(FileUploadForm fileUploadForm) {
LOG.info("{}", fileUploadForm.getFile().getContentType());
return "success";
}
At LOG.info
getFile
is null. I do get other fields filled in the form, but not the file field.
Can someone please point me in the right direction. Using Webflow 2.5.1
spring-mvc spring-webflow-2
I have searched and read multiple answers on file upload
using Spring Web Flow
but all seems to give same result. Hence posting.
public class FileUploadForm {
private transient MultipartFile file;
//Additional fields
}
Flow
<view-state id="start" model="fileUploadForm">
<transition on="submit" to="submit"/>
<transition on="cancel" to="cancel"/>
</view-state>
<action-state id="submit">
<evaluate expression="someActions.review(fileUploadForm)" />
<transition on="success" to="home"/>
</action-state>
JSP
<form:form modelAttribute="fileUploadForm" enctype="multipart/form-data">
<input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}"/>
<form:label path="file">Upload File</form:label>
<form:input type="file" path="file"/>
<button name="_eventId_upload">Upload Button</button>
</form:form>
XML
<!--<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">-->
<!--<property name="maxUploadSize" value="100000"/>-->
<!--</bean>-->
<bean id="filterMultipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize" value="100000" />
</bean>
JAVA
public String review(FileUploadForm fileUploadForm) {
LOG.info("{}", fileUploadForm.getFile().getContentType());
return "success";
}
At LOG.info
getFile
is null. I do get other fields filled in the form, but not the file field.
Can someone please point me in the right direction. Using Webflow 2.5.1
spring-mvc spring-webflow-2
spring-mvc spring-webflow-2
asked Jan 2 at 5:30
java_dudejava_dude
1,67172451
1,67172451
do you have getters and setters inFileUploadForm
?
– rptmat57
Jan 2 at 18:05
Yes, its a regular POJO
– java_dude
Jan 3 at 18:53
add a comment |
do you have getters and setters inFileUploadForm
?
– rptmat57
Jan 2 at 18:05
Yes, its a regular POJO
– java_dude
Jan 3 at 18:53
do you have getters and setters in
FileUploadForm
?– rptmat57
Jan 2 at 18:05
do you have getters and setters in
FileUploadForm
?– rptmat57
Jan 2 at 18:05
Yes, its a regular POJO
– java_dude
Jan 3 at 18:53
Yes, its a regular POJO
– java_dude
Jan 3 at 18:53
add a comment |
1 Answer
1
active
oldest
votes
Try using a regular input file:
<input type="file" name="file" id="file"/>
[EDIT] to be complete, my working code also uses this form tag:
<form:form modelAttribute="fileUploadForm" action="${flowExecutionUrl}&${_csrf.parameterName}=${_csrf.token}" enctype="multipart/form-data">
and this type of submit button:
<input type="submit" id="upload" name="_eventId_upload" value="Upload"></span>
This did not work. Still thankful to your past solution. stackoverflow.com/questions/38635640/…
– java_dude
Jan 3 at 18:53
I edit my answer in case that helps.
– rptmat57
Jan 4 at 19:26
This did not work. But I will try again and give more feedback.
– java_dude
Jan 18 at 14:39
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54001639%2ffile-upload-with-spring-web-flow%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try using a regular input file:
<input type="file" name="file" id="file"/>
[EDIT] to be complete, my working code also uses this form tag:
<form:form modelAttribute="fileUploadForm" action="${flowExecutionUrl}&${_csrf.parameterName}=${_csrf.token}" enctype="multipart/form-data">
and this type of submit button:
<input type="submit" id="upload" name="_eventId_upload" value="Upload"></span>
This did not work. Still thankful to your past solution. stackoverflow.com/questions/38635640/…
– java_dude
Jan 3 at 18:53
I edit my answer in case that helps.
– rptmat57
Jan 4 at 19:26
This did not work. But I will try again and give more feedback.
– java_dude
Jan 18 at 14:39
add a comment |
Try using a regular input file:
<input type="file" name="file" id="file"/>
[EDIT] to be complete, my working code also uses this form tag:
<form:form modelAttribute="fileUploadForm" action="${flowExecutionUrl}&${_csrf.parameterName}=${_csrf.token}" enctype="multipart/form-data">
and this type of submit button:
<input type="submit" id="upload" name="_eventId_upload" value="Upload"></span>
This did not work. Still thankful to your past solution. stackoverflow.com/questions/38635640/…
– java_dude
Jan 3 at 18:53
I edit my answer in case that helps.
– rptmat57
Jan 4 at 19:26
This did not work. But I will try again and give more feedback.
– java_dude
Jan 18 at 14:39
add a comment |
Try using a regular input file:
<input type="file" name="file" id="file"/>
[EDIT] to be complete, my working code also uses this form tag:
<form:form modelAttribute="fileUploadForm" action="${flowExecutionUrl}&${_csrf.parameterName}=${_csrf.token}" enctype="multipart/form-data">
and this type of submit button:
<input type="submit" id="upload" name="_eventId_upload" value="Upload"></span>
Try using a regular input file:
<input type="file" name="file" id="file"/>
[EDIT] to be complete, my working code also uses this form tag:
<form:form modelAttribute="fileUploadForm" action="${flowExecutionUrl}&${_csrf.parameterName}=${_csrf.token}" enctype="multipart/form-data">
and this type of submit button:
<input type="submit" id="upload" name="_eventId_upload" value="Upload"></span>
edited Jan 4 at 19:25
answered Jan 2 at 18:11
rptmat57rptmat57
2,59711730
2,59711730
This did not work. Still thankful to your past solution. stackoverflow.com/questions/38635640/…
– java_dude
Jan 3 at 18:53
I edit my answer in case that helps.
– rptmat57
Jan 4 at 19:26
This did not work. But I will try again and give more feedback.
– java_dude
Jan 18 at 14:39
add a comment |
This did not work. Still thankful to your past solution. stackoverflow.com/questions/38635640/…
– java_dude
Jan 3 at 18:53
I edit my answer in case that helps.
– rptmat57
Jan 4 at 19:26
This did not work. But I will try again and give more feedback.
– java_dude
Jan 18 at 14:39
This did not work. Still thankful to your past solution. stackoverflow.com/questions/38635640/…
– java_dude
Jan 3 at 18:53
This did not work. Still thankful to your past solution. stackoverflow.com/questions/38635640/…
– java_dude
Jan 3 at 18:53
I edit my answer in case that helps.
– rptmat57
Jan 4 at 19:26
I edit my answer in case that helps.
– rptmat57
Jan 4 at 19:26
This did not work. But I will try again and give more feedback.
– java_dude
Jan 18 at 14:39
This did not work. But I will try again and give more feedback.
– java_dude
Jan 18 at 14:39
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54001639%2ffile-upload-with-spring-web-flow%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
do you have getters and setters in
FileUploadForm
?– rptmat57
Jan 2 at 18:05
Yes, its a regular POJO
– java_dude
Jan 3 at 18:53