Both our Bundle, and struts.properties files need to be store in classes folder only
Syntax of struts.properties
struts.custom.i18n.resources= your bundle nameExample:
struts.custom.i18n.resources=java4s
(Let my bundle name being java4s)
Syntax of java4s.properties
enter.user = User namesomething like key = value
enter.pass = Password
user.wrong = You must enter the user
pass.wrong = Password should be entered
u.p.wrong = User or Password is wrong
In action class if any logic is failed then also we get error messages from a bundel. At this time we need to make it as an actionError, not fieldError. If we want to display an action error on a browser then in jsp we need to use the tag called <s:actionerror>
We will see this in the next example with programmatic validations
No comments:
Post a Comment