Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get property value for IF?

 
Imre Tokai
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,


I want to check if one other property of same bean that status belongs to has null value. If it has, radio buttons should be disabled

<c:if test=""> <---what should i put here?
<html:radio styleId="radio" value="1" property="status"/>Enabled
<html:radio styleId="radio" value="0" property="status"/>Disabled
</c:if>


<c:if test=""> <---what should i put here?
<html:radio styleId="radio" value="1" property="status" disabled="true"/>Enabled
<html:radio styleId="radio" value="0" property="status" disabled="true"/>Disabled
</c:if>

Should i work with getProperty?


Regards
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Imre Tokai:
Should i work with getProperty?

No, but you haven't given us enough info to help you further either.

The basic way to test for equality would be something along the line of:

assuming that bean is in scope.

You might also want to explore the ternary operator of the EL to help shorten your code. You've got a lot of needless repetition in the code you posted.
 
Imre Tokai
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your answer!


When i want to display the value of property, i can do it simply in the text label:

<td valign="top"><html:text property="status" styleId="textfield6" /></td>

everything is OK,
but i don't know how to use the value for the IF?
<c:if test=""> <---what should i put here?


Regards
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you see my example?

I'm going to move this to the Struts forum because you seem to be relying upon Struts tags.
 
Imre Tokai
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the header of my form



I'm passing UserManagementForm to the .jsp page

I tried with:

but then Exception is raised.

I also tried with:


but the the IF is always false.

I checked the value of status in one text label and it is OK


Regards
 
Imre Tokai
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem solved:

The problem was that i didn't pass the UserManagementForm, but the DynaActionForm.
If sy knows how to do this directly with DynaActionForm i'd appreciate that answer! Thanks!


Regards
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic