• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting parameters from the htmp page

 
Sameera Abeysinghe
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my html page
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
<APPLET codebase="file:C:/Documents and Settings/ok4/Desktop/Test/" code="Slideold11.class" width=250 height=300>
<param name="Color" value="blue">
</APPLET>
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

This is my java code
//////////////////////////////////////////////////////////////////////////////////////////////////////
System.out.println("done ");
String paths=new java.applet.Applet().getParameter("Color");//
System.out.println("paths");
//////////////////////////////////////////////////////////////////////////////////////////////////////

This is my error
/////////////////////////////////////////////////////////////////////////////////////////////////////
done
Exception in thread "AWT-EventQueue-2" java.lang.NullPointerException
at java.applet.Applet.getParameter(Unknown Source)
at Slideold11.getImage(Slideold11.java:59)
at Slideold11.paint(Slideold11.java:43)
at sun.awt.RepaintArea.paintComponent(Unknown Source)
at sun.awt.RepaintArea.paint(Unknown Source)
at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
////////////////////////////////////////////////////////////////////////////////////////////////////

Any one that can tell me what�s my problem and a the answer for this
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming that the Java code is part of the applet, you need to write

String paths = getParameter("Color");

The Applet object is created for you by the browser; it's wrong to create one yourself.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic