Doubts regarding applet 'param' and an Archive pointing to a jar

Asked

Viewed 53 times

-1

I can’t understand what this applet stops at, does anyone explain to me? And why does the applet have that Rchive that points to a jar? Why do they stop?

<applet code="TesteApplet.class" archive="agora.jar" width=160 height=120>
    <param name="campo" value="senha">
    <param name="formulario" value="formulario">
</applet>

2 answers

1


The attribute archive is an optional describing one or more files that contain classes and other features that will be "preloaded".


Already the parameters specify the values that the applet accurate for initialization and for its correct display in the application. The HTML file lists parameters for the applet in the tags .

Is passed this way:

<param name=[nome] value=[valor]>

where [nome] specifies the name of the parameter as expected by applet, and [valor] represents the information to be passed.

To recover the value of a parameter, you have to call the method getParameter(), passing the value of name as of the parameter.

References:

https://docs.oracle.com/javase/8/docs/technotes/guides/jweb/applet/using_tags.html#applet

http://www.dm.ufscar.br/profs/waldeck/curso/java/part33.html

0

The param properties can be recovered in Applet code, as follows:

 String paramCampo = getParameter("campo");

Using your example HTML code, the variable value paramCampo in which case it would be "password".

As for the attribute archive of the applet tag, it points to the Java program that was encapsulated in the container .Jar or contains the applet.

  • Why do I need to point to a jar? That jar is my applet?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.