My applet is supposed to take external parameters from html file which might be dynamically generated.
<param name="type1" value="value1">
<param name="type2" value="value2">
Those parameters has to be checked for validity in Applet.init()
String type1 = getParameter("type1");
String type2 = getParameter("type2");
if (type1 == null || type2 == null) ....
And they are wrong what should I do? Is it okay to call Applet.destroy() manually?
As I know stop and destroy are supposed to be called by browser, not applet itself.
Applet.destroy()should only be called by the JVM.The best strategy here is to redirect to a page that shows the parameters and what is wrong with them. To do that, use something like:
This will have the effect that:
badparam.htmlwhich shows the params and describes the problem. Then..Applet.destroy()method will be called. (The ‘right time’ is typically 30-60 seconds later by my reckoning.)