-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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
You can use the Html-Tag for this:
<html content="This is a shopping <b>Cart</b>" />
Cheers, Maik
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?
You should escape the < and > characters : e.g.
<html content="abcd<b>test</b>test">
Ryan :-)
Thank you, Ryan :)
Asked: 2010-05-06 02:50:21 +0800
Seen: 601 times
Last updated: May 07 '10