anchor.diff:  <%@ page import="org.apdplat.superword.rule.CompoundWord" %>
   <%@ page import="org.apdplat.superword.tools.HtmlFormatter" %>
   <%@ page import="org.apdplat.superword.tools.WordLinker" %>
  -<%@ page import="org.apdplat.superword.tools.WordSources" %>
  +<%@ page import="org.apdplat.superword.tools.WordLinker.Dictionary" %>
   <%@ page import="java.util.List" %>
   <%@ page import="java.util.Map" %>
   <%@ page import="java.util.HashMap" %>
  +<%@ page import="java.util.Set" %>
   
   <%@ page contentType="text/html;charset=UTF-8" language="java" %>
   <%
  -    Word word = new Word(request.getParameter("word"), "");
       int column = 10;
       try{
           column = Integer.parseInt(request.getParameter("column"));
       }catch (Exception e){}
  -    Map<Word, Map<Integer, List<Word>>> compound = (Map<Word, Map<Integer, List<Word>>>)application.getAttribute("compound");
  +    String word = request.getParameter("word");
  +    String all = request.getParameter("all");
  +    if(word == null && all == null){
  +        return;
  +    }
  +    String word_type = request.getAttribute("words_type").toString();
  +    Set<Word> words = (Set<Word>)application.getAttribute("words_"+word_type);
  +    String key = "compound_"+word_type;
  +
  +    Map<Word, Map<Integer, List<Word>>> compound = (Map<Word, Map<Integer, List<Word>>>)application.getAttribute(key);
       if(compound == null){
  -        compound = CompoundWord.find(WordSources.getAll(), WordSources.getAll());
  -        application.setAttribute("compound", compound);
  +        synchronized (this){
  +            if(compound == null){
  +                compound = CompoundWord.find(words, words);
  +                application.setAttribute(key, compound);
  +            }
  +        }
       }
  -    Map<Integer, List<Word>> data = compound.get(word);
  +
  +    Dictionary dictionary = WordLinker.getValidDictionary(request.getParameter("dict"));
       String htmlFragment = "";
  -    if(data != null && data.size() > 0) {
  -        Map<Word, Map<Integer, List<Word>>> temp = new HashMap<Word, Map<Integer, List<Word>>>();
  -        temp.put(word, data);
  -        htmlFragment = HtmlFormatter.toHtmlForCompoundWord(temp, WordLinker.getValidDictionary(request.getParameter("dict")));
  +    if("true".equals(all)){
  +        htmlFragment = HtmlFormatter.toHtmlForCompoundWord(compound, column, dictionary);
       }else{
  -        htmlFragment = WordLinker.toLink(word.getWord(), WordLinker.getValidDictionary(request.getParameter("dict")));
  +        if(word != null && word.length() > 3){
  +            Word w = new Word(word, "");
  +
  +            Map<Integer, List<Word>> data = compound.get(w);
  +            if(data != null && data.size() > 0) {
  +                Map<Word, Map<Integer, List<Word>>> temp = new HashMap<Word, Map<Integer, List<Word>>>();
  +                temp.put(w, data);
  +                htmlFragment = HtmlFormatter.toHtmlForCompoundWord(temp, column, dictionary);
  +            }else{
  +                htmlFragment = "<font color=\"red\">不能分解，请尝试其他分级词汇：</font>"+WordLinker.toLink(w.getWord(), dictionary);
  +            }
  +        }else{
  +            htmlFragment = "<font color=\"red\">单词长度要>3</font>";
  +        }
       }
   %>
   <html>
  
positive.code:         function update(){
              var word = document.getElementById("word").value;
              var dict = document.getElementById("dict").value;
              var column = document.getElementById("column").value;
  
              if(word == ""){
                  return;
              }
              location.href = "compound-word-rule.jsp?word="+word+"&dict="+dict+"&column="+column;
          }
          document.onkeypress=function(e){
              var e = window.event || e ;
  
negative.code:     </p>
      <p>
          <font color="red">输入单词：</font><input onchange="update();" id="word" name="word" value="<%=word==null?"":word%>" size="50" maxlength="50"><br/>
          <font color="red">每行词数：</font><input onchange="viewAllCompound();" id="column" name="column" value="<%=column%>" size="50" maxlength="50"><br/>
          <font color="red">选择词典：</font>
          <jsp:include page="select/dictionary-select.jsp"/><br/>
          <font color="red">选择词汇：</font>
          <jsp:include page="select/words-select.jsp"/><br/>
      </p>
      <p>
          <a href="#1" onclick="update();">分解输入的单词</a><br/>
          <a href="#2" onclick="viewAllCompound();">查看所有复合词</a>
      </p>
      <%=htmlFragment%>
      <jsp:include page="common/bottom.jsp"/>
  