FreeMarker
我之前对web.xml只有一个很粗略的理解:定义了webapp可以使用的资源。
今天有了进一步的理解:定义了component中所有的parameter!
在party的PartyScreen.xml中有着这样一段代码:
<screen name="findparty">
<section>
<actions>
<set field="titleProperty" value="PageTitleFindParty"/>
<set field="headerItem" value="find"/>
<set field="tabButtonItem" value="findparty"/>
<service service-name="findParty" auto-field-map="parameters"/>
</actions>
<widgets>
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
<section>
其中,location这里的${parameters.mainDecoratorLocation}就是在web.xml中定义的:
<context-param>
<param-name>mainDecoratorLocation</param-name>
<param-value>component://party/widget/partymgr/CommonScreens.xml</param-value>
<description>The location of the main-decorator screen to use for this webapp; referred to as a context variable in screen def XML files.</description>
</context-param>
所以,这里的${parameters.mainDecoratorLocation}就等价于:"component://party/widget/partymgr/CommonScreens.xml"
自我感觉,这里的context-param有点像C/C++全局变量