You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Niklas Johansson <ni...@gmail.com> on 2009/05/26 09:27:37 UTC

Re: RequiredString Validation doesn't work and AbstractValidationActionSupport is missing?

Hello Dave,

Thanks for all answers.

Regarding the ParameterAware, I found the information here and it's
specified as the preferred solution:
http://struts.apache.org/2.1.6/docs/how-can-we-access-request-parameters-passed-into-an-action.html

I have enough information below to do some test for the rest I think,
will try it later.

Thanks again!

Regards,
Niklas


2009/5/25 Dave Newton <ne...@yahoo.com>:
> Niklas Johansson wrote:
>>
>> I want to use Requieredstring validator. The problem is that my
>> application is not complaining if I do leave the input field empty.
>
> Are you using the default interceptor stack?
>
>> Can anyone tell me what is the problem?
>
> I don't see anything immediately obvious, but I'm sleepy.
>
>> Q: "why you're using ParameterAware" ... "it's generally cleaner to
>> just use the action properties"
>>
>> A: The reason is because I found the instructions on the struts
>> homepage. Using the action properties, I assume I need to define those
>> in the struts.xml, correct?
>
> Define what in the struts.xml? The "struts homepage" doesn't have
> instructions for doing *anything*, so you'll have to be more specific as to
> what you were reading so we can correct it.
>
> The probable answer to your question is "no". One of the main features (IMO)
> of S2 is that it eliminates a lot of back-and-forth between HTML forms and
> actions, meaning your code could be written follows, getters and setters
> elided. (And why make the action properties public if you have
> getters/setters for them?)
>
> public class RegisterQAFormAction extends ActionSupport {
>
>    private String message;
>    private String heading;
>
>    public String execute() throws Exception {
>        System.out.println(heading);
>        System.out.println(answer);
>
>        // Don't know what this is trying to do, so ignoring.
>        //QAHandler handleQA = new QAHandler();
>        //handleQA.storeQA(param);
>
>        setMessage("Ärende " + heading + " registrerat");
>        if (getHeading() == null) {
>            return ERROR;
>        }
>
>        return SUCCESS;
>    }
>
> }
>
> Note that heading won't be null if the user doesn't enter a value--it will
> be an empty string, so in all probability this is a bug in your code.
>
>> Q: "That class is part of the showcase app, not part of Struts itself."
>>
>> A: So what is the solution? The instructions wasn't that clear about
>> where the class came from on the instruction page:
>> http://struts.apache.org/2.1.6/docs/using-field-validators.html
>
> Solution to what problem? You don't need that class to use the validation as
> you've written it above.
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: RequiredString Validation doesn't work and AbstractValidationActionSupport is missing?

Posted by Dave Newton <ne...@yahoo.com>.
Niklas Johansson wrote:
> Regarding the ParameterAware, I found the information here and it's
> specified as the preferred solution:
> http://struts.apache.org/2.1.6/docs/how-can-we-access-request-parameters-passed-into-an-action.html

It's the preferred solution for accessing the parameters *directly*. 
That doesn't mean it's the preferred solution for accessing form 
parameters, because it isn't.

Dave

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