This commit is contained in:
21
YACOSWeb/WebContent/WEB-INF/fileupload.xml
Normal file
21
YACOSWeb/WebContent/WEB-INF/fileupload.xml
Normal 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>
|
||||
@@ -12,6 +12,8 @@
|
||||
<h2 align="center"><fmt:message key="submission.title" /></h2>
|
||||
|
||||
<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.theme" /> <form:input path="theme"/> <br/><br />
|
||||
|
||||
@@ -25,9 +27,9 @@
|
||||
|
||||
<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.OK" />> <br/><br/>
|
||||
|
||||
</form:form>
|
||||
|
||||
|
||||
|
||||
45
YACOSWeb/WebContent/WEB-INF/jsp/submissionArticleFile.jsp
Normal file
45
YACOSWeb/WebContent/WEB-INF/jsp/submissionArticleFile.jsp
Normal 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>
|
||||
@@ -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"%>
|
||||
<%@ page session="true" %>
|
||||
|
||||
<html>
|
||||
|
||||
@@ -11,6 +13,13 @@
|
||||
|
||||
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>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
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"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
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/spring-jee-2.5.xsd">
|
||||
|
||||
@@ -19,7 +22,7 @@
|
||||
<property name="commandName" value="submissionArticle" />
|
||||
<property name="commandClass" value="org.yacos.web.author.form.FormSubmission" />
|
||||
<property name="formView" value="submissionArticle" />
|
||||
<property name="successView" value="submissionArticleOK.htm" />
|
||||
<property name="successView" value="submissionArticleFile.htm?_flowId=fileupload" />
|
||||
<property name="articleManager" ref="articleManager" />
|
||||
</bean>
|
||||
|
||||
@@ -32,6 +35,29 @@
|
||||
<property name="suffix" value=".jsp"></property>
|
||||
</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"
|
||||
class="org.springframework.context.support.ResourceBundleMessageSource">
|
||||
<property name="basename" value="messages" />
|
||||
|
||||
Reference in New Issue
Block a user