• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Struts checked checkbox

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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" />
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this:
 
Shyam Hai
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
and POOF! You're gone! But look, this tiny ad is still here:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic