validation de formulaire SubmissionArticle
Policy failures: Code warning - failed on resource validator. Reason: Class is a raw type. References to generic type Class<T> should be parameterized, line 10 - failed on resource ValidateSubmission.java. Reason: Class is a raw type. References to generic type Class<T> should be parameterized, line 10 - failed on resource validator. Reason: The local variable file is never read, line 22 - failed on resource ValidateSubmission.java. Reason: The local variable file is never read, line 2 Override reason:
This commit is contained in:
@@ -20,15 +20,18 @@ function Supprimer(form) {
|
|||||||
<form:form method="post" enctype="multipart/form-data" commandName="submissionArticle">
|
<form:form method="post" enctype="multipart/form-data" commandName="submissionArticle">
|
||||||
|
|
||||||
|
|
||||||
<form:label path="title"><fmt:message key="form.submission.article.title" /></form:label> <form:input path="title"/> <br/><br />
|
<form:label path="title"><fmt:message key="form.submission.article.title" /></form:label> <form:input path="title"/> <font color="red"><form:errors path="title"/></font> <br/><br />
|
||||||
<form:label path="theme"><fmt:message key="form.submission.article.theme" /></form:label> <form:input path="theme"/> <br/><br />
|
|
||||||
|
|
||||||
<form:label path="abstractText"><fmt:message key="form.submission.article.abstractText" /></form:label> <form:textarea path="abstractText" /><br/><br/>
|
<form:label path="theme"><fmt:message key="form.submission.article.theme" /></form:label> <form:input path="theme"/> <font color="red"><form:errors path="theme"/></font><br/><br />
|
||||||
|
|
||||||
<hr /> <br />
|
<form:label path="abstractText"><fmt:message key="form.submission.article.abstractText" /></form:label> <form:textarea path="abstractText" /><font color="red"><form:errors path="abstractText"/></font><br/><br/>
|
||||||
|
|
||||||
|
<hr/> <br/>
|
||||||
|
|
||||||
<label for="listauthor"><fmt:message key="form.submission.listauthor" /></label> <br /><br />
|
<label for="listauthor"><fmt:message key="form.submission.listauthor" /></label> <br /><br />
|
||||||
<form:label path="mainauthor"><fmt:message key="form.submission.mainauthor" /></form:label> <form:input path="mainauthor" /> <br/><br />
|
<form:label path="mainauthor"><fmt:message key="form.submission.mainauthor" /></form:label> <form:input path="mainauthor" />
|
||||||
|
<font color="red"><form:errors path="mainauthor"/></font>
|
||||||
|
<br/> <br/>
|
||||||
<form:label path="secondaryauthor"><fmt:message key="form.submission.secondaryauthor" /></form:label> <form:input path="secondaryauthor" />
|
<form:label path="secondaryauthor"><fmt:message key="form.submission.secondaryauthor" /></form:label> <form:input path="secondaryauthor" />
|
||||||
<input type="button" name="addSecondary" onClick="Ajouter(this.form)" value=<fmt:message key="button.add" />> <br/><br />
|
<input type="button" name="addSecondary" onClick="Ajouter(this.form)" value=<fmt:message key="button.add" />> <br/><br />
|
||||||
|
|
||||||
@@ -42,8 +45,8 @@ function Supprimer(form) {
|
|||||||
<br />
|
<br />
|
||||||
File <input type="file" name="file"/>
|
File <input type="file" name="file"/>
|
||||||
|
|
||||||
<br /><br />
|
|
||||||
|
|
||||||
|
<br /><br />
|
||||||
<input type="reset" value="<fmt:message key="button.reset" />"/>
|
<input type="reset" value="<fmt:message key="button.reset" />"/>
|
||||||
<input type="submit" value="<fmt:message key="button.OK" />"/> <br/><br/>
|
<input type="submit" value="<fmt:message key="button.OK" />"/> <br/><br/>
|
||||||
|
|
||||||
|
|||||||
@@ -106,8 +106,12 @@
|
|||||||
<property name="formView" value="submissionArticle" />
|
<property name="formView" value="submissionArticle" />
|
||||||
<property name="successView" value="listArticle.htm" />
|
<property name="successView" value="listArticle.htm" />
|
||||||
<property name="articleManager" ref="articleManager" />
|
<property name="articleManager" ref="articleManager" />
|
||||||
|
<property name="validator" ref="submissionCheck"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="submissionCheck" class="org.yacos.web.author.validator.ValidateSubmission">
|
||||||
|
</bean>
|
||||||
|
|
||||||
<bean id="ChoosePreferenceController"
|
<bean id="ChoosePreferenceController"
|
||||||
class="org.yacos.web.PCmember.controller.ChoosePreferenceController">
|
class="org.yacos.web.PCmember.controller.ChoosePreferenceController">
|
||||||
<property name="sessionForm" value="true" />
|
<property name="sessionForm" value="true" />
|
||||||
@@ -233,10 +237,7 @@
|
|||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
|
||||||
|
<dwr:controller id="dwrController" debug="true"></dwr:controller>
|
||||||
|
|
||||||
|
|
||||||
<dwr:controller id="dwrController" debug="true"></dwr:controller>
|
|
||||||
<dwr:configuration>
|
<dwr:configuration>
|
||||||
<dwr:convert type="bean"
|
<dwr:convert type="bean"
|
||||||
class="org.yacos.web.chairman.form.FormConference">
|
class="org.yacos.web.chairman.form.FormConference">
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package org.yacos.web.author.validator;
|
||||||
|
|
||||||
|
import org.springframework.validation.Errors;
|
||||||
|
import org.springframework.validation.Validator;
|
||||||
|
import org.yacos.web.author.form.FormSubmission;
|
||||||
|
|
||||||
|
|
||||||
|
public class ValidateSubmission implements Validator {
|
||||||
|
|
||||||
|
public boolean supports(Class arg0) {
|
||||||
|
return FormSubmission.class.isAssignableFrom(arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void validate(Object arg0, Errors arg1) {
|
||||||
|
|
||||||
|
FormSubmission sub=(FormSubmission)arg0;
|
||||||
|
|
||||||
|
String title=sub.getTitle();
|
||||||
|
String theme=sub.getTheme();
|
||||||
|
String abs=sub.getAbstractText();
|
||||||
|
String mainauthor=sub.getMainauthor();
|
||||||
|
String file=sub.getFile().getName();
|
||||||
|
|
||||||
|
if (title== null || title.trim().length() == 0) {
|
||||||
|
arg1.rejectValue("title",
|
||||||
|
"submissionArticle.title",
|
||||||
|
"Le title est n<><6E>cessaire !");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (theme==null|theme.trim().length()==0)
|
||||||
|
|
||||||
|
{
|
||||||
|
arg1.rejectValue("theme", "submissionArticle.theme");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (abs==null|abs.trim().length()==0)
|
||||||
|
|
||||||
|
{ arg1.rejectValue("abstractText", "submissionArticle.abstractText", "text is not nullable");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (mainauthor==null|mainauthor.trim().length()==0)
|
||||||
|
|
||||||
|
{
|
||||||
|
arg1.rejectValue("mainauthor", "submissionArticle.mainauthor");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* if (file==null|file.trim().length()==0)
|
||||||
|
|
||||||
|
{
|
||||||
|
arg1.rejectValue("file", "submissionArticle.file");
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user