Conditional XHTML attribute in JSPX

Discussion in 'Java' started by 3W, Apr 8, 2004.

  1. 3W

    3W Guest

    Is there any way to have a conditional attribute on an XHTML element,
    using JSPX (JSP in XML syntax)? Or any taglibs that'll do it?
    More specifically, defining selected="selected" or checked="checked",
    etc.

    TIA,
     
    3W, Apr 8, 2004
    #1
    1. Advertising

  2. 3W

    Enrique Guest

    Would you provide an example of the desired output, and the conditions
    that must be met for each?
     
    Enrique, Apr 9, 2004
    #2
    1. Advertising

  3. 3W

    3W Guest

    (Enrique) wrote in message news:<>...
    > Would you provide an example of the desired output, and the conditions
    > that must be met for each?


    public class SomeBean {
    boolean checked;
    public boolean isChecked() {
    return isChecked;
    }
    }

    Then in JSPX I would like the checkbox to be dependant on isChecked():

    <input type="checkbox" name="someCheckbox"/>
    or
    <input type="checkbox" name="someCheckbox" checked="checked"/>
     
    3W, Apr 10, 2004
    #3
  4. 3W

    Enrique Guest

    Would this do?

    <jsp:scriptlet>
    if (myBean.isChecked())
    {
    </jsp:scriptlet>
    <input type="checkbox" name="someCheckbox" checked="checked" />
    <jsp:scriptlet>
    }
    else
    {
    </jsp:scriptlet>
    <input type="checkbox" name="someCheckbox" />
    <jsp:scriptlet>
    }
    </jsp:scriptlet>
     
    Enrique, Apr 17, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. yzzzzz

    Parsing jspf files like jspx

    yzzzzz, Jan 12, 2005, in forum: Java
    Replies:
    0
    Views:
    763
    yzzzzz
    Jan 12, 2005
  2. yzzzzz
    Replies:
    0
    Views:
    1,560
    yzzzzz
    Feb 9, 2005
  3. Replies:
    0
    Views:
    391
  4. anonymous
    Replies:
    1
    Views:
    5,961
  5. SrferDave

    .jsp vs .jspx question

    SrferDave, Aug 27, 2007, in forum: Java
    Replies:
    2
    Views:
    4,291
    Daniel Pitts
    Aug 27, 2007
Loading...

Share This Page