aspose file tools*
The moose likes Struts and the fly likes checkbox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "checkbox" Watch "checkbox" New topic
Author

checkbox

Anant Rao
Ranch Hand

Joined: Nov 12, 2004
Posts: 126
Below is my code:
<tr>
<td class="widthLabelCol" width="275"><nobr><label>Active:</label></nobr></td>
<logic:equal name="ProjectIssue" property="active" value="Y">
<td width="591"> <html:checkbox property="active" checked="true" ></html:checkbox></td>
</logic:equal>
<logic:equal name="ProjectIssue" property="active" value="N">
<td width="591"> <html:checkbox property="active"></html:checkbox></td>
</logic:equal>

</tr>

when property active="Y" then its should be checked or we can check now when the page is loaded. I unable to check when the active status is "Y'
To get it checked what property should i use.

Regards
Infyniti.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30293
    
150

Infyniti,
You can set the value in the form itself in Java. Then Struts will take care of populating the HTML for you.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Anant Rao
Ranch Hand

Joined: Nov 12, 2004
Posts: 126
Thanks for clue...but I think I did not make myself clear...

from form I am getting "y" and as per the logic
1 when the property from from is Y then the checkbox should be checked else unchecked.
2. after displaying the page we can check or uncheck the checkbox so that the active property at the form get populated when we submit the page.

But I am unable display checkbox chekced when the active property is "Y" and if it give checked=true it is throwing an error that it does not support the attribute.

can u please suggest me anyother option.

Infyniti.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30293
    
150

Infyniti,
As you've noticed there is no checkbox attribute.

Instead you set the value attribute to "Y" or "N" for each checkbox. (Sorry, I didn't notice that was missing yesterday.) Then Struts matches it against the value in the form and checks the correct box.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: checkbox