Accessing the bean value via c if

I'm stumped. I have a property set in my bean that I can access via a form on my jsp:

<p> <b class="textBold">Is Locked </span>:</b> 
    <html:text maxlength="11" size="11" property="user.isLocked" />
</p>

      

but when I try to access a hidden property or EL element, I can't - it shows as empty using this:

<html:hidden property="isLocked" value='${user.isLocked}' />

<c:if test='${isLocked}'>
        <p>false:: '${user.isLocked}'</p>
</c:if>
<c:if test="${!isLocked}">
        <p>true :: '${user.isLocked}' </p>
</c:if>

      

Where am I going wrong? Can someone please tell me what I need to fix in my syntax?

+3


source to share


2 answers


use it like

<c:if test='${user.locked}'>

      



it will allow access isLocked()

to the user type

+1


source


The EL element automatically adds getter / setter prefixes for you. For non-boolean properties, EL appends get/set

and capitalizes the next letter. For boolean properties, EL adds is/set

and capitalizes the next letter. In a nutshell, change user.isLocked

to user.locked

.



+1


source







All Articles