Space web hosting - ActionError newError = new ActionError(”error.security.invalidlogin”); errors.add( ActionErrors.GLOBAL_ERROR, newError
ActionError newError = new ActionError(”error.security.invalidlogin”); errors.add( ActionErrors.GLOBAL_ERROR, newError ); saveErrors( request, errors ); return mapping.findForward( IConstants.FAILURE_KEY ); }catch( ExpiredPasswordException ex ){ ActionErrors errors = new ActionErrors( ); ActionError newError = new ActionError(”error.security.passwordexpired”); errors.add( ActionErrors.GLOBAL_ERROR, newError ); saveErrors( request, errors ); return mapping.findForward( IConstants.FAILURE_KEY ); }catch (AccountLockedException ex){ ActionErrors errors = new ActionErrors( ); ActionError newError = new ActionError(”error.security.accountlocked” ); errors.add( ActionErrors.GLOBAL_ERROR, newError ); saveErrors( request, errors ); return mapping.findForward( IConstants.FAILURE_KEY ); } This fragment is another reason why the declarative exception-handling feature of Struts is so attractive. Look at the amount of work that we did here. With declarative exception handling, all of this would be defined within the Struts configuration file. 12.3.2.1 The Bean tag library’s MessageTag class The Struts framework contains several custom tags that can be used in conjunction with the MessageResources for an application. One of the most important, however, is the Message tag that is part of the Bean tag library. This custom tag retrieves a message string from one of the bundles for an application. It supports optional parametric replacement if the JSP page requires it. All you need to do is provide the key from the bundle and specify which application bundle to use, and the tag will write out the information to the JSP page. For example, the following JSP fragment uses the MessageTag to write out the title of the HTML page:
This is one tag that you will find yourself using quite often within your Struts applications. 12.3.3 Setting the Character Set Supporting character sets other than the typical U.S. default ISO-8859-1 is a little tricky. There are several steps that you must perform before your environment will be prepared to support them. First, you need to configure the application server and/or servlet container to support the character-encoding scheme that you want to use. For example, for Unicode you would tell the container to interpret inputIn case you need affordable webhost to host your website, our recommendation is ecommerce web host services.