Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Struts section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 9th, 2006, 08:46 PM
Registered User
Join Date: Oct 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default error messages

I want to know how I can display error messages that I will be getting from a different module and will not be available at message resources file.Basically I want to know how to display error messages without using the resources file.

  #2 (permalink)  
Old November 13th, 2006, 07:05 AM
Authorized User
Join Date: Aug 2006
Location: , , .
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to sachin.tathod

Create Valiation method in the form class and access it from action class.

Plz refer following sample code and u dont need to use sttuts validation.

private ActionErrors BusinessValidation(ActionMapping mapping, HttpServletRequest req) {

        ActionErrors errors = new ActionErrors();
        String method = req.getParameter("method");
            return errors;
        errors = super.validate(mapping,req);
        if(errors.size() > 0)
            return errors;
        String name = groupTypeVOType.getName().trim();
        int nameLength = name.length();
        if (PasskeyUtils.replaceAllSpecialChars(name).length( ) <nameLength) {
            errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("PPlDC_ValErrMsg_16"));

        if(groupTypeVOType.getCode().size() != 0) {
            CodeVOType TypeCodeVO = (CodeVOType)groupTypeVOType.getCode().get(0);
                    errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("PPlDC_ValErrMsg_25"));
            if (eCodeVO.getCode().length() > (Utils.replaceAllSpecialChars(
                    groupTypeCodeVO.getCode())).length()) {
                errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("PPlDC_ValErrMsg_17"));

        return errors;

Thanks and Regards,
Patni Computer System Ltd.
Magarpatta City, Cyber City,
Tower 3,Level I & II,
Hadapsar,Pune - 411028
Mobile No:- +91-9881239401
Email ID:- sachin.tathod@patni.com

Similar Threads
Thread Thread Starter Forum Replies Last Post
Customised Error Messages denzil_cactus Perl 3 June 15th, 2007 10:27 AM
Lua error messages trav BOOK Beginning Lua Programming ISBN: 978-0-470-06917-2 1 June 3rd, 2007 01:21 PM
error messages timbal25 Classic ASP Databases 0 August 1st, 2006 02:56 PM
Error messages ldoodle Access ASP 12 June 6th, 2005 01:05 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.