Tutorials to .com

Tutorials to .com » Jsp » Xml » Apache Img Tag used to generate images immediately verify

Apache Img Tag used to generate images immediately verify

Print View , by: iSee ,Total views: 5 ,Word Count: 559 ,Date: Mon, 20 Apr 2009 Time: 2:03 AM


Now online through jsp many ways to generate picture. Working environment in sitemesh is not very good.

Another option is to introduce methods:

Generated by Apache Img Tag picture then verify these steps:
1, download the jakarta-taglibs-sandbox-image
If you need support for gif, download PJA Toolkit (in http://www.eteks.com)

2, copy the appropriate jar files to WEB-INF/lib directory 3, configure the web.xml file <servlet>
<servlet-name> ImageServlet </ servlet-name>
<servlet-class> org.apache.taglibs.image.ImageServlet </ servlet-class>
</ servlet>

<servlet-mapping>
<servlet-name> ImageServlet </ servlet-name>
<url-pattern> / servlet / org.apache.taglibs.image.ImageServlet </ url-pattern>
</ servlet-mapping>
<taglib>
<taglib-uri> http://jakarta.apache.org/taglibs/image-1.0 </ taglib-uri>;
<taglib-location> / WEB-INF/taglibs-image.tld </ taglib-location>
</ taglib>

4, sitemesh decorators.xml configuration file <excludes>
<pattern> / decorators / * </ pattern>
<pattern> / resources / * </ pattern>
<pattern> / servlet / * </ pattern>
</ excludes>

5, jsp use of I. By joining the first <% @ taglib uri = "http://jakarta.apache.org/taglibs/image-1.0" prefix = "img"%>
II. Adding code <%
java.util.Random random = new java.util.Random ();

String sRand = "";
for (int i = 0; i <4; i + +) (
String rand = String.valueOf (random.nextInt (10));
sRand + = rand;
)
session.setAttribute ( "rand", sRand);
%>
<img: image
src = "/ images / blank.jpg" refresh = "true">
<img: text
text ="<%= sRand%> "
x = "0"
y = "0"
font = "Arial"
bold = "true"
size = "12"
color = "0xff0000"
/>
</ img: image>
III. The optional use of a number of different colors in different <img: image
src = "images / blank.jpg" refresh = "true">

<img: text
text = "2"
x = "0"
y = "0"
font = "Arial"
bold = "true"
size = "12"
color = "0xff0000"
/>
<img: text
text = "3"
x = "25%"
y = "0"
font = "Arial"
bold = "true"
size = "12"
color = "0x000000"
/>
<img: text
text = "4"
x = "50%"
y = "0"
font = "Arial"
bold = "true"
size = "12"
color = "0x00ff00"
/>
<img: text
text = "5"
x = "75%"
y = "0"
font = "Arial"
bold = "true"
size = "12"
color = "0x00ffff"
/>
</ img: image>


Java and XML Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.