You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Pedro Del Gallego <pe...@gmail.com> on 2006/08/31 15:52:22 UTC

How to display a warning message.

hi,

I try to display a message in a jsp page. Is correct to use a
JOptionPane? There are other options to show a message from the Action
class ?

1 The user fill a form.
2 an action look in the database
3 if i have a empty result i show a warning message.

/* check the list */

final ModelForm form = (ModelForm) ctx.form();
if (form.getModelNameList().isEmpty())
{
	form.showMessage("please select another brand");
	form.setErrorMsg ("pleases select another brand");			
	clearModel_onClick(ctx);
	return false;
}

/*   in form class  */
public void showMessage (
		String message)
	{
		JOptionPane messageBox = new JOptionPane ();
		JOptionPane.showMessageDialog (messageBox, message, "Warning",
JOptionPane.WARNING_MESSAGE);
		messageBox.setVisible (true);
	}

The problem if I use a JOptionPane the first time i used it will be
under the browser.

Thanks.

PS: If this is not the correct mail list please let me know.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: How to display a warning message.

Posted by fausto mancini <ma...@tiscali.it>.
I think you can use a javascript 'alert' funcion.
Anyway, in my humble opinion, I think it's better to read the j2ee 
tutorial first on java.sun.com ...

HTH

On Thu, 31 Aug 2006, Pedro Del Gallego wrote:

>> j2se is not j2ee... look at java.sun.com for more information...
>
> I know, i´m really newbie in server side, I dont know how to display a
> popup dialog from an Action. probably is not a good idea ?
>
> Maybe this is not the correct mailing list for this newbie question.
> Someone can tell me a good newbie mailing list?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: How to display a warning message.

Posted by Pedro Del Gallego <pe...@gmail.com>.
> j2se is not j2ee... look at java.sun.com for more information...

I know, i´m really newbie in server side, I dont know how to display a
popup dialog from an Action. probably is not a good idea ?

Maybe this is not the correct mailing list for this newbie question.
Someone can tell me a good newbie mailing list?

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: How to display a warning message.

Posted by fausto mancini <ma...@tiscali.it>.
(!!!!!!!!)
j2se is not j2ee... look at java.sun.com for more information...

On Thu, 31 Aug 2006, Pedro Del Gallego wrote:

> hi,
>
> I try to display a message in a jsp page. Is correct to use a
> JOptionPane? There are other options to show a message from the Action
> class ?
>
> 1 The user fill a form.
> 2 an action look in the database
> 3 if i have a empty result i show a warning message.
>
> /* check the list */
>
> final ModelForm form = (ModelForm) ctx.form();
> if (form.getModelNameList().isEmpty())
> {
> 	form.showMessage("please select another brand");
> 	form.setErrorMsg ("pleases select another brand"); 
> clearModel_onClick(ctx);
> 	return false;
> }
>
> /*   in form class  */
> public void showMessage (
> 		String message)
> 	{
> 		JOptionPane messageBox = new JOptionPane ();
> 		JOptionPane.showMessageDialog (messageBox, message, 
> "Warning",
> JOptionPane.WARNING_MESSAGE);
> 		messageBox.setVisible (true);
> 	}
>
> The problem if I use a JOptionPane the first time i used it will be
> under the browser.
>
> Thanks.
>
> PS: If this is not the correct mail list please let me know.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org