You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dirk Behrendt <sc...@web.de> on 2003/07/29 21:55:47 UTC
Problem in using Validator Framework with Struts
Hello!
I have a problem in using the Validator framework with Struts.
I want to check textfields.
When I start Tomcat, I got a lot of parse erros like this:
element type "plug-in" must be declared.
org.xml.SAXParseException
I looked at other validation examples, but I did the same like in these
examples.
What is the general problem of such errors?
Thanx!
Dirk
struts-config.xml
-----------------
<form-bean
name="loginForm"
type="org.apache.struts.webapp.validator.RegistrationForm"/>
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/WEB-INF/validator-rules.xml,
/WEB-INF/validation.xml"/>
</plug-in>
validation.xml
--------------
<form name="loginForm">
<field
property="login"
depends="required,mask">
<arg0 key="lable.login"/>
<var>
<var-name>mask</var-name>
<var-value>^[a-zA-Z0-9_.-]*$</var-value>
</var>
</field>
<field
property="password"
depends="required,mask">
<arg0 key="lable.password"/>
<var>
<var-name>mask</var-name>
<var-value>^[a-zA-Z0-9_.-]*$</var-value>
</var>
</field>
</form>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Validator Framework: Can not evaluate regular expression
Posted by Jeff Kyser <kt...@comcast.net>.
If your code is a direct cut-n-paste, you've got an extra '>' in
your first regular expression?
<var-value>>^[a-zA-Z0-9_.-]*$</var-value>
-jeff
On Wednesday, July 30, 2003, at 07:14 AM, Dirk Behrendt wrote:
> <var-value>>^[a-zA-Z0-9_.-]*$</var-value>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Validator Framework: Can not evaluate regular expression
Posted by Dirk Behrendt <sc...@web.de>.
Hello!
I want to check login and password fields.
If I submit with empty textfields, the errors are shown correct (....
required). But my regular expression was ignored. (see code below).
What is necessary to check regular expressions?
Dirk
Struts-config.xml
-----------------
form-bean name="loginForm"
type="sample.LoginForm"/>
<!-- User login -->
<action path="/login"
type="sample.LoginAction"
name="loginForm"
scope="session"
validate="true"
input="/loginDone.jsp">
</action>
validation.xml
--------------
<form name="loginForm">
<field
property="login"
depends="required,mask">
<msg name="mask" key="error.loginForm.character.maskmsg"/>
<arg0 key="label.login"/>
<var>
<var-name>mask</var-name>
<var-value>>^[a-zA-Z0-9_.-]*$</var-value>
</var>
</field>
<field
property="password"
depends="required,mask">
<msg name="mask" key="error.loginForm.character.maskmsg"/>
<arg0 key="label.password"/>
<var>
<var-name>mask</var-name>
<var-value>^[a-zA-Z0-9_.-]*$</var-value>
</var>
</field>
</form>
In my JSP
-----------
<logic:messagesPresent>
<bean:message key="errors.header"/>
<ul>
<html:messages id="error">
<li><bean:write name="error"/></li>
</html:messages>
</ul><hr>
</logic:messagesPresent>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Buttons and Actions without forms
Posted by Todor Sergueev Petkov <t....@basalmed.uio.no>.
Hello everybody,
I was wandering if Struts framework and taglibs permit
to have a button and an action associated with this button with no
forms however. Example - when I click on that button just a pop up
window comes up ?
Todor
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
AW: Problem in using Validator Framework with Struts
Posted by Dirk Behrendt <sc...@web.de>.
Hi!
No, the code was not cut and paste...
Dirk
If your code is a direct cut-n-paste, you've got an extra '>' in your
first regular expression?
<var-value>>^[a-zA-Z0-9_.-]*$</var-value>
-jeff
On Wednesday, July 30, 2003, at 07:14 AM, Dirk Behrendt wrote:
> <var-value>>^[a-zA-Z0-9_.-]*$</var-value>
-----Ursprüngliche Nachricht-----
Von: Dirk Behrendt [mailto:schnoerk@web.de]
Gesendet: Mittwoch, 30. Juli 2003 14:14
An: struts-user@jakarta.apache.org
Betreff: AW: Problem in using Validator Framework with Struts
Hello!
I found the problem. I poited to a wrong DTD...
Thanx!
Dirk
-----Ursprüngliche Nachricht-----
Von: Stephan Wiesner [mailto:stephan@stephan-wiesner.de]
Gesendet: Mittwoch, 30. Juli 2003 06:58
An: Struts Users Mailing List
Betreff: Re: Problem in using Validator Framework with Struts
Hi Dirk,
did you activate the plugin in struts-config? Maybe a typo? Struts 1.1
already contains the activated plugin and there is an example war where
you might want to copy paste some lines.
Dirk Behrendt wrote:
>Hello!
>
>I have a problem in using the Validator framework with Struts.
>
>I want to check textfields.
>
>When I start Tomcat, I got a lot of parse erros like this:
>
>element type "plug-in" must be declared.
>org.xml.SAXParseException
>
>I looked at other validation examples, but I did the same like in these
>examples.
>What is the general problem of such errors?
>
>Thanx!
>
>Dirk
>
>
>
>
>struts-config.xml
>-----------------
>
>
><form-bean
> name="loginForm"
> type="org.apache.struts.webapp.validator.RegistrationForm"/>
>
>
><plug-in className="org.apache.struts.validator.ValidatorPlugIn">
> <set-property property="pathnames"
>value="/WEB-INF/validator-rules.xml,
>
/WEB-INF/validation.xml"/>
> </plug-in>
>
>
>validation.xml
>--------------
>
><form name="loginForm">
> <field
> property="login"
> depends="required,mask">
> <arg0 key="lable.login"/>
> <var>
> <var-name>mask</var-name>
> <var-value>^[a-zA-Z0-9_.-]*$</var-value>
> </var>
> </field>
> <field
> property="password"
> depends="required,mask">
> <arg0 key="lable.password"/>
> <var>
> <var-name>mask</var-name>
> <var-value>^[a-zA-Z0-9_.-]*$</var-value>
> </var>
> </field>
> </form>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
AW: Problem in using Validator Framework with Struts
Posted by Dirk Behrendt <sc...@web.de>.
Hello!
I found the problem. I poited to a wrong DTD...
Thanx!
Dirk
-----Ursprüngliche Nachricht-----
Von: Stephan Wiesner [mailto:stephan@stephan-wiesner.de]
Gesendet: Mittwoch, 30. Juli 2003 06:58
An: Struts Users Mailing List
Betreff: Re: Problem in using Validator Framework with Struts
Hi Dirk,
did you activate the plugin in struts-config? Maybe a typo? Struts 1.1
already contains the activated plugin and there is an example war where
you might want to copy paste some lines.
Dirk Behrendt wrote:
>Hello!
>
>I have a problem in using the Validator framework with Struts.
>
>I want to check textfields.
>
>When I start Tomcat, I got a lot of parse erros like this:
>
>element type "plug-in" must be declared.
>org.xml.SAXParseException
>
>I looked at other validation examples, but I did the same like in these
>examples.
>What is the general problem of such errors?
>
>Thanx!
>
>Dirk
>
>
>
>
>struts-config.xml
>-----------------
>
>
><form-bean
> name="loginForm"
> type="org.apache.struts.webapp.validator.RegistrationForm"/>
>
>
><plug-in className="org.apache.struts.validator.ValidatorPlugIn">
> <set-property property="pathnames"
>value="/WEB-INF/validator-rules.xml,
>
/WEB-INF/validation.xml"/>
> </plug-in>
>
>
>validation.xml
>--------------
>
><form name="loginForm">
> <field
> property="login"
> depends="required,mask">
> <arg0 key="lable.login"/>
> <var>
> <var-name>mask</var-name>
> <var-value>^[a-zA-Z0-9_.-]*$</var-value>
> </var>
> </field>
> <field
> property="password"
> depends="required,mask">
> <arg0 key="lable.password"/>
> <var>
> <var-name>mask</var-name>
> <var-value>^[a-zA-Z0-9_.-]*$</var-value>
> </var>
> </field>
> </form>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Problem in using Validator Framework with Struts
Posted by Stephan Wiesner <st...@stephan-wiesner.de>.
Hi Dirk,
did you activate the plugin in struts-config? Maybe a typo? Struts 1.1
already contains the activated plugin and there is an example war where
you might want to copy paste some lines.
Dirk Behrendt wrote:
>Hello!
>
>I have a problem in using the Validator framework with Struts.
>
>I want to check textfields.
>
>When I start Tomcat, I got a lot of parse erros like this:
>
>element type "plug-in" must be declared.
>org.xml.SAXParseException
>
>I looked at other validation examples, but I did the same like in these
>examples.
>What is the general problem of such errors?
>
>Thanx!
>
>Dirk
>
>
>
>
>struts-config.xml
>-----------------
>
>
><form-bean
> name="loginForm"
> type="org.apache.struts.webapp.validator.RegistrationForm"/>
>
>
><plug-in className="org.apache.struts.validator.ValidatorPlugIn">
> <set-property property="pathnames"
>value="/WEB-INF/validator-rules.xml,
> /WEB-INF/validation.xml"/>
> </plug-in>
>
>
>validation.xml
>--------------
>
><form name="loginForm">
> <field
> property="login"
> depends="required,mask">
> <arg0 key="lable.login"/>
> <var>
> <var-name>mask</var-name>
> <var-value>^[a-zA-Z0-9_.-]*$</var-value>
> </var>
> </field>
> <field
> property="password"
> depends="required,mask">
> <arg0 key="lable.password"/>
> <var>
> <var-name>mask</var-name>
> <var-value>^[a-zA-Z0-9_.-]*$</var-value>
> </var>
> </field>
> </form>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Problem in using Validator Framework with Struts
Posted by David Graham <gr...@yahoo.com>.
Make sure your doctype is correct:
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
David
--- Dirk Behrendt <sc...@web.de> wrote:
> Hello!
>
> I have a problem in using the Validator framework with Struts.
>
> I want to check textfields.
>
> When I start Tomcat, I got a lot of parse erros like this:
>
> element type "plug-in" must be declared.
> org.xml.SAXParseException
>
> I looked at other validation examples, but I did the same like in these
> examples.
> What is the general problem of such errors?
>
> Thanx!
>
> Dirk
>
>
>
>
> struts-config.xml
> -----------------
>
>
> <form-bean
> name="loginForm"
> type="org.apache.struts.webapp.validator.RegistrationForm"/>
>
>
> <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
> <set-property property="pathnames"
> value="/WEB-INF/validator-rules.xml,
> /WEB-INF/validation.xml"/>
> </plug-in>
>
>
> validation.xml
> --------------
>
> <form name="loginForm">
> <field
> property="login"
> depends="required,mask">
> <arg0 key="lable.login"/>
> <var>
> <var-name>mask</var-name>
> <var-value>^[a-zA-Z0-9_.-]*$</var-value>
> </var>
> </field>
> <field
> property="password"
> depends="required,mask">
> <arg0 key="lable.password"/>
> <var>
> <var-name>mask</var-name>
> <var-value>^[a-zA-Z0-9_.-]*$</var-value>
> </var>
> </field>
> </form>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org