jsp in the config object

Implicit object in jsp config object in which a relatively less used, this object is used to configure the general parameters of the specified jsp, servlet as the parameter configuration. After all, the essence jsp servlet, their configuration is similar. Here is the configuration of their own study notes;

<servlet-name> test </ servlet-name>
<jsp-file> / test.jsp </ jsp-file> <! - Note that either the jsp-file is either servelt-class tag ->
<param-name> username </ param-name>
<param-value> zhang </ param-value>
</ Init-param>
</ Servlet>
<servlet-name> test </ servlet-name>
<url-pattern> / test </ url-pattern>
</ Servlet-mapping>

These are the configuration parameters of the test.jsp username, the corresponding value of zhang; when running test (note that not test.jsp), in fact running test.jsp file, test the path for the mapping,

Here in the address bar if we visit through the test we can use <% = config.getInitParameter ("username")%> get parameter values: zhang.

If you use test.jsp access the page, but also access, but can not obtain configuration parameters. So if you want to use test.jsp run, modify the mapping path <url-pattern> / test.jsp </ url-pattern>

In short: By refusing to explain, I can understand, like jsp and servlet mapping configuration can be arbitrary, but the difference between jsp and servlet, in particular, jsp mapping can be used to access the original path can also use the map to access

分类:Java 时间:2010-03-28 人气:255
blog comments powered by Disqus


iOS 开发

Android 开发

Python 开发



PHP 开发

Ruby 开发






Javascript 开发

.NET 开发



Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 闽ICP备15018612号

processed in 0.255 (s). 13 q(s)