0

How to apply style to a portion of label content? Can we able to set html content to a label?

asked 2010-05-06 02:50:21 +0800

baskaraninfo gravatar image baskaraninfo
526 2 2 9

We have a label as shown below:

<label value="Important: This is a label which needs to apply <b>different style</b> to different portion." />

We need to set bold of text "different style".

How to apply style to a portion of label content?
Or can we able to set html content directly to a label?

Thanks

delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

answered 2010-05-06 02:53:37 +0800

mjablonski gravatar image mjablonski
1284 3 5
http://www.jease.org/

You can use the Html-Tag for this:

<html content="This is a shopping <b>Cart</b>" />

Cheers, Maik

link publish delete flag offensive edit

answered 2010-05-06 23:51:18 +0800

baskaraninfo gravatar image baskaraninfo
526 2 2 9

Thank you, Maik.

When I run your sample code, the following error occurred:

org.zkoss.lang.SystemException: org.xml.sax.SAXParseException: The value of attribute "content" associated with an element type "null" must not contain the '<' character.
	sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	org.zkoss.lang.Classes.newInstance(Classes.java:76)
	org.zkoss.lang.Exceptions.wrap(Exceptions.java:162)
	org.zkoss.lang.SystemException$Aide.wrap(SystemException.java:45)
	org.zkoss.util.resource.ResourceCache.get(ResourceCache.java:156)
	org.zkoss.web.util.resource.ResourceCaches.get(ResourceCaches.java:130)
	org.zkoss.zk.ui.metainfo.PageDefinitions.getPageDefinition(PageDefinitions.java:140)
	org.zkoss.zk.ui.impl.AbstractUiFactory.getPageDefinition(AbstractUiFactory.java:113)
	org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:230)
	org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:159)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

Am I missing something?

link publish delete flag offensive edit

answered 2010-05-07 00:16:24 +0800

ryanwong00 gravatar image ryanwong00
63 1

updated 2010-05-07 00:20:52 +0800

You should escape the < and > characters : e.g.

<html content="abcd&lt;b&gt;test&lt;/b&gt;test">

Ryan :-)

link publish delete flag offensive edit

answered 2010-05-07 05:51:42 +0800

baskaraninfo gravatar image baskaraninfo
526 2 2 9

Thank you, Ryan :)

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-05-06 02:50:21 +0800

Seen: 601 times

Last updated: May 07 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More