This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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

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: 42958
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.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Getting parameters from the htmp page
It's not a secret anymore!