wood burning stoves 2.0*
The moose likes Struts and the fly likes How to get property value for IF? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to get property value for IF?" Watch "How to get property value for IF?" New topic
Author

How to get property value for IF?

Imre Tokai
Ranch Hand

Joined: Jun 04, 2008
Posts: 130
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

Joined: Jan 10, 2002
Posts: 60765
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Imre Tokai
Ranch Hand

Joined: Jun 04, 2008
Posts: 130
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

Joined: Jan 10, 2002
Posts: 60765
    
  65

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

Joined: Jun 04, 2008
Posts: 130
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

Joined: Jun 04, 2008
Posts: 130
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get property value for IF?
 
Similar Threads
Retrieving value from radio buttons using struts tag(Please let me know if my quest is not clear)
html:radio
Using html:radio with indexed attribute
Need to find a way without scriptless.
initialize html:radio