Hi, I made a form and i need to have a message box that inform the user if one or more field are empty. I tried with the following: <%<br /> if (".....one field is null.....")<br /> {<br /> this.showMessageDialog(null,"You need to enter a value...");<br /> }<br /> else<br /> { <br /> %> <%@ include file="Response.jsp" %> <%<br /> }<br /> %> But it does'nt work. Do i have to insert the showMessageDialog inside my bean with the parent.showMesageDialog()? I know that i can do it with javascript but i prefer java. Is it possible?? Thank you very much Jeff
hi jeff this is manjerekar. u haven't specified anything clear. but still i consider ur class extends JFrame. to display a message box , u can go for a JOptionPane class where we have methods to display different dialog boxes. here's the code for opening a file ================================== when there is a file opening error this dialog box is displayed. catch(Exception e) { JOptionPane.showMessageDialog(frame,new String[] { "Unable to open file",fileName.toString() },"File Open Error",JOptionPane.INFORMATION_MESSAGE); } frame------object of JFrame. fileName-----selected file. u can manipulate the same for a displaying a dialog box , when the user as not filled in the boxes. hope this will help u out.
Hi Jeff, Your code is not visible, but generally you do not have to insert anything. The showMessageDialog is a statc method of the JOptionPane class, and can be directly called by using the class name or an instance of the JOptionPane class. Usage: JOptionPane.showMessageDialof, parent, "Message", "Title", JOptionPane.ERROR_MESSAGE); -------- Regards, Amit
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.