读书人

在后台添加一篇文章,在前台显示的格式

发布时间: 2012-01-24 23:11:54 作者: rapoo

在后台添加一篇文章,在前台显示的格式与后台添加的这篇文章格式一模一样
有没有谁做过
在后台添加一篇文章,在前台显示的格式与后台添加的这篇文章格式一模一样
该怎么实现,,谢了,

[解决办法]
/**
* Function Detail : 对输入的字符处理
* @param pstrWord
* @return
* @throws java.io.UnsupportedEncodingException
*/
public static String replaceIn(String pstrWord) throws Exception
{
//pstrWord = replace(pstrWord);
pstrWord = htmlEncode(pstrWord);
pstrWord = pstrWord.replaceAll( "\n ", " <br> ");
pstrWord = pstrWord.replaceAll( " ", "&nbsp ");
pstrWord = pstrWord.replaceAll( " ", "  ");
return pstrWord;
}
/**
* Function Detail : 对输出的字符处理
* @param pstrWord
* @return
* @throws java.io.UnsupportedEncodingException
*/
public static String replaceOut(String pstrWord) throws Exception
{
pstrWord = pstrWord.replaceAll( " <br> ", "\n ");
pstrWord = pstrWord.replaceAll( "&nbsp ", " ");
pstrWord = pstrWord.replaceAll( "  ", " ");
pstrWord = toChinese(pstrWord);
return pstrWord;
}
这些可以完成的(转自另一高手名字忘了)

读书人网 >Java Web开发

热点推荐