Question

In JSP page having one textbox name and button Login

<html:form action="login">
    <html:text property="name"/>
    <html:submit value="Login" />
</html:form>
<html:errors/>

and in StructsActionForm has validate() method like

public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    ActionErrors errors = new ActionErrors();
    if (getName() == null || getName().length() < 1) {
        errors.add("name", new ActionMessage("error.name.required"));
                // TODO: add 'error.name.required' key to your resources
    }
            return errors;
}

if textbox name has an empty input when Login clicks it should show the error message error.name.required with the help of <html:errors/>, but it not showing the error message.

I am using Net-beans 8.0, Struts 1.3.10.

Pls help me out of this problem Thanks in advance.

Was it helpful?

Solution

i just missed the value of the key in

ApplicationResource.properties

so i cant able to get the error details.just add the value and i got the answer while running the program.

Thanks for the reply..

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top