<div id="blog_content" class="hide-main-content"> <div class="hide-article-box text-center" style="display: none;"> <a class="btn" id="btn-readmore">閱讀更多</a> </div> <p> </p> <div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin-top: 8px; margin-right: 8px; margin-bottom: 8px; margin-left: 8px; background-color: #ffffff;"> <p>前段時間,使用jackson封裝了json字符串轉換爲javabean的方法,代碼以下:</p> <div class="dp-highlighter" id=""><div class="bar"><div class="tools">Java代碼 <embed wmode="transparent" src="/javascripts/syntaxhighlighter/clipboard_new.swf" width="14" height="15" flashvars="clipboard=public%20static%20%3CT%3E%20T%20renderJson2Object(String%20json%2C%20Class%20clazz)%7B%0A%20%20%20%20%20%20%20if(!StringUtil.checkObj(json))%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20null%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20try%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20mapper.configure(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS%2C%20false)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20DateFormat%20myDateFormat%20%3D%20new%20SimpleDateFormat(%22yyyy-MM-dd%20HH%3Amm%3Ass%22)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20mapper.getSerializationConfig().setDateFormat(myDateFormat)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20(T)mapper.readValue(json%2C%20clazz)%3B%0A%09%09%7D%20catch%20(IOException%20e)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20log.error(e)%3B%0A%09%09%09throw%20new%20IllegalArgumentException(e)%3B%0A%09%09%7D%0A%20%20%20%20%7D" quality="high" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> <a href="javascript:void()" title="收藏這段代碼" onclick="code_favorites_do_favorite(this);return false;"><img class="star" src="/images/icon_star.png" alt="收藏代碼"><img class="spinner" src="/images/spinner.gif" style="display:none"></a></div></div><ol start="1" class="dp-j"><li><span><span class="keyword">public</span><span> </span><span class="keyword">static</span><span> <T> T renderJson2Object(String json, Class clazz){ </span></span></li><li><span> <span class="keyword">if</span><span>(!StringUtil.checkObj(json)){ </span></span></li><li><span> <span class="keyword">return</span><span> </span><span class="keyword">null</span><span>; </span></span></li><li><span> } </span></li><li><span> <span class="keyword">try</span><span> { </span></span></li><li><span> mapper.configure(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS, <span class="keyword">false</span><span>); </span></span></li><li><span> DateFormat myDateFormat = <span class="keyword">new</span><span> SimpleDateFormat(</span><span class="string">"yyyy-MM-dd HH:mm:ss"</span><span>); </span></span></li><li><span> mapper.getSerializationConfig().setDateFormat(myDateFormat); </span></li><li><span> <span class="keyword">return</span><span> (T)mapper.readValue(json, clazz); </span></span></li><li><span> } <span class="keyword">catch</span><span> (IOException e) { </span></span></li><li><span> log.error(e); </span></li><li><span> <span class="keyword">throw</span><span> </span><span class="keyword">new</span><span> IllegalArgumentException(e); </span></span></li><li><span> } </span></li><li><span> } </span></li></ol></div><pre class="java" name="code" style="display: none;">public static <T> T renderJson2Object(String json, Class clazz){ if(!StringUtil.checkObj(json)){ return null; } try { mapper.configure(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS, false); DateFormat myDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); mapper.getSerializationConfig().setDateFormat(myDateFormat); return (T)mapper.readValue(json, clazz); } catch (IOException e) { log.error(e); throw new IllegalArgumentException(e); } }</pre> <p> ,這個方法能夠根據json字符串,轉換爲clazz指定的類型的對象,如:</p> <div class="dp-highlighter" id=""><div class="bar"><div class="tools">Java代碼 <embed wmode="transparent" src="/javascripts/syntaxhighlighter/clipboard_new.swf" width="14" height="15" flashvars="clipboard=renderJson2Object(%22%7B%5C%22name%5C%22%3A%5C%22china%5C%22%2C%5C%22age%5C%22%3A%5C%22%3Cspan%20style%3D%22white-space%3A%20normal%3B%22%3E5000%3C%2Fspan%3E%5C%22%7D%22%2CStudent.class)%3B" quality="high" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> <a href="javascript:void()" title="收藏這段代碼" onclick="code_favorites_do_favorite(this);return false;"><img class="star" src="/images/icon_star.png" alt="收藏代碼"><img class="spinner" src="/images/spinner.gif" style="display:none"></a></div></div><ol start="1" class="dp-j"><li><span><span>renderJson2Object(</span><span class="string">"{\"name\":\"china\",\"age\":\"<span style="</span><span>white-space: normal;</span><span class="string">">5000</span>\"}"</span><span>,Student.</span><span class="keyword">class</span><span>); </span></span></li></ol></div><pre class="java" name="code" style="display: none;">renderJson2Object("{\"name\":\"china\",\"age\":\"<span style="white-space: normal;">5000</span>\"}",Student.class);</pre> <p>Student類裏有name,age的get,set方法,代碼以下:</p> <p> </p> <div class="dp-highlighter" id=""><div class="bar"><div class="tools">Java代碼 <embed wmode="transparent" src="/javascripts/syntaxhighlighter/clipboard_new.swf" width="14" height="15" flashvars="clipboard=public%20class%20Student%20implements%20Serializable%7B%0A%20%20%20%20private%20static%20final%20long%20serialVersionUID%20%3D%20685922460589405829L%3B%0A%0A%20%20%20%20private%20String%20name%3B%0A%20%20%20%20private%20String%20age%3B%0A%0A%20%20%20%2F*get%20set%E7%95%A5*%2F%0A%7D" quality="high" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> <a href="javascript:void()" title="收藏這段代碼" onclick="code_favorites_do_favorite(this);return false;"><img class="star" src="/images/icon_star.png" alt="收藏代碼"><img class="spinner" src="/images/spinner.gif" style="display:none"></a></div></div><ol start="1" class="dp-j"><li><span><span class="keyword">public</span><span> </span><span class="keyword">class</span><span> Student </span><span class="keyword">implements</span><span> Serializable{ </span></span></li><li><span> <span class="keyword">private</span><span> </span><span class="keyword">static</span><span> </span><span class="keyword">final</span><span> </span><span class="keyword">long</span><span> serialVersionUID = 685922460589405829L; </span></span></li><li><span> </span></li><li><span> <span class="keyword">private</span><span> String name; </span></span></li><li><span> <span class="keyword">private</span><span> String age; </span></span></li><li><span> </span></li><li><span> <span class="comment">/*get set略*/</span><span> </span></span></li><li><span>} </span></li></ol></div><pre class="java" name="code" style="display: none;">public class Student implements Serializable{ private static final long serialVersionUID = 685922460589405829L;javascript
private String name; private String age;
/get set略/ }</pre>php
<p> </p> <p>根據上面的json字符串能夠正常轉換爲Student對象,</p> <p>可是一般狀況下,從前端傳json字符串到後端,json字符串的值是不可控的或者被框架修改了json字符串,如在裏面添加了其餘的鍵值對,</p> <p>如如今的json字符串爲:"{<span style="background-color: #ff0000;">\"address\":\"hunan\",</span>\"name\":\"<span style="white-space: pre;">china</span>\",\"age\":\"5000\"}",</p> <p>Student類里根本沒有address屬性,這樣的狀況下使用<span style="white-space: pre;">renderJson2Object方法時,會拋</span></p> <div class="dp-highlighter" id=""><div class="bar"><div class="tools">Java代碼 <embed wmode="transparent" src="/javascripts/syntaxhighlighter/clipboard_new.swf" width="14" height="15" flashvars="clipboard=java.lang.IllegalArgumentException%3A%20org.codehaus.jackson.map.exc.UnrecognizedPropertyException%3A%20Unrecognized%20field%20%22address%22%20(Class%20util.Student)%2C%20not%20marked%20as%20ignorable" quality="high" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> <a href="javascript:void()" title="收藏這段代碼" onclick="code_favorites_do_favorite(this);return false;"><img class="star" src="/images/icon_star.png" alt="收藏代碼"><img class="spinner" src="/images/spinner.gif" style="display:none"></a></div></div><ol start="1" class="dp-j"><li><span><span>java.lang.IllegalArgumentException: org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field </span><span class="string">"address"</span><span> (Class util.Student), not marked as ignorable </span></span></li></ol></div><pre class="java" name="code" style="display: none;">java.lang.IllegalArgumentException: org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "address" (Class util.Student), not marked as ignorable</pre> <p> 意思是說Student類裏沒有<span style="white-space: pre;">address這個屬性,因此沒法正常轉化,同時還指明瞭</span><span style="white-space: pre;">not marked as ignorable,即沒有標明可忽略的特性,先看源碼這句話的理解這句話的意思</span></p> <p>類:org.codehaus.jackson.map.deser.BeanDeserializer中的</p> <p> </p> <div class="dp-highlighter" id=""><div class="bar"><div class="tools">Java代碼 <embed wmode="transparent" src="/javascripts/syntaxhighlighter/clipboard_new.swf" width="14" height="15" flashvars="clipboard=%40Override%0A%20%20%20%20protected%20void%20handleUnknownProperty(JsonParser%20jp%2C%20DeserializationContext%20ctxt%2C%20Object%20beanOrClass%2C%20String%20propName)%0A%20%20%20%20%20%20%20%20throws%20IOException%2C%20JsonProcessingException%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20...%20...%20...%0A%20%20%20%20%20%20%20%20%3Cspan%20style%3D%22color%3A%20%23ff0000%3B%22%3E%2F%2F%20If%20registered%20as%20ignorable%2C%20skip%3C%2Fspan%3E%0A%20%20%20%20%20%20%20%20%3Cspan%20style%3D%22color%3A%20%23ff0000%3B%22%3Eif%20(_ignoreAllUnknown%20%7C%7C%0A%20%20%20%20%20%20%20%20%20%20%20%20(_ignorableProps%20!%3D%20null%20%26%26%20_ignorableProps.contains(propName)))%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20jp.skipChildren()%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20return%3B%0A%20%20%20%20%20%20%20%20%7D%3C%2Fspan%3E%0A%20%20%20%20%20%20%20%20%20...%20...%20...%0A%20%20%20%20%7D" quality="high" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> <a href="javascript:void()" title="收藏這段代碼" onclick="code_favorites_do_favorite(this);return false;"><img class="star" src="/images/icon_star.png" alt="收藏代碼"><img class="spinner" src="/images/spinner.gif" style="display:none"></a></div></div><ol start="1" class="dp-j"><li><span><span class="annotation">@Override</span><span> </span></span></li><li><span> <span class="keyword">protected</span><span> </span><span class="keyword">void</span><span> handleUnknownProperty(JsonParser jp, DeserializationContext ctxt, Object beanOrClass, String propName) </span></span></li><li><span> <span class="keyword">throws</span><span> IOException, JsonProcessingException </span></span></li><li><span> { </span></li><li><span> ... ... ... </span></li><li><span> <span style=<span class="string">"color: #ff0000;"</span><span>></span><span class="comment">// If registered as ignorable, skip</span></span><span> </span></span></li><li><span> <span style=<span class="string">"color: #ff0000;"</span><span>></span><span class="keyword">if</span><span> (_ignoreAllUnknown || </span></span></li><li><span> (_ignorableProps != <span class="keyword">null</span><span> && _ignorableProps.contains(propName))) { </span></span></li><li><span> jp.skipChildren(); </span></li><li><span> <span class="keyword">return</span><span>; </span></span></li><li><span> }</span> </span></li><li><span> ... ... ... </span></li><li><span> } </span></li></ol></div><pre class="java" name="code" style="display: none;">@Override protected void handleUnknownProperty(JsonParser jp, DeserializationContext ctxt, Object beanOrClass, String propName) throws IOException, JsonProcessingException { ... ... ... <span style="color: #ff0000;">// If registered as ignorable, skip</span> <span style="color: #ff0000;">if (_ignoreAllUnknown || (_ignorableProps != null && _ignorableProps.contains(propName))) { jp.skipChildren(); return; }</span> ... ... ... }</pre> <p> 源碼註釋說,若是註冊了忽略特性,則會跳過此步驟,那到底須要怎麼忽略呢?</p> <p>請再看類:org.codehaus.jackson.map.deser.BeanDeserializerFactory中的</p> <p> </p> <div class="dp-highlighter" id=""><div class="bar"><div class="tools">Java代碼 <embed wmode="transparent" src="/javascripts/syntaxhighlighter/clipboard_new.swf" width="14" height="15" flashvars="clipboard=protected%20void%20addBeanProps(DeserializationConfig%20config%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20BasicBeanDescription%20beanDesc%2C%20BeanDeserializerBuilder%20builder)%0A%20%20%20%20%20%20%20%20throws%20JsonMappingException%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20...%20....%20...%0A%20%20%20%20%20%20%20%20%2F%2F%20Things%20specified%20as%20%22ok%20to%20ignore%22%3F%20%5BJACKSON-77%5D%0A%20%20%20%20%20%20%20%20AnnotationIntrospector%20intr%20%3D%20config.getAnnotationIntrospector()%3B%0A%20%20%20%20%20%20%20%20boolean%20ignoreAny%20%3D%20false%3B%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Boolean%20B%20%3D%20intr.findIgnoreUnknownProperties(beanDesc.getClassInfo())%3B%20%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20(B%20!%3D%20null)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ignoreAny%20%3D%20B.booleanValue()%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20builder.setIgnoreUnknownProperties(ignoreAny)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20...%20...%20...%0A%7D" quality="high" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> <a href="javascript:void()" title="收藏這段代碼" onclick="code_favorites_do_favorite(this);return false;"><img class="star" src="/images/icon_star.png" alt="收藏代碼"><img class="spinner" src="/images/spinner.gif" style="display:none"></a></div></div><ol start="1" class="dp-j"><li><span><span class="keyword">protected</span><span> </span><span class="keyword">void</span><span> addBeanProps(DeserializationConfig config, </span></span></li><li><span> BasicBeanDescription beanDesc, BeanDeserializerBuilder builder) </span></li><li><span> <span class="keyword">throws</span><span> JsonMappingException </span></span></li><li><span> { </span></li><li><span> ... .... ... </span></li><li><span> <span class="comment">// Things specified as "ok to ignore"? [JACKSON-77]</span><span> </span></span></li><li><span> AnnotationIntrospector intr = config.getAnnotationIntrospector(); </span></li><li><span> <span class="keyword">boolean</span><span> ignoreAny = </span><span class="keyword">false</span><span>; </span></span></li><li><span> { </span></li><li><span> Boolean B = intr.findIgnoreUnknownProperties(beanDesc.getClassInfo()); </span></li><li><span> <span class="keyword">if</span><span> (B != </span><span class="keyword">null</span><span>) { </span></span></li><li><span> ignoreAny = B.booleanValue(); </span></li><li><span> builder.setIgnoreUnknownProperties(ignoreAny); </span></li><li><span> } </span></li><li><span> } </span></li><li><span> ... ... ... </span></li><li><span>} </span></li></ol></div><pre class="java" name="code" style="display: none;">protected void addBeanProps(DeserializationConfig config, BasicBeanDescription beanDesc, BeanDeserializerBuilder builder) throws JsonMappingException { ... .... ... // Things specified as "ok to ignore"? [JACKSON-77] AnnotationIntrospector intr = config.getAnnotationIntrospector(); boolean ignoreAny = false; { Boolean B = intr.findIgnoreUnknownProperties(beanDesc.getClassInfo()); if (B != null) { ignoreAny = B.booleanValue(); builder.setIgnoreUnknownProperties(ignoreAny); } } ... ... ... }</pre> <p> </p> <p> <span style="white-space: pre;">intr.findIgnoreUnknownProperties(beanDesc.getClassInfo()); </span></p> <p><span style="white-space: pre;"><span style="color: #ff0000;">會查找目標對象中,是否使用了JsonIgnoreProperties 註解,其中把註解的value值賦給了</span></span><span style="white-space: pre;">builder.setIgnoreUnknownProperties(ignoreAny);</span></p> <p>到此Student類的正確作法爲:</p> <p> </p> <div class="dp-highlighter" id=""><div class="bar"><div class="tools">Java代碼 <embed wmode="transparent" src="/javascripts/syntaxhighlighter/clipboard_new.swf" width="14" height="15" flashvars="clipboard=%3Cspan%20style%3D%22color%3A%20%23ff0000%3B%22%3E%40JsonIgnoreProperties(ignoreUnknown%20%3D%20true)%20%3C%2Fspan%3E%0Apublic%20class%20Student%20implements%20Serializable%7B%0A%20%20%20%20private%20static%20final%20long%20serialVersionUID%20%3D%20685922460589405829L%3B%0A%0A%20%20%20%20private%20String%20name%3B%0A%20%20%20%20private%20String%20age%3B%0A%0A%20%20%20%2F*get%20set.....*%2F%0A%EF%BD%9D" quality="high" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> <a href="javascript:void()" title="收藏這段代碼" onclick="code_favorites_do_favorite(this);return false;"><img class="star" src="/images/icon_star.png" alt="收藏代碼"><img class="spinner" src="/images/spinner.gif" style="display:none"></a></div></div><ol start="1" class="dp-j"><li><span><span><span style=</span><span class="string">"color: #ff0000;"</span><span>></span><span class="annotation">@JsonIgnoreProperties</span><span>(ignoreUnknown = </span><span class="keyword">true</span><span>) </span> </span></span></li><li><span><span class="keyword">public</span><span> </span><span class="keyword">class</span><span> Student </span><span class="keyword">implements</span><span> Serializable{ </span></span></li><li><span> <span class="keyword">private</span><span> </span><span class="keyword">static</span><span> </span><span class="keyword">final</span><span> </span><span class="keyword">long</span><span> serialVersionUID = 685922460589405829L; </span></span></li><li><span> </span></li><li><span> <span class="keyword">private</span><span> String name; </span></span></li><li><span> <span class="keyword">private</span><span> String age; </span></span></li><li><span> </span></li><li><span> <span class="comment">/*get set.....*/</span><span> </span></span></li><li><span>} </span></li></ol></div><pre class="java" name="code" style="display: none;"><span style="color: #ff0000;">@JsonIgnoreProperties(ignoreUnknown = true) </span> public class Student implements Serializable{ private static final long serialVersionUID = 685922460589405829L;css
private String name; private String age;
/get set...../ }</pre> 看紅色註解,如今暫時找到在類中添加註解(感受具體的pojo對象和jackson耦合),不知道有沒有其餘方法,設全局變量來控制,若是有朋友知道,請告訴我謝謝。。。前端
<p> </p> <p> </p> <p>謝謝 <a target="_blank" style="background-color: #effaff; font-family: Verdana, Arial, Helvetica, sans-serif; color: #108ac6; line-height: 18px; text-align: left;" href="http://up2pu.iteye.com/">up2pu</a><span style="background-color: #effaff; font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 18px; text-align: left;"> 兄弟的幫助,使用</span><span style="line-height: 18px; text-align: left; font-family: Verdana, Arial, Helvetica, sans-serif;">mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false),</span></p> <p><span style="color: #ff0000; font-family: Verdana, Arial, Helvetica, sans-serif;">則無需在目標類中添加JsonIgnoreProperties註解</span></p> </div> <p> </p>java
<div> <!-- 廣告位:PC端-iteye博客詳情頁底部banner2-728*90 --> <script> (function() { var s = "_" + Math.random().toString(36).slice(2); document.write('<div id="' + s + '"></div>'); (window.slotbydup=window.slotbydup || []).push({ id: '4774193', container: s, size: '728,90', display: 'inlay-fix' }); })(); jQuery(function(){ window.csdn.recommendSide({ contentBox: "recommend", postBox: jQuery(".news-right-side"), query:'jackson 的UnrecognizedPropertyException錯誤', popu:'725' }) }); </script><div id="_7gng1qfoi9j"></div><script charset="utf-8" src="https://pos.baidu.com/sctm?psi=17b2271768ad8e572de189b1ca12f21b&di=4774193&dri=0&dis=0&dai=0&ps=2711x580&enu=encoding&dcb=___adblockplus&dtm=SSP_JSONP&dvi=0.0&dci=-1&dpt=none&tsr=0&tpr=1559033834734&ti=jackson%20%E7%9A%84UnrecognizedPropertyException%E9%94%99%E8%AF%AF%20-%20olivechinese%20-%20IT&ari=2&dbv=2&drs=1&pcs=1903x947&pss=1903x2759&cfv=0&cpl=3&chi=1&cce=true&cec=UTF-8&tlm=1559033834&prot=2&rw=947&ltu=https%3A%2F%2Folivechinese.iteye.com%2Fblog%2F1131059&ltr=https%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DS5DBbjZqbXjj1EDOtw9NQxH4_h8WFG_rObT2Wa0AssFZikeDvAs83zKAjPDC4YRyWWaNXFxIgt4gjFRt3Bi57a%26wd%3D%26eqid%3De41ee3ec00307f80000000035cecf6b4&lcr=https%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DS5DBbjZqbXjj1EDOtw9NQxH4_h8WFG_rObT2Wa0AssFZikeDvAs83zKAjPDC4YRyWWaNXFxIgt4gjFRt3Bi57a%26wd%3D%26eqid%3De41ee3ec00307f80000000035cecf6b4&ecd=1&uc=1920x1050&pis=-1x-1&sr=1920x1080&tcn=1559033835&exps=110011"></script><a href="http://www.baidu.com/cb.php?c=IgF_pyfqnHmkPjbvrHT0IZ0qnfK9ujYzrH6YrjmY0Aw-5Hnsn16YnjT0TAq15HfLP1fkrHn0T1dhmyR1nyfYPHPWPvwhnHR30AwY5HDdPHbsn1n3n1R0IgF_5y9YIZK1rBtEuywdQhP1uA38UhNYQLwETA-WQvG9IhDk5LNYUNq1ULNzmvRqmhkEuv-Yug--0ZFb5HD0mhYqnfKsTWYs0ZNGujYkPHTYn1mk0AqGujYknWb3rjDY0APGujYLn1bdn1n0ULI85H00TZbqnW0v0APzm1YYnj01rf" target="_blank" style="text-decoration:none;"> <div style="font-size:17px;color:#f13d3d;font-family: SF Pro Display,Roboto,Noto,Arial,PingFang SC,Hiragino Sans GB,Microsoft YaHei,sans-serif;width:728px;height:25px;font-weight:bold;">資深Java項目團隊歷時1年打造,實戰精髓大揭祕!</div> <div style="font-size:13px;color:#666;font-family: SF Pro Display,Roboto,Noto,Arial,PingFang SC,Hiragino Sans GB,Microsoft YaHei,sans-serif;height:35px;margin-top:10px;">Java系統學習全案:五大階段學習系統規劃、8大企業級項目貫穿全程。限時2折秒殺。立省4688元!</div>json
</a> </div>後端
</div>app
<div class="blog_comment"> <h5>發表評論</h5> <form action="/blog/1131059" id="comment_form" method="post" onsubmit="return false;"><div style="margin:0;padding:0;display:inline"><input name="authenticity_token" type="hidden" value="5U/ymtJOL+iJ3sxZv5yTDpDB4MOefG1N5vG+gntGvVo="></div> 框架
<input type="hidden" id="editor_bbcode_flag" value="true">dom
</div>
<script type="text/javascript"> var editor = new Control.TextArea.Editor("editor_body", "bbcode", false); </script>
<p style="text-align:right;margin-right:30px;">(快捷鍵 Alt+S / Ctrl+Enter) <input class="submit" id="quick_reply_button" name="commit" type="submit" value="提交"></p> </form> <script type="text/javascript"> new HotKey("s",function() {$('quick_reply_button').click();},{altKey: true, ctrlKey: false}); new HotKey(new Number(13),function() {$('quick_reply_button').click();},{altKey: false, ctrlKey: true}); new Validation("comment_form", {immediate: false, onFormValidate: function(result, form){ if(result) { new Ajax.Request('/blog/create_comment/1131059', { onFailure:function(response){ $('comments').insert({after:response.responseText}) form.spinner.hide(); Element.scrollTo($('comments')); }, onSuccess:function(response){ Element.scrollTo($('comments')); var new_comment = new Element('div', {}).update(response.responseText).firstChild; var comment_id = new_comment.readAttribute('id'); $('comments').insert({after:response.responseText}); $('editor_body').value = ""; var css_rules = '#' + comment_id + ' pre'; highlightNewAddContent(css_rules); processComment(); code_favorites_init(css_rules); form.spinner.hide(); }, parameters:Form.serialize(form) }); } }}); </script> </div>
</div>