javascript - Java/JS/JSTL - how to get property from javabean/display error message -


this question has answer here:

in html, need property bean , store in variable - how can this?

what i'm trying is, display error message when user's login fail - know can javascript, don't know how can "call" javascript load when login unsuccessful.

many ways this.. don't know how of them.

like html , css, js part of template text. let jsp print if js variable.

<script>var foo = '${bean.foo}';</script> 

you need make sure generated html looks way js understands it.

<script>var foo = 'bar';</script> 

with jsp/jstl/el can control output whatever way want. can use jstl <c:if> print conditionally. can use el conditional operator ${condition ? printiftrue : printiffalse } toggle output based on condition. etcetera.

see also:


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -