Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 592549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:45:05+00:00 2026-05-13T15:45:05+00:00

In this code: <html:text property=txtItem5 disabled=disTxtItem5> I can see that txtItem5 comes from a

  • 0

In this code:

<html:text property="txtItem5" disabled="disTxtItem5">

I can see that “txtItem5” comes from a getTxtItem5() in the ActionForm, but searching the project for other substrings of “disTxtItem5” seemingly reveals nothing remotely related, though clearly somehow the framework is pulling a boolean from this string, which clearly means that it’s more complicated than my current understanding.

Could someone give a good explanation of how these expressions are evaluated, or point me in the direction of one?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T15:45:05+00:00Added an answer on May 13, 2026 at 3:45 pm

    EDIT: In my original response (see below) I said that Struts manages the conversion, but I was wrong. I didn’t remember exactly what was going so I pulled out Struts’s sources and took a look. It turns out that the conversion is made by the server. The JSP is converted to a servlet before execution and it is here that false is used for non boolean values.

    For example, I used the following tag:

    <html:text property="nr" disabled="BlaBla" />
    

    Which was translated to the following html (no disabled):

    <input type="text" name="nr" value="123">
    

    This happened in the servlet. Here is what my servlet contains for the above tag:

    //  html:text
        org.apache.struts.taglib.html.TextTag _jspx_th_html_005ftext_005f0 = (org.apache.struts.taglib.html.TextTag) _005fjspx_005ftagPool_005fhtml_005ftext_005fproperty_005fdisabled_005fnobody.get(org.apache.struts.taglib.html.TextTag.class);
        _jspx_th_html_005ftext_005f0.setPageContext(_jspx_page_context);
        _jspx_th_html_005ftext_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_html_005fform_005f0);
        _jspx_th_html_005ftext_005f0.setProperty("nr");
        _jspx_th_html_005ftext_005f0.setDisabled(false);
        int _jspx_eval_html_005ftext_005f0 = _jspx_th_html_005ftext_005f0.doStartTag();
    

    As it can be seen, the disabled value is generated with false, directly. I did some more digging into the Jasper compiler (I used Tomcat) and I think that it is the org.apache.jasper.compiler.JspUtil class that is responsible for the conversion, with the following code:

    public static boolean booleanValue(String s) {
      boolean b = false;
      if (s != null) {
        if (s.equalsIgnoreCase("yes")) {
           b = true;
        } else {
           b = Boolean.valueOf(s).booleanValue();
        }
      }
      return b;
    }
    

    Since I inserted BlaBla in the disabled field this should fallback to Boolean.valueOf(s).booleanValue(); which does the following:

    public static Boolean valueOf(String s) {
      return toBoolean(s) ? TRUE : FALSE;
    }
    
    private static boolean toBoolean(String name) { 
      return ((name != null) && name.equalsIgnoreCase("true"));
    }
    

    This way, BlaBla results in false.

    ORIG: The following was my original response, but was incorrect. What I was describing was in fact what happens when request parameters are binded to the action form.

    The disabled attribute is of type boolean, so it should receive only values that map to a boolean. disabled="disTxtItem5" would throw a ConversionException because the text disTxtItem5 does not map to a boolean.

    Struts uses CommonBeanUtils to make conversions, so a BooleanConverter will be used, with code like the following:

    String stringValue = value.toString();
    if (stringValue.equalsIgnoreCase("yes") ||
       stringValue.equalsIgnoreCase("y") ||
       stringValue.equalsIgnoreCase("true") ||
       stringValue.equalsIgnoreCase("on") ||
       stringValue.equalsIgnoreCase("1")) {
       return (Boolean.TRUE);
    } else if (stringValue.equalsIgnoreCase("no") ||
       stringValue.equalsIgnoreCase("n") ||
       stringValue.equalsIgnoreCase("false") ||
       stringValue.equalsIgnoreCase("off") ||
       stringValue.equalsIgnoreCase("0")) {
       return (Boolean.FALSE);
    } else if (useDefault) {
       return (defaultValue);
    } else {
       throw new ConversionException(stringValue);
    }
    

    At this point I don’t remember if Struts just logs the exception and fails silently setting false as the value of the parameter or, the exception is propagated (it’s been a while since I used Struts 😀 but I’m more inclined to think that it just sets false and continues).

    The logs should point out the exception even if it is ignored. Setting a logger for org.apache.commons.beanutils or org.apache.struts should indicate any conversion errors.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So if I call this function: $(#item).text() on this HTML code: <div id=item> <pre><span
I have run this Perl code: #!/usr/bin/perl print content-type: text/html \n\n; print Hello World.\n;
I am having trouble copying text using zeroclipboard. This is my html code: <dl
OK i have this code HTML: <html> <head> <script type=text/javascript src=http://code.jquery.com/jquery-1.7.1.min.js> </script> <script type=text/javascript>
why this.style[property] get an empty string? my code is: <!DOCTYPE html> <html> <head> <title>Demo</title>
I have an application that contains this code: <script src=Scripts/jquery-1.4.1.min.js type=text/javascript></script> <script src=Scripts/facebox.js type=text/javascript></script>
I have this code: @Html.DropDownList(ddlCouponsAppointment, Model.Coupons.Select(a => new SelectListItem { Text = a.Name, Value
I have this html code: <div class=action> some_text <a class=delete_action name=q1>some</a> </div> <div class=action>
I have (basically) this code - <script type=text/javascript language=javascript> $(document).ready(function() { $(#loadDiv).load(mypage.html, function(){ alert($(#someText).text())
Check this code : HTML : <div style="position: absolute; visibility: visible; width: 172px;"> <img

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.