Hi Adam,
Thank you for replying to my message. There are two parts stories on this
problem.
The first part which is without the <html:errors/> on the logon page.
<logic:messagesPresent>
There were errors
<font color='red' >
<html:messages id="validatorMsgs" message="true" >
<bean:write name="validatorMsgs"/>
</html:messages>
</font>
</logic:messagesPresent>
I tested the following conditions:
1) userName == empty string, and password == empty string (invalid format case)
I got the popup window saying that User Name is required and Password is
required.
2) userName == hohoho and password == empty string (invalid format case)
I got the popup window saying that Password is required.
3) userName == hohoho, and password == ho (invalid format case)
I got no popup window, but instead the error massage was on the same logon page
saying "There were errors". I am expecting a popup window with an error message
saying that password can not be less then 6 characters.
4) userName == hohoho, and password == hohoho (valid format case, but wrong
password)
I got either popup window nor error message on the logon page. I am especting
an error message as Invalid Password for this user on the logon page.
The second part which is with the <html:errors/> on the logon page.
<html:errors/>
<logic:messagesPresent>
There were errors
<font color='red' >
<html:messages id="validatorMsgs" message="true" >
<bean:write name="validatorMsgs"/>
</html:messages>
</font>
</logic:messagesPresent>
I tested the following conditions:
1) userName == empty string, and password == empty string (invalid format case)
I got the popup windown saying that User Name is required and Password is
required.
2) userName == hohoho and password == empty string (invalid format case)
I got the popup windown saying that Password is required.
3) userName == hohoho, and password == ho (invalid format case)
I got these messages on the logon page.
Password can not be less than 6 characters.
There were errors
I am expecting to see the "Password can not be less than 6 characters." on the
popup windown at least.
4) userName == hohoho, and password == hohoho (valid format case, but wrong
password)
I got either popup windown nor error message on the logon page. I am especting
an error message as Invalid Password for this user on the logon page.
Thank again,
Kam
<<<< application.property >>>>
adminLogonForm.userName=User Name
adminLogonForm.userName.maskmsg=The First Character Of The User Name Must Be A
Letter.
adminLogonForm.password=Password
adminLogonForm.password.maskmsg=The First Character Of The Password Must Be A
Letter.
adminLogonForm.error.password=Invalid Password for this user.
<<<< Here is the validation.xml file >>>>>
<global>
<constant>
<constant-name>passwordMask</constant-name>
<constant-value>^[a-zA-Z]{1}[a-zA-Z0-9_]*$</constant-value>
</constant>
</global>
<formset>
<form name="adminLogonForm">
.
.
.
<field property="password"
depends="required,minlength,maxlength,mask">
<msg name="mask" key="adminLogonForm.password.maskmsg"/>
<arg0 key="adminLogonForm.password"/>
<arg1 name="minlength" key="${var:minlength}" resource="false"/>
<arg1 name="maxlength" key="${var:maxlength}" resource="false"/>
<var>
<var-name>minlength</var-name>
<var-value>6</var-value>
</var>
<var>
<var-name>maxlength</var-name>
<var-value>12</var-value>
</var>
<var>
<var-name>mask</var-name>
<var-value>${nameMask}</var-value>
</var>
</field>
</form>
</formset>
On Sun, 09 Nov 2003 11:39:26 +0100, Adam Hardy wrote:
>
> Hi Kam,
> it's not obvious what is going wrong. What error message are you
> expecting? Do you see the "There were errors" text?
>
>
> Adam
>
> On 11/09/2003 08:55 AM Kam Lung Leung wrote:
> > ------- Start of forwarded message -------
> >
> > Subject: Please Help !! Can't Display ActionMessages
> > From: "Kam Lung Leung" <[EMAIL PROTECTED]>
> > Date: Sat, 08 Nov 2003 18:22:07 -0700 (MST)
> > To: [EMAIL PROTECTED]
> > Cc: [EMAIL PROTECTED]
> >
> > Hi,
> >
> > I am trying to follow the logon example of the struts-example.war. However, I
> can
> > not see the error messages print on the logon.jsp. Any suggestion is greatly
> > appreciated.
> >
> > <<<< here is the part that display the errors on my logon.jsp >>>>>>
> > <logic:messagesPresent>
> > There were errors
> > <ul>
> > <font color='red' >
> > <html:messages id="validatorMsgs" message="true" >
> > <li> <bean:write name="validatorMsgs"/> </li>
> > </html:messages>
> > </font>
> > </ul>
> > </logic:messagesPresent>
> >
> > <<<<< struts-config.xml >>>>>>>
> >
> > <form-bean name="adminLogonForm"
> > type="com.wlwa.Infra.WebComponemt.Dispatcher.Forms.AdminLogonForm" />
> > </form-beans>
> >
> > <global-forwards>
> > <forward name="logoff" path="/adminLogoff.do"/>
> > <forward name="logon"
> > path="/Infra/WebComponemt/Presentation/AdminLogon.jsp"/>
> > </global-forwards>
> >
> > <action path="/adminLogonSubmit"
> > type="com.wlwa.Infra.WebComponemt.Dispatcher.Actions.AdminLogonAction"
> > name="adminLogonForm"
> > scope="session"
> > validate="true"
> > input="logon">
> > <forward name="success" path="/Infra/WebComponemt/Presentation/index.jsp"
> />
> > </action>
> >
> > <<<<< Here is may ActionLogon.java >>>>>
> >
> > ActionMessages actionsMsgs = new ActionMessages();
> > // Validate the request parameters specified by the user
> > String username = (String) PropertyUtils.getSimpleProperty(form,
> "userName");
> > String password = (String) PropertyUtils.getSimpleProperty(form,
> "password");
> >
> > try {
> > if (lookUpUser(password, username) == false) {
> > actionsMsgs.add(ActionMessages.GLOBAL_MESSAGE,
> > new ActionMessage("adminLogonForm.error.password"));
> > }
> > } catch (Exception ex) {
> > // Report any actionsMsgs we have discovered back to the original form
> > actionsMsgs.add(ActionMessages.GLOBAL_MESSAGE,
> > new ActionMessage("adminLogonForm.error.password", ex.toString()));
> > saveMessages(request,actionsMsgs);
> > if (log.isDebugEnabled()) {
> > log.debug("validation of user passwword failed for username:" +username
> );
> >
> > log.debug("End of execute ");
> > }
> > return (mapping.getInputForward());
> > } //end try-catch
> >
> > if (log.isDebugEnabled()) {
> > log.debug("execute : password validation ended for user : " + username
> );
> > }
> >
> > // Report any actionsMsgs we have discovered back to the original form
> > if (!actionsMsgs.isEmpty()) {
> > saveMessages(request, actionsMsgs);
> > if (log.isDebugEnabled()) {
> > log.debug("validation of user passwword failed for username:" + username
> );
> > log.debug("End of execute ");
> > }
> > return (mapping.getInputForward());
> > }
> >
> > <<<< server.log >>>>>
> > DEBUG [org.apache.commons.beanutils.ConvertUtils] Convert string 'kamhoho' to
> > class 'java.lang.String'
> > DEBUG [org.apache.commons.beanutils.ConvertUtils] Using converter
> > [EMAIL PROTECTED]
> > DEBUG [org.apache.commons.beanutils.BeanUtils]
> >
setProperty([EMAIL PROTECTED],
> > userName, [tytyty])
> > DEBUG [org.apache.commons.beanutils.ConvertUtils] Convert string 'tytyty' to
> > class 'java.lang.String'
> > DEBUG [org.apache.commons.beanutils.ConvertUtils] Using converter
> > [EMAIL PROTECTED]
> > DEBUG [org.apache.struts.action.RequestProcessor] Validating input form
> > properties
> > DEBUG [org.apache.struts.action.RequestProcessor] No errors detected,
> accepting
> > input
> > DEBUG [org.apache.struts.action.RequestProcessor] Looking for Action instance
> > for class com.wlwa.Infra.WebComponemt.Dispatcher.Actions.AdminLogonAction
> > DEBUG [org.apache.struts.action.RequestProcessor] Returning existing Action
> > instance
> > DEBUG [com.wlwa.Infra.WebComponemt.Dispatcher.Action.AdminLogonAction] Begin
of
> > execute
> > DEBUG [com.wlwa.Infra.WebComponemt.Dispatcher.Action.AdminLogonAction]
execute :
> > password validation ended for user : tytyty
> > DEBUG [com.wlwa.Infra.WebComponemt.Dispatcher.Action.AdminLogonAction] End of
> > execute
> > DEBUG [org.apache.struts.tiles.TilesRequestProcessor]
> > processForwardConfig(/Infra/WebComponemt/Presentation/index.jsp, false)
> > DEBUG [org.apache.struts.tiles.TilesRequestProcessor]
> > '/Infra/WebComponemt/Presentation/index.jsp' - processed as uri
> > DEBUG [org.apache.struts.action.RequestProcessor]
> >
>
processForwardConfig(ForwardConfig[name=success,path=/Infra/WebComponemt/Presentation/index.jsp,redirect=false,contextRelative=false])
>
>
> --
> struts 1.1 + tomcat 5.0.12 + java 1.4.2
> Linux 2.4.20 RH9
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]