You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Kelly Goedert <ke...@nexxera.com> on 2004/01/16 11:24:54 UTC

validation problem

Hi,

I'm trying to use the validator in a form that is used in as login form 
for authentication.
And the fields are not being checked.

I have this mapping on struts-config.xml

<!-- Form Bean Definitions -->
    <form-beans>
        <form-bean name="loginForm" 
type="org.apache.struts.validator.DynaValidatorForm">
            <form-property name="txtLogin" type="java.lang.String"/>
            <form-property name="pwdSenha" type="java.lang.String"/>
        </form-bean>
    </form-beans>

        <action path="/login"
            type="LoginAction"
            name = "loginForm"
            scope="request"
            input="/login.jsp"
            validate="true">
            <forward
                name="continue"
                path="/pages/principal.jsp"/>
            <forward
                name="erro"
                path="/login.jsp"/>
        </action>

In the validation.xml I have this:

<form-validation>
    <formset>
        <form name="loginForm">
            <field property="txtLogin"
                depends="required">
                <arg0 key="login.display"/>
            </field>
            <field property="pwdSenha"
                depends="required">
                <arg0 key="senha.display"/>
            </field>
        </form>
    </formset>   
</form-validation>

Why the fields are not checked??


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Access Applicationresources.properties from Action

Posted by Matthias Wessendorf <ma...@matthias-wessendorf.de>.
hi, 
use getResources(request);


or if more then 1

getResources(request, "keyOfResource");


this returns an MessageResource-Object

then you can read it.

greeting


-----Original Message-----
From: Eric C [mailto:chabere@wanadoo.fr] 
Sent: Friday, January 16, 2004 12:42 PM
To: Struts Users Mailing List
Subject: Access Applicationresources.properties from Action


Hi all,

i'd like to access my properties file from the Action. My purpose is
deliver an error message to my result page. Any sample code showing the
use of the MessageResources object ?

Regards,
ERic


---------------------------------------------------------------------
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


Access Applicationresources.properties from Action

Posted by Eric C <ch...@wanadoo.fr>.
Hi all,

i'd like to access my properties file from the Action. My purpose is deliver
an error message to my result page. Any sample code showing the use of the
MessageResources object ?

Regards,
ERic


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: validation problem

Posted by Eric C <ch...@wanadoo.fr>.
Shouldn't your formbean type point to the actual class loginForm instead of
"org.apache.struts.validator.DynaValidatorForm", which i believe should be
in the bean code (bean extends DynaValidatorForm) ?


----- Original Message -----
From: "Kelly Goedert" <ke...@nexxera.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Friday, January 16, 2004 11:24 AM
Subject: validation problem


> Hi,
>
> I'm trying to use the validator in a form that is used in as login form
> for authentication.
> And the fields are not being checked.
>
> I have this mapping on struts-config.xml
>
> <!-- Form Bean Definitions -->
>     <form-beans>
>         <form-bean name="loginForm"
> type="org.apache.struts.validator.DynaValidatorForm">
>             <form-property name="txtLogin" type="java.lang.String"/>
>             <form-property name="pwdSenha" type="java.lang.String"/>
>         </form-bean>
>     </form-beans>
>
>         <action path="/login"
>             type="LoginAction"
>             name = "loginForm"
>             scope="request"
>             input="/login.jsp"
>             validate="true">
>             <forward
>                 name="continue"
>                 path="/pages/principal.jsp"/>
>             <forward
>                 name="erro"
>                 path="/login.jsp"/>
>         </action>
>
> In the validation.xml I have this:
>
> <form-validation>
>     <formset>
>         <form name="loginForm">
>             <field property="txtLogin"
>                 depends="required">
>                 <arg0 key="login.display"/>
>             </field>
>             <field property="pwdSenha"
>                 depends="required">
>                 <arg0 key="senha.display"/>
>             </field>
>         </form>
>     </formset>
> </form-validation>
>
> Why the fields are not checked??
>
>
> ---------------------------------------------------------------------
> 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: validation problem

Posted by Matthias Wessendorf <ma...@matthias-wessendorf.de>.
mmm strange :-)

in your action
the is a blank
name = "loginForm"


try name="loginForm"


okay you have DynaValidatorForm
not DynaValidatorActionForm
(it´s sometimes not clear (the differents)...)

and you have
<formset>
  <form name="loginForm">

and NOT! name="/login"
(what is needed for DynaValodatorActionForm...




so please try to create an own bean
which extends DynaValidatorForm
and in its validator()
do some debug-output
(for seeing, validator-framework works...)


greetings

-----Original Message-----
From: Kelly Goedert [mailto:kelly.goedert@nexxera.com] 
Sent: Friday, January 16, 2004 12:08 PM
To: Struts Users Mailing List
Subject: Re: validation problem


I'm sorry, I didn't get what you mean... could you explain?

Matthias Wessendorf wrote:

>what is about
>
>name="loginForm"
>
>instead:
>name = "loginForm"
>(as action.-attribute)?
>
>but can´t be... ?!?
>
>
>
>-----Original Message-----
>From: Kelly Goedert [mailto:kelly.goedert@nexxera.com]
>Sent: Friday, January 16, 2004 11:41 AM
>To: Struts Users Mailing List
>Subject: Re: validation problem
>
>
>Yes I did. It is exactly like your application.
>
>Matthias Wessendorf wrote:
>
>  
>
>>hi kelly,
>>
>>did you integrate it into
>>struts-config?
>>
>>-->
>>
>>	<plug-in
>>    
>>
>className="org.apache.struts.validator.ValidatorPlugIn">
>  
>
>>		<set-property
>>			property="pathnames"
>>	
>>value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
>>	</plug-in>
>>
>>greetings
>>
>>-----Original Message-----
>>From: Kelly Goedert [mailto:kelly.goedert@nexxera.com]
>>Sent: Friday, January 16, 2004 11:25 AM
>>To: Struts Users Mailing List
>>Subject: validation problem
>>
>>
>>Hi,
>>
>>I'm trying to use the validator in a form that is used in as login 
>>form for authentication. And the fields are not being checked.
>>
>>I have this mapping on struts-config.xml
>>
>><!-- Form Bean Definitions -->
>>   <form-beans>
>>       <form-bean name="loginForm" 
>>type="org.apache.struts.validator.DynaValidatorForm">
>>           <form-property name="txtLogin" type="java.lang.String"/>
>>           <form-property name="pwdSenha" type="java.lang.String"/>
>>       </form-bean>
>>   </form-beans>
>>
>>       <action path="/login"
>>           type="LoginAction"
>>           name = "loginForm"
>>           scope="request"
>>           input="/login.jsp"
>>           validate="true">
>>           <forward
>>               name="continue"
>>               path="/pages/principal.jsp"/>
>>           <forward
>>               name="erro"
>>               path="/login.jsp"/>
>>       </action>
>>
>>In the validation.xml I have this:
>>
>><form-validation>
>>   <formset>
>>       <form name="loginForm">
>>           <field property="txtLogin"
>>               depends="required">
>>               <arg0 key="login.display"/>
>>           </field>
>>           <field property="pwdSenha"
>>               depends="required">
>>               <arg0 key="senha.display"/>
>>           </field>
>>       </form>
>>   </formset>   
>></form-validation>
>>
>>Why the fields are not checked??
>>
>>
>>---------------------------------------------------------------------
>>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
>>
>> 
>>
>>    
>>
>
>
>
>---------------------------------------------------------------------
>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
>
>
>  
>



---------------------------------------------------------------------
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: validation problem

Posted by Kelly Goedert <ke...@nexxera.com>.
I'm sorry, I didn't get what you mean... could you explain?

Matthias Wessendorf wrote:

>what is about
>
>name="loginForm"
>
>instead:
>name = "loginForm"
>(as action.-attribute)?
>
>but can´t be... ?!?
>
>
>
>-----Original Message-----
>From: Kelly Goedert [mailto:kelly.goedert@nexxera.com] 
>Sent: Friday, January 16, 2004 11:41 AM
>To: Struts Users Mailing List
>Subject: Re: validation problem
>
>
>Yes I did. It is exactly like your application.
>
>Matthias Wessendorf wrote:
>
>  
>
>>hi kelly,
>>
>>did you integrate it into
>>struts-config?
>>
>>-->
>>
>>	<plug-in
>>    
>>
>className="org.apache.struts.validator.ValidatorPlugIn">
>  
>
>>		<set-property
>>			property="pathnames"
>>	
>>value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
>>	</plug-in>
>>
>>greetings
>>
>>-----Original Message-----
>>From: Kelly Goedert [mailto:kelly.goedert@nexxera.com]
>>Sent: Friday, January 16, 2004 11:25 AM
>>To: Struts Users Mailing List
>>Subject: validation problem
>>
>>
>>Hi,
>>
>>I'm trying to use the validator in a form that is used in as login form
>>for authentication.
>>And the fields are not being checked.
>>
>>I have this mapping on struts-config.xml
>>
>><!-- Form Bean Definitions -->
>>   <form-beans>
>>       <form-bean name="loginForm"
>>type="org.apache.struts.validator.DynaValidatorForm">
>>           <form-property name="txtLogin" type="java.lang.String"/>
>>           <form-property name="pwdSenha" type="java.lang.String"/>
>>       </form-bean>
>>   </form-beans>
>>
>>       <action path="/login"
>>           type="LoginAction"
>>           name = "loginForm"
>>           scope="request"
>>           input="/login.jsp"
>>           validate="true">
>>           <forward
>>               name="continue"
>>               path="/pages/principal.jsp"/>
>>           <forward
>>               name="erro"
>>               path="/login.jsp"/>
>>       </action>
>>
>>In the validation.xml I have this:
>>
>><form-validation>
>>   <formset>
>>       <form name="loginForm">
>>           <field property="txtLogin"
>>               depends="required">
>>               <arg0 key="login.display"/>
>>           </field>
>>           <field property="pwdSenha"
>>               depends="required">
>>               <arg0 key="senha.display"/>
>>           </field>
>>       </form>
>>   </formset>   
>></form-validation>
>>
>>Why the fields are not checked??
>>
>>
>>---------------------------------------------------------------------
>>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
>>
>> 
>>
>>    
>>
>
>
>
>---------------------------------------------------------------------
>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
>
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Ling Tag client

Posted by Andrew Hill <an...@gridnode.com>.
Im not a JSP expert but I think you might be 'playing with fire' on that
one.
btw: Does it actually work or youve not tried it yet?

-----Original Message-----
From: Renato Romano [mailto:r.romano@set-network.com]
Sent: Friday, 16 January 2004 19:37
To: 'Struts Users Mailing List'
Subject: Ling Tag client


I'm trying to define a Tag that does some work, and defines a link to
some resource. To define this link I was trying to use the struts
<html:link> tag in this way:

		LinkTag linkTag = new LinkTag();
		linkTag.setPageContext(pageContext);
		linkTag.setHref("http://myhost/mypage");
		linkTag.doStartTag();
		try
		{
			pageContext.getOut().print("Go to myHost");
		}
		catch (IOException e)
		{
			e.printStackTrace();
			return SKIP_PAGE;
		}
		linkTag.doEndTag();
		return SKIP_BODY;

Is this the correct way to utilize an external Tag definition ??
Thanks

____________________________________
Renato Romano
Sistemi e Telematica S.p.A.
Calata Grazie - Vial Al Molo Giano
16127 - GENOVA

e-mail: r.romano@set-network.com
Tel.:   010 2712603
_____________________________________



---------------------------------------------------------------------
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


Ling Tag client

Posted by Renato Romano <r....@set-network.com>.
I'm trying to define a Tag that does some work, and defines a link to
some resource. To define this link I was trying to use the struts
<html:link> tag in this way:

		LinkTag linkTag = new LinkTag();
		linkTag.setPageContext(pageContext);
		linkTag.setHref("http://myhost/mypage");
		linkTag.doStartTag();
		try
		{
			pageContext.getOut().print("Go to myHost");
		}
		catch (IOException e)
		{
			e.printStackTrace();
			return SKIP_PAGE;
		}
		linkTag.doEndTag();
		return SKIP_BODY;

Is this the correct way to utilize an external Tag definition ??
Thanks

____________________________________
Renato Romano
Sistemi e Telematica S.p.A.
Calata Grazie - Vial Al Molo Giano
16127 - GENOVA

e-mail: r.romano@set-network.com
Tel.:   010 2712603
_____________________________________



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: validation problem

Posted by Matthias Wessendorf <ma...@matthias-wessendorf.de>.
what is about

name="loginForm"

instead:
name = "loginForm"
(as action.-attribute)?

but can´t be... ?!?



-----Original Message-----
From: Kelly Goedert [mailto:kelly.goedert@nexxera.com] 
Sent: Friday, January 16, 2004 11:41 AM
To: Struts Users Mailing List
Subject: Re: validation problem


Yes I did. It is exactly like your application.

Matthias Wessendorf wrote:

>hi kelly,
>
>did you integrate it into
>struts-config?
>
>-->
>
>	<plug-in
className="org.apache.struts.validator.ValidatorPlugIn">
>		<set-property
>			property="pathnames"
>	
>value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
>	</plug-in>
>
>greetings
>
>-----Original Message-----
>From: Kelly Goedert [mailto:kelly.goedert@nexxera.com]
>Sent: Friday, January 16, 2004 11:25 AM
>To: Struts Users Mailing List
>Subject: validation problem
>
>
>Hi,
>
>I'm trying to use the validator in a form that is used in as login form
>for authentication.
>And the fields are not being checked.
>
>I have this mapping on struts-config.xml
>
><!-- Form Bean Definitions -->
>    <form-beans>
>        <form-bean name="loginForm"
>type="org.apache.struts.validator.DynaValidatorForm">
>            <form-property name="txtLogin" type="java.lang.String"/>
>            <form-property name="pwdSenha" type="java.lang.String"/>
>        </form-bean>
>    </form-beans>
>
>        <action path="/login"
>            type="LoginAction"
>            name = "loginForm"
>            scope="request"
>            input="/login.jsp"
>            validate="true">
>            <forward
>                name="continue"
>                path="/pages/principal.jsp"/>
>            <forward
>                name="erro"
>                path="/login.jsp"/>
>        </action>
>
>In the validation.xml I have this:
>
><form-validation>
>    <formset>
>        <form name="loginForm">
>            <field property="txtLogin"
>                depends="required">
>                <arg0 key="login.display"/>
>            </field>
>            <field property="pwdSenha"
>                depends="required">
>                <arg0 key="senha.display"/>
>            </field>
>        </form>
>    </formset>   
></form-validation>
>
>Why the fields are not checked??
>
>
>---------------------------------------------------------------------
>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
>
>  
>



---------------------------------------------------------------------
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: validation problem

Posted by Kelly Goedert <ke...@nexxera.com>.
Yes I did. It is exactly like your application.

Matthias Wessendorf wrote:

>hi kelly,
>
>did you integrate it into
>struts-config?
>
>-->
>
>	<plug-in
>className="org.apache.struts.validator.ValidatorPlugIn">
>		<set-property
>			property="pathnames"
>	
>value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
>	</plug-in>
>
>greetings
>
>-----Original Message-----
>From: Kelly Goedert [mailto:kelly.goedert@nexxera.com] 
>Sent: Friday, January 16, 2004 11:25 AM
>To: Struts Users Mailing List
>Subject: validation problem
>
>
>Hi,
>
>I'm trying to use the validator in a form that is used in as login form 
>for authentication.
>And the fields are not being checked.
>
>I have this mapping on struts-config.xml
>
><!-- Form Bean Definitions -->
>    <form-beans>
>        <form-bean name="loginForm" 
>type="org.apache.struts.validator.DynaValidatorForm">
>            <form-property name="txtLogin" type="java.lang.String"/>
>            <form-property name="pwdSenha" type="java.lang.String"/>
>        </form-bean>
>    </form-beans>
>
>        <action path="/login"
>            type="LoginAction"
>            name = "loginForm"
>            scope="request"
>            input="/login.jsp"
>            validate="true">
>            <forward
>                name="continue"
>                path="/pages/principal.jsp"/>
>            <forward
>                name="erro"
>                path="/login.jsp"/>
>        </action>
>
>In the validation.xml I have this:
>
><form-validation>
>    <formset>
>        <form name="loginForm">
>            <field property="txtLogin"
>                depends="required">
>                <arg0 key="login.display"/>
>            </field>
>            <field property="pwdSenha"
>                depends="required">
>                <arg0 key="senha.display"/>
>            </field>
>        </form>
>    </formset>   
></form-validation>
>
>Why the fields are not checked??
>
>
>---------------------------------------------------------------------
>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
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: validation problem

Posted by Matthias Wessendorf <ma...@matthias-wessendorf.de>.
hi kelly,

did you integrate it into
struts-config?

-->

	<plug-in
className="org.apache.struts.validator.ValidatorPlugIn">
		<set-property
			property="pathnames"
	
value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
	</plug-in>

greetings

-----Original Message-----
From: Kelly Goedert [mailto:kelly.goedert@nexxera.com] 
Sent: Friday, January 16, 2004 11:25 AM
To: Struts Users Mailing List
Subject: validation problem


Hi,

I'm trying to use the validator in a form that is used in as login form 
for authentication.
And the fields are not being checked.

I have this mapping on struts-config.xml

<!-- Form Bean Definitions -->
    <form-beans>
        <form-bean name="loginForm" 
type="org.apache.struts.validator.DynaValidatorForm">
            <form-property name="txtLogin" type="java.lang.String"/>
            <form-property name="pwdSenha" type="java.lang.String"/>
        </form-bean>
    </form-beans>

        <action path="/login"
            type="LoginAction"
            name = "loginForm"
            scope="request"
            input="/login.jsp"
            validate="true">
            <forward
                name="continue"
                path="/pages/principal.jsp"/>
            <forward
                name="erro"
                path="/login.jsp"/>
        </action>

In the validation.xml I have this:

<form-validation>
    <formset>
        <form name="loginForm">
            <field property="txtLogin"
                depends="required">
                <arg0 key="login.display"/>
            </field>
            <field property="pwdSenha"
                depends="required">
                <arg0 key="senha.display"/>
            </field>
        </form>
    </formset>   
</form-validation>

Why the fields are not checked??


---------------------------------------------------------------------
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