add in basic validation

git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@420447 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2006-07-10 07:01:58 +00:00
parent 9d09051e47
commit d0304eb8a2
6 changed files with 49 additions and 44 deletions

View File

@ -95,10 +95,15 @@ public class QuickSearchAction
}
else
{
return ERROR;
return INPUT;
}
}
public String doInput()
{
return SUCCESS;
}
public String getQ()
{
return q;

View File

@ -0,0 +1,26 @@
<!--
~ Copyright 2005-2006 The Apache Software Foundation.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
<validators>
<field name="q">
<field-validator type="requiredstring">
<message>You must enter some search terms.</message>
</field-validator>
</field>
</validators>

View File

@ -1,29 +0,0 @@
<!--
~ Copyright 2005-2006 The Apache Software Foundation.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<validators>
<validator name="required" class="com.opensymphony.webwork.validators.JavaScriptRequiredFieldValidator"/>
<validator name="requiredstring" class="com.opensymphony.webwork.validators.JavaScriptRequiredStringValidator"/>
<validator name="int" class="com.opensymphony.webwork.validators.JavaScriptIntRangeFieldValidator"/>
<validator name="date" class="com.opensymphony.webwork.validators.JavaScriptDateRangeFieldValidator"/>
<validator name="expression" class="com.opensymphony.xwork.validator.validators.ExpressionValidator"/>
<validator name="fieldexpression" class="com.opensymphony.xwork.validator.validators.FieldExpressionValidator"/>
<validator name="email" class="com.opensymphony.webwork.validators.JavaScriptEmailValidator"/>
<validator name="url" class="com.opensymphony.webwork.validators.JavaScriptURLValidator"/>
<validator name="visitor" class="com.opensymphony.webwork.validators.JavaScriptVisitorFieldValidator"/>
<validator name="conversion" class="com.opensymphony.xwork.validator.validators.ConversionErrorFieldValidator"/>
<validator name="stringlength" class="com.opensymphony.xwork.validator.validators.StringLengthFieldValidator"/>
</validators>

View File

@ -26,23 +26,18 @@
<!-- Default interceptor stack. -->
<default-interceptor-ref name="defaultStack"/>
<action name="index" class="baseAction">
<action name="index" class="quickSearchAction" method="input">
<result name="success" type="dispatcher">/WEB-INF/jsp/quickSearch.jsp</result>
<interceptor-ref name="validationWorkflowStack"/>
</action>
<action name="quickSearch" class="quickSearchAction">
<result name="input" type="dispatcher">/WEB-INF/jsp/quickSearch.jsp</result>
<result name="success" type="dispatcher">/WEB-INF/jsp/results.jsp</result>
<result name="error" type="dispatcher">/WEB-INF/jsp/index.jsp</result>
<interceptor-ref name="validationWorkflowStack"/>
</action>
<!-- TODO! old actions -->
<!--
<action name="index" class="org.apache.maven.repository.manager.web.action.BaseAction">
<result name="success" type="dispatcher">/WEB-INF/jsp/index.jsp</result>
<result name="error" type="dispatcher">/WEB-INF/jsp/index.jsp</result>
</action>
-->
<!-- TODO! old actions
<action name="proxy" class="org.apache.maven.repository.proxy.web.action.RepositoryProxyAction">
<result name="success" type="stream">
<param name="contentType">application/octet-stream</param>
@ -77,7 +72,7 @@
<result name="success" type="dispatcher">/WEB-INF/jsp/indexConfigUpdateSuccess.jsp</result>
<result name="error" type="dispatcher">/WEB-INF/jsp/index.jsp</result>
</action>
-->
</package>
</xwork>

View File

@ -16,7 +16,10 @@
--%>
<html>
<head><title>Quick Search</title></head>
<head>
<title>Quick Search</title>
<ww:head />
</head>
<body>
@ -24,8 +27,8 @@
<div id="contentArea">
<div id="searchBox">
<ww:form action="quickSearch.action">
<ww:textfield size="50" name="q" />
<ww:form method="post" action="quickSearch" validate="true">
<ww:textfield label="Search for" size="50" name="q" />
<ww:submit label="Go!" />
</ww:form>
<p>

View File

@ -110,3 +110,8 @@
font-weight: bold;
}
/* WebWork validation failures */
.errorMessage {
color: red;
font-weight: bold;
}