简体   繁体   English

帮助了解javascript窗口弹出功能

[英]Help in understanding javascript window popup function

<div class=portlet-form-field-label><spring:message code="label.someMessage"/>&nbsp;<a href='javascript:popup("<fmt:message key='someUrl' />");'><fmt:message key='someLabel' /></a>.</div>

In the above code snippet, what is the javascript:popup function doing? 在上述代码段中,javascript:popup函数在做什么? The standard function is window.open(url). 标准函数是window.open(url)。 Is 'javascript:popup' a standard function? 'javascript:popup'是标准功能吗?
The other question is that someUrl is resolving to a location of an html file but the actual location of the html file is different. 另一个问题是someUrl正在解析到html文件的位置,但是html文件的实际位置不同。 And I cannot find any mapping 我找不到任何映射

1) no, this should be a custom (not standard) popup() function. 1)不,这应该是自定义(非标准)的popup()函数。

2) Your code uses someUrl to extract a value with fmt:message and then paste it into the popup. 2)您的代码使用someUrl通过fmt:message提取值,然后将其粘贴到弹出窗口中。

Following is an illustration on how fmt:message works: 以下是fmt:message的工作方式说明:

let's introduce the <fmt:message> action. 让我们介绍<fmt:message>操作。 If you really wanted to do the bare-bones amount of work necessary to build an internationalized application,is the only action that you'll need to consider. 如果您真的想做构建国际化应用程序所需的基本工作,那是您唯一需要考虑的操作。 The action takes advantage of the LocalizationContext (which we talk about in the next section).By using the ,you can output values from your resource bundles as simply as: 该操作利用了LocalizationContext(我们将在下一节中讨论),通过使用,您可以从资源束中输出值,就像下面这样简单:

<fmt:message key="welcome"/>

The appropriate resource bundle will be used to look up the key "welcome" and the translated string will be provided. 适当的资源包将用于查找关键字“ welcome”,并将提供翻译后的字符串。 This is about as easy as it gets to incorporate international support into your application. 这几乎与将国际支持纳入您的应用程序一样容易。 The action also supports parameterized content, also called parametric replacement. 该操作还支持参数化内容,也称为参数替换。 For example, you can provide variables that will be used within the string used by the key attribute. 例如,您可以提供将在key属性所使用的字符串内使用的变量。 Say we want to personalize our welcome page and pass the name of a user so that we can welcome them. 假设我们要个性化我们的欢迎页面并传递用户名,以便我们欢迎他们。 To do this, we use the <fmt:param> subtag. 为此,我们使用<fmt:param>子标记。 We will talk about this in more detail later in this chapter, but as a quick example, so that you are familiar with the format, the action might look like: 我们将在本章后面更详细地讨论这一点,但是作为一个简单的示例,为了使您熟悉该格式,该操作可能类似于:

<fmt:message key="welcome">

<fmt:param value="${userNameString}"/>

</fmt:message>

taken from here 这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM