struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <davelnew...@gmail.com>
Subject Re: On applying action-validation.xml action is not executing.
Date Mon, 04 Jul 2011 16:02:10 GMT
On Sun, Jul 3, 2011 at 9:11 PM, log2akshat wrote:
> Action name is : Submitappform
> The name of the action class is : SubmitAppFormAction
> Validation file name : SubmitAppFormAction-validation.xml
>
> My *struts.xml* file for this action:
> <action name="Submitappform"
> class="net.Candidate.application.action.SubmitAppFormAction" method="add">
>        <interceptor-ref name="params">dojo\..*,^struts\..*</interceptor-ref>
>        <interceptor-ref name="validation">input,back,cancel,browse</interceptor-ref>
>        <interceptor-ref name="workflow">input,back,cancel,browse</interceptor-ref>

Why are you doing this? What's wrong with the default stack, or an
application-specific default stack? This strikes me as error-prone and
unnecessary.

> <validators>
>    <field name="appform.Name">

Why are you using non-standard property names?

>            <message key="validate_Name"/>

And key names?

> My SubmitAppFormAction class:

You have *far* too much logic encapsulated in your action. *Far* too
much. Refactor.

> package net.Candidate.application.action;

And a non-standard package name?

> import java.sql.*;

Um...

> import javax.naming.*;

Why?

> import javax.mail.internet.*;
> import com.sun.mail.smtp.*;
> import com.sun.mail.smtp.SMTPSSLTransport.*;
> import javax.activation.*;

They have third-party libraries to make sending emails a lot easier, you know.

Not that you should be sending an email in action code anyway.

>                        System.out.println("JDBC MySQL Connection....");

Use logging.

>                                code removed just for security

And sanity. But it shouldn't be there anyway.

Just out of curiosity, how many lines long is the "add()" method?

> The other problem which I am facing is that in my validation half of the
> validation is working fine but in the half form old error message is not
> clearing, and the new error message is showing in a new line. On clicking
> again the previous error messages are there and the new message is adding in
> a new row.

Are you doing JavaScript validation? Ajax validation? How are you
showing the error messages? What theme are you using? Are you using
the Spring plugin? Have you done any form validation successfully in
the application, or did you write all this then start debugging
everything at once?

Dave

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


Mime
View raw message