This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts checkbox problem. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "Struts checkbox problem." Watch "Struts checkbox problem." New topic
Author

Struts checkbox problem.

sachin yadav
Ranch Hand

Joined: Nov 24, 2005
Posts: 156
I have a JSP page with a checkbox DO. Code is:

<logic:equal name="dynaActionForm" property="chkDO" value="0">
<td height="22"><input type="checkbox" value="0" name ="chkDayOptional" checked/></td>
</logic:equal>
<logic:equal name="dynaActionForm" property="chkDO" value="1">
<td height="22"><input type="checkbox" value="1" name ="chkDayOptional" /></td>
</logic:equal>

If a value of 0 is returned from database then the checkbox shold be checked and if 1 then not. Please suggest me how do i design this? Should i make both of them rendered on the page? I have to send the value 0 or 1 based on the selected or not when the page submitted.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You don't need the logic:equals tags. Just specify initial="0" when you define the chkDO property in the struts-config.xml file. Then just use the <html:checkbox> tag in your JSP. Example:


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Struts checkbox problem.
 
Similar Threads
Checkboxes in Struts
Issue in populating field in parent window
bean value persists on clicking back
How to Introduce a Button That Controls All Other Links in a Web Page
save checked value in checkbox to database