日期:2014-05-18  浏览次数:20673 次

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

------解决方案--------------------
/**
* 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( " ", "&nbsp; ");
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( "&nbsp; ", " ");
pstrWord = toChinese(pstrWord);
return pstrWord;
}
这些可以完成的(转自另一高手名字忘了)