Forums Register Login

Message box

+Pie Number of slices to send: Send
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

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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
All of life is a contant education - Eleanor Roosevelt. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1599 times.
Similar Threads
removing records where a field is null
Drop-Down List? or Combo Box?
Selected Row in primefaces
Servlets 4a (different question)
Message box in my JSP.
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 05:08:01.