java - How to handle null pointer exception in wicket form submit -


i have 2 textboxes , 1 submit button in program.when provide inputs , hit submit button works fine. when not entering in textboxes , hit submit button , not working. throwed null pointer exception when form submit.

error below.

wicketmessage: method onformsubmitted of interface org.apache.wicket.markup.html.form.iformsubmitlistener targeted @ component [markupcontainer [component id = form1]] threw exception      root cause:      java.lang.nullpointerexception     @ com.usaa.application.pages.homepage$3.onsubmit(homepage.java:158)     @ org.apache.wicket.markup.html.form.form.delegatesubmit(form.java:1518)     @ org.apache.wicket.markup.html.form.form.process(form.java:914)     @ org.apache.wicket.markup.html.form.form.onformsubmitted(form.java:876) 

how handle error , please me ...

thanks, kumar

do this:

textfield<string> tf1 = new textfield<string>("tf1"); tf1.setconvertemptyinputstringtonull(false); form.add(tf1); 

the value textfield empty string


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -