Doubt  in using html:checkbox in struts

Hi all,
In my jsp page i have 2 checkboxes name mandatory and active.
<html:checkbox property="mandatory" value="true"/>
<html:checkbox property="active" value="true"/>
Insertion of data works fine,and now my doubt is about the edit mode.
In edit mode,depending on th value of thethese fields wheteher 0 or 1,checkbox should be checked.how can it be done?
In th corresponding for,the properties I declared as boolean values.Also reset method is provided .
Anyone pls help.
thanks

It's rather nasty, but you could wrap all your strings in <html></html>. Even so you still have to use entities, but the
following displays what you want:JLabel lbl = new JLabel("<html>&lt;html>&lt;/html></html>");

Similar Messages

  • How to pass request parameters using html:link in struts

    Hi All,
    I am trying to send parameters to action class using <html:link>.
    Can anybody give sample code how to do it?
    Thanks in advance.
    By
    K.Siva Prasad Reddy

    hi,
    you can pass the parameters in link like this
    http://www.xyz.com&username=someuserID&password=somePassword
    username and password are parameters which you want to pass as paramets to server..hope this will work for you...
    Thanks
    Surya

  • Make html:checkbox selected by default depending upon bean value --struts

    Hi all,
    I have a doubt regarding the html:checkbox .
    I have the following code in my jsp.
    I am giving it inside logic:iterate tag and fetching the value from session scope.
    <html:checkbox property ="readchk" value ="read" indexed="true" onclick="return assignme(this.value,this.checked,'s')"/>
    How to make this checkbox selected by default.
    "readchk" (bean) is in my ActionForm, it has been been assigned either
    0 or 1 .
    I want to make the checkbox selected by default if the readchk is 1
    and the checkbox not selected if the readchk value is 0.
    Could anybody please help me out in fixing this problem.
    Thanks
    Parvathi

    If u give the value for ur check box in the action form it wld be checked!!
    regards
    Shanu

  • html:checkbox driving me crazy

    Hey frnds
    Can u plz provide me some code for managing a group of checkboxes in struts.
    I m using DynActionForms

    i m having a dyna form like this........\
    <form-bean name="addQuestionForm"
    type="org.apache.struts.validator.DynaValidatorForm">
    <form-property name="answertext" type="java.lang.String[]" />
    <form-property name="correct" type="java.lang.String[]" />
    </form-bean>
    and in my jsp i m using
    <html:multibox property="correct">
    <html:textarea property="answertext" cols="40"></html:textarea>
    </html:multibox>
    but wht i want is tht answertext[] shoulds be dipalyed along with the
    selected checkbox .
    So for this i m using this code in view.jsp
    <logic:iterate name="addQuestionForm" property="answertext" id="answertextt">
    <tr>
    <td width="80%" ></td>
    <html:textarea property="answertext" value="<%=answertextt.toString()%>" cols="40" rows="2" size="40" />
    </td>
    <td width="10%" >
    <html:multibox property="correct" >
    <bean:write name="answertextt" />
    </html:multibox>
    </td>
    </tr>
    </logic:iterate>
    Now in my view.jsp , i m getting all the options and checkboxes , but no option is checked marked.
    Can anyone why is this so ?
    Plz help....

  • To display value in html: textarea in struts

    Hello,
    I want to display value in <html:textarea> in struts application from my userdefine FormBean.
    i tried like this
    <html:textarea property="documentNumberList" value='"<bean:write name="QualityForm" property="displayDocumentNumber">" ></html:textarea>
    I am not getting success.
    I would be appriciate to you if anyone could let me know what is the solution of this problem ? or send me one example.
    Thanks
    Rajnish
    [email protected]

    Hi,
    That did'nt solve my problem. Actually i am trying to get the arraylist data one by one into different textareas. There are two arrays one is quesArray and the other quesIdArray. I need the quesIdArray in the individual text areas.How can i achieve this?
    I am using the following code to do that.
    <logic:iterate id="item" name="selectionCriteriaForm" indexId="index" property="quesArray">
    <tr><td><li><em><b><bean:write name="item"/> </em></li></b></td>          
    <td><html:textarea property="quesIdArray" cols="50" rows="2" name="selectionCriteriaForm" onkeyup="limitTextarea(answer<%=i %>,5,50)" />          
    <br></td></tr>
    <% i=i+1;
    %></td></tr>          
    </logic:iterate>
    Pls help me on this.
    Thanx in advance.

  • Use a checkbox to hide/show (toggle) another field

    I have a form I am creating in Adobe Acrobat X.  The form will ultimately be used as a data entry interface on iPads.  I need to keep the form very simple but there is a lot of technical information the end users may need to help fill out the forms.  I would like to be able to have a button, checkbox or other object enable the user to display additional information.
    I have played with making links to attached documents, using the article tool and finally trying to use a checkbox to drive the hidden/visible property of a text field.  Admittedly, I am a horrific programmer so I need some spoon fed help. 
    My check box is called: GMR1_1_Details_Select
    The text field is called: GMR1_1_Details
    I have been trying this and that with JavaScript in both the Actions tab and Calculate tab and am unsuccessful.
    Can anyone solve this puzzle for me?  I want to code this into my form:
    // so when the check box named "GMR1_1_Details_Select" is checked, my text box field ("GMR1_1_Details") is visible.  If the user unchecks the box, it would be hidden.  By default, the text box should be hidden and the checkbox shouldbe unchecked.
    If GMR1_1_Details_Select = yes
    Then GMR1_1_Details = visible
    else
    GMR1_1_Details = hidden
    I have tried codes similar to:
    if (event.target.value!="On") This.getfield(“GMR1_1_Details”).display = display.hidden;
    and other code similar to:
    Var GMR1_1 = this.getField(“GMR1_1_Details”);
    If(GMR1_1==="yes");
    This.getfield(“text10”).display = display.hidden;
    else
    This.getfield(“text10”).display = display.visible;
    In both cases I am getting nothing.  I have realized that I have at least 2 problems:
    1) I don't know how to write the right code and,
    2) I don't know where to put it.
    Please and thank you

    Yes, here is a link to the documentation: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.135.html
    There are a number of examples that demonstrate various options. You can add a title, but to make the JavaScript warning go away the document would have to be certified and the user would have to trust it to execute JavaScript, or each user would have to install a JavaScript file in a particular location on their system. If this might be feasible for your situation, post again for more details.
    If you want to get really fancy, it's possible to create custom dialogs that include things like images as well as text, and you have more control over the layout. This is one of the more complicated things in Acrobat JavaScript though, so you have to really want it if you plan on learning more.

  • Problem using a checkbox in a DB update. Please help

    Hello;
    I am writting a little application as a type of control. I am
    using a checkbox as lets say an on off switch. All my pages work
    nice up to the point of turning the check off, or taking it away so
    the BD table field is blank. I get an error when I uncheck the box
    and hit update. Can anyone help me? I will attach my code, here is
    the error I get:
    Error Executing Database Query.
    [Macromedia][SequeLink JDBC Driver][ODBC
    Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in
    UPDATE statement.
    The error occurred in
    C:\websites\108392zj7\sound\sound_RecordAction.cfm: line 9
    7 : <cfif ParameterExists(Form.btnEdit_OK)>
    8 : <cfif ParameterExists(Form.RecordID)>
    9 : <cfupdate datasource="#sitedatasource#"
    username="#siteUserID#" password="#sitePassword#" tableName="sound"
    formFields="#Form.FieldList#">
    10 : <cflocation url="sound_RecordView.cfm">
    11 : </cfif></cfif>
    SQL update sound set on= (param 1) where ID= (param 2)
    DATASOURCE csee
    VENDORERRORCODE -3503
    SQLSTATE 42000
    attached is the code for the 3 pages I am using to run this
    little app for now. (Will be condensing it down to 1 or 2 pages
    soon.
    Please help, I have been looking at this code for 2 days now
    and can't get it to function properly.
    Phoenix

    I did change the code on the edit page with a soundOn field.
    here is the code:
    <html><head>
    <title>sound - Edit Record</title>
    </head><body bgcolor="#FFFFFF">
    <font size="+1">sound</font> <br>
    <font size="+2"><b>Edit
    Record</b></font>
    <cfoutput>
    <form action="sound_RecordAction.cfm" method="post">
    <input type="hidden" name="FieldList"
    value="#FormFieldList#">
    <cfif isDefined("URL.RecordID")>
    <input type="hidden" name="RecordID"
    value="#URL.RecordID#">
    <input type="hidden" name="ID" value="#URL.RecordID#">
    </cfif>
    <table>
    <tr>
    <td valign="top"> on: </td>
    <td>
    <input type="checkbox" name="soundOn"
    value="#soundOn_Value#">
    </td>
    </tr>
    </table>
    <input type="submit" name="btnEdit_OK" value=" OK ">
    <input type="submit" name="btnEdit_Cancel"
    value="Cancel">
    </form>
    </cfoutput>
    </body>
    </html>
    It still isn't changing the db record though. here is the
    rest of the code:
    INDEX PAGE:
    <cfquery name="soundRecord" dataSource="csee"
    maxRows=1>
    SELECT sound.soundOn AS ViewField1, sound.ID AS ID_Field
    FROM sound
    <cfif isDefined ("URL.RecordID")>
    WHERE sound.ID = #URL.RecordID#
    </cfif>
    </cfquery>
    <html>
    <head>
    <title>sound - View Record</title>
    </head>
    <body bgcolor="#FFFFFF">
    <cfoutput query="soundRecord">
    <table>
    <tr>
    <td width="66" align="left" valign="top"> <font
    size="2" face="Verdana, Arial, Helvetica, sans-serif">Sound
    is:</font></td>
    <td width="114" align="left" valign="top"><font
    size="2" face="Verdana, Arial, Helvetica, sans-serif"><cfif
    ViewField1 eq
    0>off<cfelse>on</cfif></font></td>
    </tr>
    <tr>
    <td colspan="2" align="left" valign="top"><form
    action="sound_RecordAction.cfm" method="post">
    <input type="hidden" name="RecordID"
    value="#ID_Field#">
    <input type="submit" name="btnView_Edit" value=" Turn
    sound off ">
    </form></td>
    </tr>
    </table>
    </cfoutput>
    </body>
    </html>
    And action page:
    <cfif isDefined("Form.btnEdit_OK")>
    <cfif isDefined("Form.RecordID")>
    <cfparam name="form.soundOn" default="0">
    <cfquery datasource="#sitedatasource#"
    username="#siteUserID#" password="#sitePassword#">
    UPDATE sound
    SET soundOn = <cfqueryparam value="#form.soundOn#"
    cfsqltype="cf_sql_bit">
    WHERE ID = <cfqueryparam value="#form.RecordID#"
    cfsqltype="cf_sql_integer">
    </cfquery>
    <cflocation
    url="sound_RecordView.cfm?RecordID=#Form.RecordID#">
    </cfif></cfif>
    The first code is page 2, the edit page. Don't know why it
    isn't changing the DB record.
    Phoenix

  • Is There a Bug in pdk-html:checkbox  .... ?

    I am attempting to use the <pdk-html:checkbox ....> tag and cannot get it to work.
    When the user presses the Submit button and my code processes the checkbox the checkbox does not reflect that the user checked it.
    The code I wrote in the .jsp is:
    <pdk-html:checkbox value="yes" name="facListBean" property="check_box"></pdk-html:checkbox>
    When the page gets rendered the code gets translated to :
    <input type="checkbox" name="check_box" value="yes">
    Notice the name is not qualified in any way. In the other pdk-html tags I have used the name gets prepended with qualifying data.
    Is this a bug in the pdk-html:checkbox tag? Has anyone else use the pdk-html:checkbox successfully?

    Thanks Don,
    I was unaware of the multibox tag so I looked into it after reading your response. I tried to implement the following example code I found on the Husted web site:
    JSP:
    <logic:iterate id="item" property="items">
    <html:multibox value="val" property="selectedItems">
    <bean:write name="item"/>
    </html:multibox>
    <bean:write name="item"/>
    </logic:iterate>
    Action Form
    private String[] selectedItems = {};
    private String[] items = {"UPS","FedEx","Airborne"};
    public String[] getSelectedItems() {
    return this.selectedItems;
    public void setSelectedItems(String[] selectedItems) {
    this.selectedItems = selectedItems;
    I get the error:
    "You must specify the value attribute or nested tag content"
    I added a value attribute to the multibox tag but that didn't change the error. Any idea what what I need to do here? What am I missing?
    Thanks,

  • How to use nested tag in Struts

    Hi..
    Can any one guide me how to use nested tag in Struts. So far i already tried bean tag with no error but when i try to use nested tag i got error like
    javax.servlet.ServletException: Cannot find bean: "" in any scope
    Below are my class:
    action class
    session.setAttribute ("MyDetailList", detailList);
    JSP page
    <logic:iterate id="list" name="MyDetailList">
    Company ID : <bean:write name="list" property="companyID" />
    </logic:iterate>
    For bean tag, i got no error at all and below are my code for nested tag
    action class
    session.setAttribute ("MyDetailList", detailList);
    JSP Page
    <nested:nest property="MyDetailList">
    Make : <nested:text property="make"/>
    Car ID : <nested:text property="carID"/>
    </nested:nest>
    When i run the code, i got error message
    javax.servlet.ServletException: Cannot find bean: "" in any scope
    Any body can help me?
    zul

    what am I doing wrong?You will notice above that I mentioned
    YOU CAN'T USE CUSTOM TAGS AS ATTRIBUTES TO OTHER CUSTOM TAGS
    (was that loud enough for you to notice this time)?
    Try
    <html:text styleId="instruction" styleClass="text" size="50" name="instruction" property="value"/>
    //or
    <html:text styleId="instruction" styleClass="text" size="50" property="instruction" value="<%= instruction.getValue() %>"/>
    better alternative: populate your formbean with your action and just have:
    <html:text styleId="instruction" styleClass="text" size="50" property="instruction"/>
    If you set the "instruction" property of your formBean in the action, the value will be automagically reflected here.
    Cheers,
    evnafets

  • Read/set HTML checkbox in JSP

    Hello,
    I need to directly read and set the state of an HTML checkbox from a JSP page that contains it. It is not sufficient to submit the form and then get the value from the next page; I need to be able to set the value when the page loads, and then on cue, store the (possibly changed) state of the checkbox within the same page.
    How can this be done? Thanks in advance.

    you write the checkbox tag dynamically...
    <input type="checkbox" ... <%= checked ? "checked" : "" %>>
    or use a tag library that does it for you.
    But you can't do it within the page without Javascript. Once it loads in the browser, the Java part of the page is done and gone. So either you use Javascript to alter things in the browser before submitting the form, or you submit the page and recreate it based on what's submitted so far.

  • Html:checkbox tag problem

    I need to use multiple checkbox(i.e One checkbox in each rows).I am using Struts1 and need to capture the list of values which the users selects the checkboxes.Need information to capture the selected values in action class.sample code could be more helpful..

    In Struts i think there are some variables in formbean which will store the value of forms parameters so you can access these values by form object passed in action class.

  • I would like to know how to stretch a background image using HTML

    Hello Seniors of Sun,
    I gota small doubt in HTML, can any one please help me in solving it,
    I would like to know how to stretch a background image using HTML? I have tried and tried to figure this out and cannot..
    so any one kindly help me in this...
    waiting for reply...

    Please note that this is not an HTML forum.
    You can use an image tag on a DIV positioned behind the rest of the page, so that could actually work. And if you want to use body:background, then look up an HTML/CSS reference and see if there are any other body attributes or CSS stuff that applies to the background image.

  • HTML Checkbox can raise a OnInputProcessing event???

    Hello all,
    i have a little problem with an application with flow logic page. I have to incorporate a group of html checkbox that raise an event in the OnInputProcessing like an button do. this can be done?? and how can be do it??? . Please help. Thanx in advance

    Hi Mariana,
    If you want to call the OnInputProcessing Event then you need to use htmlb checkbox.
    Here is the sample code....
    In Page with flow logic....
    In Layout section...
    <%@page language="abap" %>
    <%@extension name="htmlb" prefix="htmlb" %>
    <htmlb:content design="design2003" >
      <htmlb:page title="Tab Strip" >
        <htmlb:form>
          <htmlb:checkboxGroup id="chkboxgrp" >
            <htmlb:checkbox id      = "cb1"
                            text    = "Red"
                            onClick = "myEvent1" />
            <htmlb:checkbox id      = "cb2"
                            text    = "Green"
                            onClick = "myEvent2" />
            <htmlb:checkbox id      = "cb3"
                            text    = "Blue"
                            onClick = "myEvent3" />
          </htmlb:checkboxGroup>
           <br>
          <%= red %>
          <br>
          <%= green %>
          <br>
          <%= blue %>
        </htmlb:form>
      </htmlb:page>
    </htmlb:content>
    In Page Attributes Section...
    blue     TYPE     STRING
    green     TYPE     STRING
    red     TYPE     STRING
    In OnInputProcessing section...
    data: chkbox1 type ref to cl_htmlb_checkbox,
          chkbox2 type ref to cl_htmlb_checkbox,
          chkbox3 type ref to cl_htmlb_checkbox.
    chkbox1 ?= CL_HTMLB_MANAGER=>GET_DATA(
    request = runtime->server->request
    name = 'checkbox'
    id = 'cb1' ).
    chkbox2 ?= CL_HTMLB_MANAGER=>GET_DATA(
    request =  runtime->server->request
    name = 'checkbox'
    id = 'cb2' ).
    chkbox3 ?= CL_HTMLB_MANAGER=>GET_DATA(
    request =  runtime->server->request
    name = 'checkbox'
    id = 'cb3' ).
    DATA: event TYPE REF TO CL_HTMLB_EVENT.
    event = CL_HTMLB_MANAGER=>get_event( runtime->server->request ).
    IF event->name = 'checkbox' AND event->event_type = 'click'.
      case event->id.
        when 'cb1'.
          red = chkbox1->checked.
          if red eq ' '.
            red = 'Not Selected'.
          else.
            red = 'Red Selected'.
          endif.
        when 'cb2'.
          chkbox2 ?= CL_HTMLB_MANAGER=>GET_DATA(
          request =  runtime->server->request
          name = 'checkbox'
          id = 'cb2' ).
          green = chkbox2->checked.
          if green eq ' '.
            green = 'Not Selected'.
          else.
            green = 'Green Selected'.
          endif.
        when 'cb3'.
          chkbox3 ?= CL_HTMLB_MANAGER=>GET_DATA(
          request =  runtime->server->request
          name = 'checkbox'
          id = 'cb3' ).
          blue = chkbox3->checked.
          if blue eq ' '.
            blue = 'Not Selected'.
          else.
            blue = 'Blue Selected'.
          endif.
      endcase.
    ENDIF.
    Hope it solves your problem.
    Regards,
    Maheswaran.B

  • Can i use HTML coding in oracle alerts

    Hi,
    I have a doubt in oracle alerts.
    can i use html coding in oracle alerts.
    If so can anyone please help me out this.
    Thankig you,
    Regards,
    RR

    hi vingorius ,
    No you cant include html but u can use variables
    To add a variable in a text message to provide context for the iBot attachment
    1. Click the following option:
    If sent as attachment, include this text
    2. Type the text into the text box with a session variable, a repository variable, or a presentation variable using the syntax shown in the following table:
    Variable Type
    Syntax
    Repository @{Variable_Name}
    Session @{NQ_SESSION.Variable_Name}
    Presentation @{Variable_Name}
    For example, Dear, @{NQ_SESSION.Variable_Name}, here is your personalized Weekly Sales Territory Update.
    NOTE: If you want to use the @ character, you need to precede it with the \ (back slash) character to separate it from the variable syntax. For example, Dear @{NQ_SESSION.DISPLAYNAME}, \@ New York, appears as Dear Joe Smith, @ New York.
    Source : BI Guide
    Thanks,
    Saichand.v

  • I built a website for a customer using HTML only, so it would work on everything, but some of the text numbers are not clear on the ipad. It works perfectly on all the other browsers.

    I built a website for a customer using HTML only, so it would work on any browser, and it works perfectly on everything except ipad safari. I'm loosing information with most of my text numbers - instead of being black they are displaying a 'ghost' image (white) of the numbers.
    Is this a memory issue, or cache issue, or something else?  I've downloaded iCab and the site works perfectly with it.
    Also wondering if I can manually reload/refresh web pages in iPad Safari.
    Since most people with iPads will use Safari rather than iCab, I have to tweak this site to work in Safari.

    Detecting phone numbers and making them clickable is a feature of the browser, and rebuilding your web-site links will not make any difference. Its done when the page is shown in the browser, not when the page is created.
    According to the Safari iOS developers guide, you can turn these data detectors off using this code:
    <meta name = "format-detection" content = "telephone=no">
    http://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Referen ce/Articles/PhoneLinks.html

Maybe you are looking for