File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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
JavaRanch » Java Forums » Java » Applets
Bookmark "Getting parameters from the htmp page" Watch "Getting parameters from the htmp page" New topic
Author

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">
</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
Marshal

Joined: Mar 22, 2005
Posts: 42950
    
  72
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 agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting parameters from the htmp page