}
else
{
- return ERROR;
+ return INPUT;
}
}
+ public String doInput()
+ {
+ return SUCCESS;
+ }
+
public String getQ()
{
return q;
--- /dev/null
+<!--
+ ~ 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>
\ No newline at end of file
+++ /dev/null
-<!--
- ~ 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>
\ No newline at end of file
<!-- 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>
<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>
--%>
<html>
-<head><title>Quick Search</title></head>
+<head>
+ <title>Quick Search</title>
+ <ww:head />
+</head>
<body>
<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>
font-weight: bold;
}
+/* WebWork validation failures */
+.errorMessage {
+ color: red;
+ font-weight: bold;
+}