[英]What is the use of the Applet param tag?
Forgive me if this question is stupid, however what is the point of the param tag? 如果这个问题很愚蠢,请原谅我,但是param标签的意义是什么? I have watched videos and read tutorials and pretty much understand what it does, but don't understand the why?
我看过视频并阅读了教程,几乎了解了它的功能,但不明白为什么? It seems the user can't use this param tag to input data, but the programmer sets the values (from what I've seen).
似乎用户无法使用此param标签输入数据,但是程序员设置了值(根据我所见)。 So why is it used when we can simply do all that in the .java file?
那么当我们可以简单地在.java文件中完成所有操作时,为什么要使用它呢? A practical example would be appreciated, thanks!
一个实际的例子将不胜感激,谢谢!
You don't have to recompile anything if the param changes. 如果参数更改,则无需重新编译任何内容。 You can just edit html with text editor and voilà!
您可以只使用文本编辑器和voilà编辑html! Also reusability of code with different params on different pages.
在不同页面上具有不同参数的代码也可重用。
Basically it's the same question as "why do we need *.properties file when you can hardcode all the properties as public static String
fields in some class?". 基本上,这与“为什么可以在某个类中将所有属性硬编码为
public static String
字段时为什么需要* .properties文件?”相同。
A simple example might be a general-purpose menu applet. 一个简单的示例可能是通用菜单小程序。 You don't want to have the menu existing in code, because you might want to change it or have different menus on different web pages.
您不想在代码中存在菜单,因为您可能想要更改它或在不同的网页上拥有不同的菜单。 The menu to display can easily be defined in
param
tags. 可以在
param
标签中轻松定义要显示的菜单。
You can have a component that displays advertisements/captchas/whatever and requires a public key. 您可以具有一个显示广告/验证码/任何内容的组件,并且需要公共密钥。 The same component (without recompiling) can be embedded on several sites.
相同的组件(无需重新编译)可以嵌入到多个站点中。 The public key is passes as a parameter.
公钥作为参数传递。
The applets' look-and-feel (background colour, font sizes, etc.) can be customized to better match overall web-page layout. 可以自定义applet的外观(背景颜色,字体大小等),以更好地匹配整体网页布局。
Marvelous flying unicorn animation can have customizable speed and unicorn colour. 奇妙的飞行独角兽动画可以具有可自定义的速度和独角兽颜色。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.