aspose file tools*
The moose likes Applets and the fly likes Getting parameters from the htmp page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Getting parameters from the htmp page" Watch "Getting parameters from the htmp page" New topic

Getting parameters from the htmp page

Sameera Abeysinghe
Ranch Hand

Joined: Nov 15, 2004
Posts: 104
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">

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

This is my error
Exception in thread "AWT-EventQueue-2" java.lang.NullPointerException
at java.applet.Applet.getParameter(Unknown Source)
at Slideold11.getImage(
at Slideold11.paint(
at sun.awt.RepaintArea.paintComponent(Unknown Source)
at sun.awt.RepaintArea.paint(Unknown Source)
at 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 Source)

Any one that can tell me what�s my problem and a the answer for this
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 39578
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.

Ping & DNS - updated with new look and Ping home screen widget
I agree. Here's the link:
subject: Getting parameters from the htmp page
Similar Threads
Applet not getting initialized
applet security error online
Exception while loading applet
file reading in applet
WAMP/Java/MysqlConnector Issue