• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What does this code do?

 
Stanley Tan
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public String getParameter(String key, String def) {
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
}
I get this code when I create a new applet in JBuilder. I am just wondering what it does. Could someone please shed some light? Thanks.
[This message has been edited by Stanley Tan (edited May 18, 2001).]
 
Angela Lamb
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The getParameter method returns values that are passed in to the applet through HTML tags. JBuilder is overriding this method. If the isStandalone variable is true (probably used during testing, when you run the applet from inside JBuilder), it gets the parameter from System properties. Otherwise, it calls the normal getParameter method and returns that value, or the default(def) value you passed in if getParameter returns null.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic