We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

How can I display a checkmark as data in a row, coming from Oracle and displaying on JSP page

Alaska Cowboy
on
Medium Priority
723 Views
Last Modified: 2012-08-14
I have a simple table display on a JSP page, it has columns Sunday through Saturday, with rows for various sources of data that load to a data warehouse.

I currently display "Y" for yes, the load is supposed to load on this day, and "-" for not supposed to load on this day.

I'd like to display a nice checkmark, how can I do that ?
Comment
Watch Question

You should be able to use the following html entities

Check mark: &x2713;
'X' mark: &x2717;
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Designbyonyx,

thanks ! I will try this out tomorrow.

Author

Commented:
ok, first attempt didn't work, I tried to replace "Y" with ✓ but it didn't work.

I tried this: <td>${fn:replace(mondayFlag, "Y", "&#x2713;")}</td>

but it still displayed "Y"

I consider myself fairly proficient with jQuery, but I am not familiar with that syntax.  This works:

$('#mySpan').html('&#x2713');

<span id="mySpan">Y</span>

Author

Commented:
Ok, I replaced in the oracle Sql, so that worked !

question: how did you know the HTML codes for checkmarks and X's ? I guess I could have googled it, huh ? but aside from googling everything, how does one put this kind of thing in their toolkit ?
Oh, is that JSP syntax? If so, my bad.

It's important to note that the checkmark symbol I am giving you (ex: &#x2713;) is meant to be rendered on an HTML page.  You may be able to copy and paste the symbol directly from this: ¿

But I cannot tell you whether or not that will work across many devices due to character encoding and such.
The number (2713) is the unicode representation of a checkmark.  Unicode can be represented in HTML by prefixing the number with &#x

Here is pretty complete list of unicode characters:

http://www.fileformat.info/info/unicode/category/So/list.htm

I usually just do a google search for something like "unicode check mark"...  and you either find something or you don't.  Hope that helps.

Author

Commented:
Design,

this is JSTL, and it worked on another page,  

<fmt:formatDate var="time"  value="${detail.loadDateTime}" pattern="h:mm a"/>

followed by

<td> ${fn:replace(time, "AM", "am")}</td>

I don't think there is <fmt:formatString ... /> so I just tried <td>${fn:replace(mondayFlag, "Y", "&#x2713;")}</td> which still rendered "Y"

but it's working great when I did the replace in the Sql . . .

question on your suggestion
>>$('#mySpan').html('&#x2713');
>><span id="mySpan">Y</span>

what is that ? is it CSS or what ?
That's jQuery syntax.  jQuery is a javascript library which allows you to traverse the DOM using the same syntax you use with CSS.  

For example, lets take the following DOM node:
<span id="mySpan">Text inside of my span</span>

If you wanted to modify this DOM object with javascript you would have to do something like this:
var mySpan = document.getElementById('mySpan');
mySpan.innerHTML = "&#x2713;";

Open in new window


If you wanted to style this object with CSS, you would use the following syntax in your style sheet:
#mySpan {
    color: #FF0000;
}

Open in new window


jQuery lets you manipulate the DOM with CSS selectors by using the following syntax... which is the jQuery equivalent  of the above javascript:
var mySpan = $('#mySpan');
mySpan.html('&#x2713;');

Open in new window


Hope that helps.  If you work with HTML, you should definitely check out jQuery.

Author

Commented:
yes, I'm somewhat familiar with jQuery.

but why do you say that's jQuery syntax ? I thought it was JSTL ? (this --> <fmt:formatDate var="time"  value="${detail.loadDateTime}" pattern="h:mm a"/> )

thanks for the expln.
I'm sorry... slight misunderstanding.  I am not really familiar with JSP, so when you posted this code snippet:

<td>${fn:replace(mondayFlag, "Y", "&#x2713;")}</td>

I thought you were doing something funky with jQuery that I had never see before... so I responded with a jQuery solution.  Then I realized that your code snippet was not jQuery. I assume that it's JSP??  Still not really sure.  I guess the important thing is you got the solution you were looking for.

Author

Commented:
yes, JSP supplemented with JSTL, but I do use JQuery in this application.

All is good (for this, anyway) . . .
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.