Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts checked checkbox

 
Shyam Hai
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



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
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:
 
Shyam Hai
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

<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
Posts: 2907
1
Java Spring Ubuntu
 
Shyam Hai
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I saw all the problem discussed page.
Still i did not get solution.
Please give with example.......
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic