|
|
JAVA, JSP, SERVLETS, TOMCAT, SERVLETS MANAGER,
Private JVM (Java Virtual Machine),
Private Tomcat Server
Alden Hosting offers private JVM (Java Virtual Machine), Java Server Pages (JSP), Servlets, and Servlets Manager with our Web Hosting Plans
WEB 4 PLAN and
WEB 5 PLAN ,
WEB 6 PLAN .
At Alden Hosting we eat and breathe Java! We are the industry leader in providing
affordable, quality and efficient Java web hosting in the shared hosting marketplace.
All our sites run on our Java hosing platform configured for
optimum performance using Java 1.6, Tomcat 6, MySQL 5, Apache 2.2 and web
application frameworks such as Struts, Hibernate, Cocoon, Ant, etc.
We offer only one type of Java hosting - Private Tomcat. Hosting accounts on the Private
Tomcat environment get their very own Tomcat server. You can start and re-start
your entire Tomcat server yourself.
Deciding Which Parameters to Support (The Java™ Tutorials >
Deployment > Applets)
Deciding Which Parameters to Support
Home Page
>
Deployment
>
Applets
Deciding Which Parameters to Support
This page guides you through the four questions you should ask as you implement parameters:
It ends with a discussion of the parameters defined in a sample
<APPLET> tag.
What Should the Applet Let the User Configure?
The parameters your applet should support depend
on what your applet does
and on how flexible you want it to be.
Applets that display images
might have parameters to specify the image locations.
Similarly, applets that play sounds
might have parameters to specify the sounds.
Besides parameters that specify resource locations
(such as image and sound files),
applets sometimes provide parameters for specifying
details of the applet's appearance or operation.
For example, an animation applet
might let the user specify the number of images shown per second.
Or an applet might let the user
change the strings the applet displays.
Anything is possible.
What Should the Parameters Be Named?
Once you decide what parameters your applet will support,
you need to figure out their names.
Here are some typical parameter names:
- SOURCE or SRC
- For a data file such as an image file.
- XXXSOURCE (for example, IMAGESOURCE)
- Used in applets that let the user specify
more than one type of data file.
- XXXS
- For a parameter that takes a list of XXXs
(where XXX might be
IMAGE, again).
- NAME
- Used only for an applet's name.
Applet names are used for interapplet communication,
as described in
Sending Messages to Other Applets.
Clarity of names is more important
than keeping the name length short.
Do not use names of <APPLET>
tag attributes, which are documented in
Using the applet Tag.
Note:
Although this tutorial usually refers to parameter names using ALL UPPERCASE,
parameter names are case-insensitive.
For example, IMAGESOURCE and imageSource
both refer to the same parameter.
Parameter values, on the other hand,
are case-sensitive unless you take steps to
interpret them otherwise,
such as by using the String toLowerCase method
before interpreting the parameter's value.
What Kind of Value Should Each Parameter Take?
Parameter values are all strings.
Whether or not the user puts quotation marks around a parameter value,
that value is passed to your applet as a string.
However, your applet can interpret the string in many ways.
Applets typically interpret a parameter value as one of the following types:
- A URL
- An integer
- A floating-point number
- A boolean value -- typically "true"/"false" or "yes"/"no"
- A string -- for example, the string to use as a window title
- A list of any of the above
What Should the Default Value of Each Parameter Be?
Applets should attempt to provide useful default values
for each parameter,
so that the applet will execute
even if the user doesn't specify a parameter
or specifies it incorrectly.
For example,
an animation applet should provide a reasonable setting
for the number of images it displays per second.
This way, if the user doesn't specify the relevant parameter,
the applet will still work well.
An Example: A Sample <APPLET> Tag
Here's what a typical <APPLET> tag looks like.
<APPLET CODE=SampleApplet.class CODEBASE=example
WIDTH=350 HEIGHT=60>
<PARAM NAME=windowClass VALUE=BorderWindow>
<PARAM NAME=windowTitle VALUE="BorderLayout">
<PARAM NAME=buttonText
VALUE="Click here to see a BorderLayout in action">
</APPLET>
When the user doesn't specify a value for a parameter,
the applet uses a reasonable default value. For example,
if the user doesn't specify the window's title,
the applet uses the window's type as the title.
The next page shows you how to get parameter values from the user.
JAVA, JSP, SERVLETS, TOMCAT, SERVLETS MANAGER,
Private JVM (Java Virtual Machine),
Private Tomcat Server
Alden Hosting offers private JVM (Java Virtual Machine), Java Server Pages (JSP), Servlets, and Servlets Manager with our Web Hosting Plans
WEB 4 PLAN and
WEB 5 PLAN ,
WEB 6 PLAN .
At Alden Hosting we eat and breathe Java! We are the industry leader in providing
affordable, quality and efficient Java web hosting in the shared hosting marketplace.
All our sites run on our Java hosing platform configured for
optimum performance using Java 1.6, Tomcat 6, MySQL 5, Apache 2.2 and web
application frameworks such as Struts, Hibernate, Cocoon, Ant, etc.
We offer only one type of Java hosting - Private Tomcat. Hosting accounts on the Private
Tomcat environment get their very own Tomcat server. You can start and re-start
your entire Tomcat server yourself.
|