I am trying to create a validation for the s:file tag to ensure that a
file name was provided.

My tag looks like this:

        <s:file name="xls" size="30"/>

I tried using the validation:

        <field name="xls">
                <field-validator type="requiredstring">
                <message key="err.msg.requiredstring"/>
                </field-validator>
        </field>

However, the validation always fails whether the file name is empty or
not.

I then saw in the example showcase apps that they used the following
validation:

        <field name="xls">
                <field-validator type="fieldexpression">
                        <param name="expression"><![CDATA[xls.length() >
0]]></param>
                        <message key="err.msg.requiredstring"/>
                </field-validator>
        </field>

However, when I attempt to do this I always get a NPE:

WARN - OgnlValueStack.logLookupFailure(269) | Caught an exception while
evaluating expression 'xls.length() > 0' against value stack
java.lang.NullPointerException: target is null for method length
WARN - FieldExpressionValidator.validate(80) | Got result of null when
trying to get Boolean.

Does anyone know the correct syntax for this?

Thanks in Advance!



-----------------------------------------
***Note:The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify the Sender
immediately by replying to the message and deleting it from your
computer. Thank you. Premier Inc.  

Reply via email to