This commit is contained in:
Frederic Debuire
2007-12-14 14:57:31 +00:00
parent b8f073ac91
commit a380ecebef
5 changed files with 109 additions and 6 deletions

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-1.0.xsd">
<start-state idref="selectFile"/>
<view-state id="selectFile" view="submissionArticleFile">
<transition on="submit" to="uploadFile"/>
</view-state>
<action-state id="uploadFile">
<action bean="uploadAction"/>
<transition on="success" to="selectFile">
<set attribute="fileUploaded" scope="flash" value="true"/>
</transition>
<transition on="error" to="selectFile"/>
</action-state>
</flow>

View File

@@ -12,6 +12,8 @@
<h2 align="center"><fmt:message key="submission.title" /></h2> <h2 align="center"><fmt:message key="submission.title" /></h2>
<form:form method="post" commandName="submissionArticle"> <form:form method="post" commandName="submissionArticle">
<fmt:message key="form.submission.article.title" /> <form:input path="title"/> <br/><br /> <fmt:message key="form.submission.article.title" /> <form:input path="title"/> <br/><br />
<fmt:message key="form.submission.article.theme" /> <form:input path="theme"/> <br/><br /> <fmt:message key="form.submission.article.theme" /> <form:input path="theme"/> <br/><br />
@@ -25,9 +27,9 @@
<hr /> <br /> <hr /> <br />
<fmt:message key="form.submission.file" /> <form:input path="file"/> <input type="submit" value="Parcourir"> <br/><br />
<input type="submit" value=<fmt:message key="button.cancel" />> <input type="submit" value=<fmt:message key="button.cancel" />>
<input type="submit" value=<fmt:message key="button.OK" />> <br/><br/> <input type="submit" value=<fmt:message key="button.OK" />> <br/><br/>
</form:form> </form:form>

View File

@@ -0,0 +1,45 @@
<%@ page contentType="text/html" %>
<%@ page session="true" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<form name="submitForm" method="post" enctype="multipart/form-data" action="submissionArticleOK.htm">
<table>
<c:if test="${fileUploaded}">
<p>File uploaded succesfully.</p>
<c:if test="${!empty(file)}">
<pre style="border: solid 1px;">${file}</pre>
</c:if>
</c:if>
<tr>
<td>
File:
</td>
<td>
<input type="file" name="file">
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2" class="buttonBar">
<input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}">
<input type="submit" class="button" name="_eventId_submit" value="Upload">
</td>
</tr>
</table>
</form>
</body>
</html>

View File

@@ -1,5 +1,7 @@
<%@ include file="/WEB-INF/jsp/include.jsp"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ page session="true" %>
<html> <html>
@@ -11,6 +13,13 @@
Soumission OK Soumission OK
<c:if test="${fileUploaded}">
<p>File uploaded succesfully.</p>
<c:if test="${!empty(file)}">
<pre style="border: solid 1px;">${file}</pre>
</c:if>
</c:if>
<a href="<c:url value="main.htm"/>">Home</a> <a href="<c:url value="main.htm"/>">Home</a>
</body> </body>

View File

@@ -1,10 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:flow="http://www.springframework.org/schema/webflow-config"
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="http://www.springframework.org/schema/beans xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/webflow-config
http://www.springframework.org/schema/webflow-config/spring-webflow-config-1.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-2.5.xsd"> http://www.springframework.org/schema/jee/spring-jee-2.5.xsd">
@@ -19,7 +22,7 @@
<property name="commandName" value="submissionArticle" /> <property name="commandName" value="submissionArticle" />
<property name="commandClass" value="org.yacos.web.author.form.FormSubmission" /> <property name="commandClass" value="org.yacos.web.author.form.FormSubmission" />
<property name="formView" value="submissionArticle" /> <property name="formView" value="submissionArticle" />
<property name="successView" value="submissionArticleOK.htm" /> <property name="successView" value="submissionArticleFile.htm?_flowId=fileupload" />
<property name="articleManager" ref="articleManager" /> <property name="articleManager" ref="articleManager" />
</bean> </bean>
@@ -30,7 +33,30 @@
</property> </property>
<property name="prefix" value="/WEB-INF/jsp/"></property> <property name="prefix" value="/WEB-INF/jsp/"></property>
<property name="suffix" value=".jsp"></property> <property name="suffix" value=".jsp"></property>
</bean> </bean>
<bean name="/submissionArticleFile.htm" class="org.springframework.webflow.executor.mvc.FlowController">
<property name="flowExecutor" ref="flowExecutor" />
</bean>
<!-- Launches new flow executions and resumes existing executions. -->
<flow:executor id="flowExecutor" registry-ref="flowRegistry" repository-type="singlekey"/>
<!-- Creates the registry of flow definitions for this application -->
<flow:registry id="flowRegistry">
<flow:location path="/WEB-INF/fileupload.xml" />
</flow:registry>
<!--
Support for multipart requests using commons file upload
Make sure you have the commons-fileupload.jar in your classpath
-->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- Limit uploads to small (5KB) files for this sample -->
<property name="maxUploadSize" value="5120" />
</bean>
<bean id="uploadAction" class="org.yacos.web.utils.FileUploadAction" />
<bean id="messageSource" <bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource"> class="org.springframework.context.support.ResourceBundleMessageSource">