aspose file tools*
The moose likes Struts and the fly likes Struts checked checkbox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts checked checkbox" Watch "Struts checked checkbox" New topic
Author

Struts checked checkbox

Shyam Hai
Ranch Hand

Joined: Feb 04, 2009
Posts: 68



Hi,


I want to use checked the check box when the page is loaded.
Now i give the code like this , but i did not get checked check box.

<html:checkbox property="Calls" value="true"/>No. calls

This is html code. I want same code in struts.So please..........
<input type="checkbox" name="Calls" checked="checked" />
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Try this:


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Shyam Hai
Ranch Hand

Joined: Feb 04, 2009
Posts: 68

<html:checkbox property="Calls" value="true" checked="checked" />
I tried that also.

but checked attribute not in the struts-html file.
so that i got error..
please help me..

Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Here is the problem discussed by the Struts User:
http://www.mail-archive.com/struts-user@jakarta.apache.org/msg49595.html
Shyam Hai
Ranch Hand

Joined: Feb 04, 2009
Posts: 68

I saw all the problem discussed page.
Still i did not get solution.
Please give with example.......
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

There are two solutions:
1. Don't use struts tag, instead use the rendered HTML select tag, like


2. In your Action class which forwards to the JSP, you have to have code which sets the property associated with the checkbox to either "true", "yes", "on", or the value set in the "value" attribute.
Shyam Hai
Ranch Hand

Joined: Feb 04, 2009
Posts: 68

Now i am using like this.


Jsp:java.lang.<html

Form Bean:
[javadoc]public void setActualReceivedCalls(boolean actualReceivedCalls)
{
this.actualReceivedCalls=actualReceivedCalls;
}
[/javadoc]

Now what changes i have to do........

Shyam Hai
Ranch Hand

Joined: Feb 04, 2009
Posts: 68
Now i am using like this.


Jsp:


Form Bean:
[javadoc]public void setActualReceivedCalls(boolean actualReceivedCalls)
{
this.actualReceivedCalls=actualReceivedCalls;
}
[/javadoc]

Now what changes i have to do........

Shyam Hai
Ranch Hand

Joined: Feb 04, 2009
Posts: 68
Now i am using like this.


Jsp:

Form Bean:
[javadoc]public void setActualReceivedCalls(boolean actualReceivedCalls)
{
this.actualReceivedCalls=actualReceivedCalls;
}
[/javadoc]

Now what changes i have to do........

Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Ragav S.Rao wrote:Jsp:

Form Bean:
[javadoc]public void setActualReceivedCalls(boolean actualReceivedCalls)
{
this.actualReceivedCalls=actualReceivedCalls;
}
[/javadoc]Now what changes i have to do........

I think, I have already explained what you need to do in order make the check boxes "cheeked" when you load the page ?
I can't give example all the time you asked, you have to show some efforts and have some re search.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts checked checkbox