Resolution of invalid jquery event binding in wicket

Source: Internet
Author: User

This is the second encounter with Wicket. Although the time of the previous project was very short, I still like this lightweight java system framework. BusinessCodeCompletely separated from the front-end. This is why I appreciate him. Simplifying complicated things has always been the way I want to do things. So wicket and I can say they are quite different .... O (∩) O Haha ~

Jquery is an excellent JS toolkit.ProgramPersonnel have completed a lot of repetitive work, which is complicated and commonly used to systematize and function. The combination of wicket and jquery is a perfect combination!

Get down to the truth ~~~~

The combination of wicket and jquery is a good thing, but it seems that the two are not well adjusted. This may be the implementation mechanism, which may be incorrect. we should say that we do not have a deep understanding of the technology, when you first contact, you will find that the control events bound with jquery will become invalid.

The reason I finally found out is that I didn't follow the encoding principles of the wicket framework. wicket has punished programmers like me. If you don't keep it, I will ignore you... (⊙ o ⊙ )...

Wicket: If you want to use jquery, you must notify it. You can use wicket to register binding events, so that you can use jquery and JavaScript code without any worries...

HTML code

 1       <  Form  Wicket: ID  = "Frm" ID  = "Frm"   >  2           <  Div  Wicket: ID  = "Divmsg"  ID  = "Divmsg"  > </  Div  >  3   4           <  Label Wicket: ID  = "Pagetitle"  ID  = "Pagetitle"  > Null </  Label  > <  BR  /> <  BR  /> <  BR  />  5           <  Select Wicket: ID  = "Zlist"  ID  = "Zlist"  Style  = "Width: 200px"  > </  Select  > <  BR  />  6 Input <  BR  /> <  Input Type  = "Text"  Wicket: ID  = "Inputtxt"  ID  = "Inputtxt"  Style  = "Width: 200px"  /> <  BR  />  7           <  Input  Type  = "Checkbox"  Wicket: ID = "Chk001"  ID  = "Chk001"   /> Checkbox <  BR  />  8           <  Input  Type  = "Button"  Wicket: ID  = "But001"  Value  = "Clear"  ID = "But001"   />  9           <  Input  Type  = "Button"  Wicket: ID  = "But002"  Value  = "Jquery"  ID  = "But002"   />  10           <  Input Type  = "Button"  Wicket: ID  = "But003"  Value  = "MSG"  ID  = "But003"   />  11           <  BR  />  12   13   14       </ Form  > 

JS

 
FunctionMyclear (){//$ ("# Inputtxt"). ATTR ("value ","");$ ("# Inputtxt"). Val (""); $ ("# Inputtxt" ).css ({color: '# ff0011', Background: 'white'}); $ ("# Divmsg" pai.html (""); $ ("# Chk001"). ATTR ("checked ",False);}

 

Java code

 1 But001.add ( New Ajaxformcomponentupdatingbehavior ("onclick"){  2 Private Static final Long Serialversionuid = 1l;  3   4   @ Override  5 Protected Void  Onupdate (ajaxrequesttarget target ){  6   7           Target. appendjavascript ("myclear ();");  8  }  9   });  10 _ Frm. Add (but001 );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.