spring - How to use springMessage() within springFormInput in Velocity? -
i'm using spring mvc , velocity templates internationalized website.
on signup form, i'm using data binding via #springforminput tags.
how can set translated placeholder within it?
it this:
#springforminput("signupform.emailaddress", "required email='true' maxlength='100' placeholder='translated string'")
i thought this, i'm not sure how nest methods:
#springforminput("signupform.emailaddress", "required email='true' maxlength='100' placeholder='#springmessage("email_address")'")
(in case, "email_address" "key" in messages.properties file of translations.)
i got working. had set variable (in velocity) in line above.
see lines $placeholderpassword
.
#springbind("signupform.password") #if("$!status.errorcode" != "") #set($passworderror = true) #end <div class="input password#if($passworderror) invalid#end"> <div class="icon"> <div class="image"></div> </div> #set($placeholderpassword = "#springmessage($translationconstants.password)") #springformpasswordinput("signupform.password", "placeholder='$placeholderpassword'") <div class="status"> <div class="image"></div> #if($passworderror) <div for="password" class="alert alert-error"> $status.errormessage </div> #end </div> </div>
$translationconstants injected via fieldmethodizer (https://stackoverflow.com/a/15126547/470749).
Comments
Post a Comment