找了好长一段时间,原文请参考以下地址:
java 实现繁简字体转换(笨方法):http://www.javaeye.com/topic/261542?page=1
javabean:gb2big.java
// Created on 2009-4-13
package util;
public class gb2big
{
String shortChar = “万与丑专业丛东丝….”; //这里输出不完,请从网上的javascript找到完整字库
String longChar = “萬與醜專業叢東絲….”;
public String gb2big(String str)
{
String outputStirng = “”;
for (int i = 0; i < str.length(); i++)
{
if(shortChar.indexOf(str.charAt(i)) != -1)
{
outputStirng += longChar.charAt(shortChar.indexOf(str.charAt(i)));
}
else
{
outputStirng += str.charAt(i);
}
}
return outputStirng;
}
}
测试页面:test.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ page import="java.*"%>
<%@ page import="util.*"%>
Tags: java, javabean, jsp, 字符对应, 源码, 简体繁体, 简繁, 简繁转换, 繁简
用成熟的开源单点登录软件,抑或根据自己的简单需求进行开发?
目前在考察中的两个开源项目:
如果你知道,有更好的单点登录系统或模块——主要是指更小巧——请推荐给我,mail:gsls.info@gmail.com
更多的开源资源:http://www.open-open.com/
Tags: cas, java, josso, open source, sso, 单点登录,开源数图, 开源
FCKeditor_2.4.2:教育网、sourceforgeFCKeditor.java_2.3:教育网、sourceforge
a、将FCKeditor-2.3\web\WEB-INF\lib文件夹下的commons-fileupload.jar、FCKeditor-2.3.jar两个文件拷贝至网站WEB-INF\lib文件夹下;b、将FCKeditor-2.3\src文件夹下的FCKeditor.tld文件拷贝至网站WEB-INF文件夹下;c、将\web\WEB-INF文件夹下的web.xml相关内容拷贝至网站WEB-INF文件夹下的web.xml文件中(resin为例)。
imageBrowserURL=”/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector”
linkBrowserURL=”/FCKeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector”
flashBrowserURL=”/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector”
imageUploadURL=”/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Image”
linkUploadURL=”/FCKeditor/editor/filemanager/upload/simpleuploader?Type=File”
flashUploadURL=”/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Flash”>
</FCK:editor>
将一张大图片切割成100*100的图片.
用了batik包,可以从这里下载:http://apache.justdn.org/xml/batik/
import org.apache.batik.apps.rasterizer.DestinationType;
import org.apache.batik.apps.rasterizer.SVGConverter;
import javax.imageio.ImageIO;
import java.io.File;
import java.awt.*;
import java.awt.image.BufferedImage;
public class ImageTiler {
private
static final String BASE_DIR = “jpg/”;
private
static final int TILE_WIDTH = 100;
private
static final int TILE_HEIGHT = 100;
public
static void main(String[] args) throws Exception {
// create the tiles
String[][] sources = { { “0/0.jpg”, “0″ },{”0/1.jpg”, “1″} };
for (int i = 0; i < sources.length; i++) {
String[] source = sources[i];
BufferedImage bi = ImageIO.read(new File(BASE_DIR +
source[0]));
int columns = bi.getWidth() / TILE_WIDTH;
int rows = bi.getHeight() / TILE_HEIGHT;
for (int x = 0; x < columns; x++) {
for (int y = 0; y < rows; y++) {
BufferedImage img = new BufferedImage(TILE_WIDTH,
TILE_HEIGHT,
bi.getType());
Graphics2D newGraphics = (Graphics2D) img.getGraphics();
newGraphics.drawImage(bi, 0, 0, TILE_WIDTH, TILE_HEIGHT,
TILE_WIDTH * x, TILE_HEIGHT * y,
TILE_WIDTH * x + TILE_WIDTH,
TILE_HEIGHT * y + TILE_HEIGHT,
null);
ImageIO.write(img, “jpg”, new File(BASE_DIR + “0/” +
“x” + x + “y” + y + “z” + source[1] + “.jpg”));
}
}
}
}
}
//新闻rss
//jnuzyx.2006.09.20
//需要JDOM1.0
//需要数据库链接类
package rss;
import java.io.FileOutputStream;
import java.util.Date;
import java.text.SimpleDateFormat;
import org.jdom.Attribute;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.output.XMLOutputter;
import org.jdom.output.Format;
import org.jdom.CDATA;
import java.sql.*;
import *.*Pool;
public class news
{
//
public
static void rssnews(String dir) throws Exception {
Element root = new Element(”rss”);
root.setAttribute(new Attribute(”version”, “2.0″));
Document doc = new
Document(root);
//将根元素植入
Element channel = new Element(”channel”);
root.addContent(channel);
Element Ntitle = new Element(”title”);
Ntitle.addContent(”暨南大学图书馆新闻订阅”);
channel.addContent(Ntitle);
Element Nlink = new Element(”link”);
Nlink.addContent(”http://lib.jnu.edu.cn/“);
channel.addContent(Nlink);
Element Ndescription = new Element(”description”);
Ndescription.addContent(”暨南大学图书馆新闻订阅”);
channel.addContent(Ndescription);
Element Nlanguage = new Element(”language”);
Nlanguage.addContent(”zh-cn”);
channel.addContent(Nlanguage);
Element Ncopyright = new Element(”copyright”);
Ncopyright.addContent(”Copyright 2006 暨南大学图书馆. All Rights
Reserved.”);
channel.addContent(Ncopyright);
Element NwebMaster = new Element(”webMaster”);
NwebMaster.addContent(”暨南大学图书馆”);
channel.addContent(NwebMaster);
Element NpubDate = new Element(”pubDate”);
java.util.Date now=new java.util.Date();
NpubDate.addContent(FormatRssDate(now));
channel.addContent(NpubDate);
Element NlastBuildDate = new Element(”lastBuildDate”);
NlastBuildDate.addContent(FormatRssDate(now));
channel.addContent(NlastBuildDate);
Element Ngenerator = new Element(”generator”);
Ngenerator.addContent(”JNULRSS 1.0(beta)”);
channel.addContent(Ngenerator);
//读入数据库数据
//*.*Pool pool = new ****;
ResultSet rs = pool.getRs(”$sql 语句$”);
//增加ITEM
String strContent;
while(rs.next()){
Element student = new
Element(”item”);//生成元素
student.addContent(new
Element(”title”).addContent(rs.getString(”*”)));
student.addContent(new Element(”link”).addContent(”$url$”)));
student.addContent(new
Element(”author”).addContent(”jnuzyx”));
student.addContent(new
Element(”category”).addContent(”暨南大学图书馆新闻订阅”));
student.addContent(new
Element(”pubdate”).addContent(FormatRssDate($date$)));
if(rs.getString(”$content$”)!=null)
{
strContent =
rs.getString(”$content$”).substring(0, 320)+”….”;
}
else
{
strContent = “请点击查看全文….”;
}
student.addContent(new Element(”description”).addContent(new
CDATA(strContent)));
channel.addContent(student);
}
//关闭
if(rs!=null)
{
rs.close();
}
rs = null;
//输出
try{
XMLOutputter XMLOut = new
XMLOutputter(Format.getPrettyFormat());
XMLOut.output(doc, new FileOutputStream(dir + “news.xml”));
}catch (java.io.IOException e) {
e.printStackTrace();
}
}
public
static String FormatRssDate(Date dt) {
SimpleDateFormat RssFmtDt=new SimpleDateFormat(”EEE, dd MM yyyy
HH:mm:ss z”);
return RssFmtDt.format(dt).toString();
}
}