I want to validate username and password using resource bundles in struts 2.
Here, I have written two keys in Properties file & in validation file I have used key attribute of message tag.
But when I clicked on submit button of EmployeeLogin.jsp without putting user name and password, I got username and password as output instead of user name is required & password is required
Here is code
<%@page contentType="text/html" session="false" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<%@ taglib uri="/struts-tags" prefix="s"%>
I am not aware of struts 2.
But in struts 1 , we need to specify name of validation XML (in your case Login-vaidation.xml ) inside "struts-config.xml".
This is done where ValidatorPlugin is declared inside struts-config fiile.
I tried EmployeeLogin.jsp <s:fieldError/> ,not working
I searched on net everywhere they just make properties file of the same name as of the action class & put it in the same package where the action class is. Then they just add key in validation xml ,
nothing written on the EmployeeLogin.jsp
I did same but it is not working for me.
i think I am missing very small thing but can not able to find it
As we have tried all the possible options (which are not working ) I created sample app and tried with it .
It seems to be working .Could you please check for the differences in code below and your code: