application与config
来源:互联网 发布:编写网页的软件 编辑:程序博客网 时间:2024/05/16 09:46
application与config
application方法:
setAttribute(),getAttribute(),removeAttribute().
getRealPath("/")
通常使用getServletContext()方法代替application
J2EE中安全性的体现:工作目录的WEB-INF文件夹
找到放在WEB-INF文件夹下的方法:
在WEB-INF下的web.xml配置文件中加入
<servlet>
<servlet-name>XXX</servlet-name> 与下面的servlet-name内容一致
<jsp-file>/WEB-INF/xxx.jsp</jsp-file> 真实文件的地址
</servlet>
<servlet-mapping>
<servlet-name>XXX</servlet-name>
<url-pattern>/xxx</url-pattern> 通过什么访问(/XXX)
</servlet-mapping>
重起服务器......
使用config对象的前提:
JSP页面必须在web.xml中配置
<servlet>
<servlet-name>XXX</servlet-name> 与下面的servlet-name内容一致
<jsp-file>/WEB-INF/xxx.jsp</jsp-file> 真实文件的地址
<init-param>
<param-name>XXX</param-name>
<param-value>XXX</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>XXX</servlet-name>
<url-pattern>/xxx</url-pattern> 通过什么访问(/XXX)
</servlet-mapping>
通过使用config.getInitParameter("param-name");
如果要取得这些初始化参数,必须通过映射名称进行访问jsp页面,才可以取得初始化参数,就通过config对象取得.(比如可以将数据库连接的一些信息写在配置文件中)
config.getInitParameterNames()取得全部配置参数
更改登陆主页的用法:
在web.xml中写入
<welcome-file-list>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
重起服务器即可......
- application与config
- tomcat config manager application
- application对象和config对象
- jsp---->application 和config对象
- yii 之(new yii-web-Application($config))
- Dubbo启动异常:Duplicate application config...
- A simple config file (application / configs / application.ini)
- pkg-config与LD_LIBRARY_PATH
- pkg-config与LD_LIBRARY_PATH
- pkg-config与LD_LIBRARY_PATH
- config 与 makefile
- Kconfig, Makefile与.config
- 操作App.config与Web.config文件
- Config语言与Config.in文件
- redis中关于config get、config set与config rewrite
- 如何让多个Win Application 仅使用一个 app.config 文件?
- 为Config文件提供Application级别的设置读写
- jsp内置对象application、exception、pageContext、config方法
- HTTP中Get与Post的区别
- Handler Message 消息机制和AsyncTask异步处理android数据交互
- PreparedStatement与Statement
- 3.2栈的应用举例----数制转换、括号匹配及行编辑
- BMP图四字节对齐的问题
- application与config
- ojdbc14.jar 与ojdbc6.jar的区别
- response.setContentType()中MIME参数类型总结
- exit()和return的区别
- The word is not correctly spelled问题解决
- sgu 184 Patties
- Vim快捷键分类
- C++中的友元
- struts2的执行原理