apple0668
上善若水,水善利万物而不争,处众人之所恶而不争,故几于道——《老子》
BlogJava
首页
新随笔
聚合
管理
随笔-29 评论-70 文章-0 trackbacks-0
struts2中head标签的使用
在struts2中的jsp文件使用<s:head/>可以得到一些加入js的效果
login.jsp
<%@ page language="java" contentType="text/html; charset=GBK"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<title>登录页面</title>
<s:head/>
</head>
<body>
<s:form action="Login.action" method="post">
<s:textfield name="name" label="用户名"/>
<s:password name="password" label="密码"/>
<s:submit value="登录"/>
</s:form>
</body>
</html>
1、输入:
http://localhost:8080/strutsdemo/login.jsp
2、得到:
没有加<head/>时候得到
加<s:head/>后,浏览器源文件代码
1
<
html
>
2
<
head
>
3
<
title
>
��¼ҳ��
</
title
>
4
<
link
rel
="stylesheet"
href
="/strutsdemo/struts/xhtml/styles.css"
type
="text/css"
/>
5
<
script
type
="text/javascript"
>
6
//
Dojo configuration
7
djConfig
=
{
8
baseRelativePath:
"
/strutsdemo/struts/dojo
"
,
9
isDebug:
false
,
10
bindEncoding:
"
UTF-8
"
,
11
debugAtAllCosts:
true
//
not needed, but allows the Venkman debugger to work with the includes
12
}
;
13
</
script
>
14
<
script
type
="text/javascript"
15
src
="/strutsdemo/struts/dojo/dojo.js"
></
script
>
16
<
script
type
="text/javascript"
17
src
="/strutsdemo/struts/simple/dojoRequire.js"
></
script
>
18
19
</
head
>
20
<
body
>
21
22
<
form
id
="Login"
onsubmit
="return true;"
action
="Login.action"
method
="post"
>
23
<
table
class
="wwFormTable"
>
24
<
tr
>
25
<
td
class
="tdLabel"
><
label
for
="Login_name"
class
="label"
>
�û���:
</
label
></
td
>
26
<
td
27
><
input
type
="text"
name
="name"
value
=""
id
="Login_name"
/>
28
</
td
>
29
</
tr
>
30
31
<
tr
>
32
<
td
class
="tdLabel"
><
label
for
="Login_password"
class
="label"
>
����:
</
label
></
td
>
33
<
td
34
><
input
type
="password"
name
="password"
id
="Login_password"
/>
35
</
td
>
36
</
tr
>
37
38
<
tr
>
39
<
td
colspan
="2"
><
div
align
="right"
><
input
type
="submit"
id
="Login_0"
value
="��¼"
/>
40
</
div
></
td
>
41
</
tr
>
42
43
</
table
></
form
>
44
45
</
body
>
46
</
html
>
47
3、由于加入了validation校验框架,在没有输入用户名跟密码时候,按登录产生一下界面
浏览器的源代码:
1
<
html
>
2
<
head
>
3
<
title
>
登录页面
</
title
>
4
<
link
rel
="stylesheet"
href
="/strutsdemo/struts/xhtml/styles.css"
type
="text/css"
/>
5
<
script
type
="text/javascript"
>
6
//
Dojo configuration
7
djConfig
=
{
8
baseRelativePath:
"
/strutsdemo/struts/dojo
"
,
9
isDebug:
false
,
10
bindEncoding:
"
UTF-8
"
,
11
debugAtAllCosts:
true
//
not needed, but allows the Venkman debugger to work with the includes
12
}
;
13
</
script
>
14
<
script
type
="text/javascript"
15
src
="/strutsdemo/struts/dojo/dojo.js"
></
script
>
16
<
script
type
="text/javascript"
17
src
="/strutsdemo/struts/simple/dojoRequire.js"
></
script
>
18
19
</
head
>
20
<
body
>
21
22
<
form
id
="Login"
onsubmit
="return true;"
action
="Login.action"
method
="post"
>
23
<
table
class
="wwFormTable"
>
24
<
tr
errorFor
="Login_name"
>
25
<
td
align
="center"
valign
="top"
colspan
="2"
><
span
class
="errorMessage"
>
用户名必填
</
span
></
td
>
26
</
tr
>
27
<
tr
>
28
<
td
class
="tdLabel"
><
label
for
="Login_name"
class
="errorLabel"
>
用户名:
</
label
></
td
>
29
<
td
30
><
input
type
="text"
name
="name"
value
=""
id
="Login_name"
/>
31
</
td
>
32
</
tr
>
33
34
<
tr
errorFor
="Login_password"
>
35
<
td
align
="center"
valign
="top"
colspan
="2"
><
span
class
="errorMessage"
>
密码必填
</
span
></
td
>
36
</
tr
>
37
<
tr
>
38
<
td
class
="tdLabel"
><
label
for
="Login_password"
class
="errorLabel"
>
密码:
</
label
></
td
>
39
<
td
40
><
input
type
="password"
name
="password"
id
="Login_password"
/>
41
</
td
>
42
</
tr
>
43
44
<
tr
>
45
<
td
colspan
="2"
><
div
align
="right"
><
input
type
="submit"
id
="Login_0"
value
="登录"
/>
46
</
div
></
td
>
47
</
tr
>
48
49
50
</
table
></
form
>
51
52
53
54
55
</
body
>
56
</
html
>
posted on 2007-11-02 20:37
apple0668
阅读(1171)
评论(1)
编辑
收藏
所属分类:
struts2
评论:
#
re: struts2中head标签的使用
2008-01-03 17:33 |
ElgooG
thanks,
回复
更多评论
IT新闻
新用户注册
刷新评论列表
标题
姓名
主页
验证码
*
内容(请不要发表任何与政治相关的内容)
Remember Me?
登录
使用高级评论
新用户注册
返回页首
恢复上次提交
[使用Ctrl+Enter键可以直接提交]
该文被作者在 2007-11-02 20:41 编辑过
相关链接:
网站导航:
博客园
BlogJava
博客生活
IT博客网
C++博客
PHP博客
博客园社区
管理博客
教师博客
天文博客
汽车博客
足球博客
股票博客
电子博客
管理
相关文章:
eclipse的第一个struts2插件:Alveole Studio MVC Web Project An eclipse plugin for Struts 2
ssh2中采用dao---service---action分层结构
struts2中head标签的使用
struts2中命名空间的使用
Email:
chensp1230@163.com
欢迎交流
框架是告诉人们不该去做什么,而不是告诉人们该去做什么;容器是告诉人们该去做什么,而不是告诉人们不该去做什么!
<
2007年11月
>
日
一
二
三
四
五
六
28
29
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
4
5
6
7
8
留言簿
(2)
给我留言
查看公开留言
查看私人留言
我参与的团队
深圳Java开发者之家(1/1)
Netbeans 爱好者(0/0)
随笔分类
(33)
Aglets(1)
eclipse(3)
hibernate(4)
java(3)
jboss
junit(3)
Log4(2)
spring(4)
struts2(4)
svn(1)
tomcat(4)
webwork(4)
xml
心情港湾
随笔档案
(29)
2008年9月 (1)
2008年4月 (1)
2008年1月 (2)
2007年11月 (2)
2007年10月 (15)
2007年9月 (8)
友情链接
孙飞龙博客
开源在线手册
开源在线手册
最新随笔
1. 利用hibernate中的SchemaExport生成数据表
2. eclipse的第一个struts2插件:Alveole Studio MVC Web Project An eclipse plugin for Struts 2
3. ssh2中采用dao---service---action分层结构
4. ssh2三大框架使用时遇到的一个ConstraintViolationException异常
5. aglets2.0.2安装手记
6. struts2中head标签的使用
7. Subversion之路---实现精细的目录访问权限控制<转>
8. webwork中自定义url后缀名
9. 小试Log4j
10. struts2中命名空间的使用
搜索
最新评论
1. re: webwork防止表单重复提交
我也是这样做的,但是出了个问题:重新填写完表单再提交也不让提交了.不知为什么?
--zhangyq
2. re: eclipse的第一个struts2插件:Alveole Studio MVC Web Project An eclipse plugin for Struts 2
@Bryan
同感,不过现在sturts还是主流的控制器开发,struts2不知道要到什么时候才广泛使用。
相对struts2插件来说还是感觉nb的插件好用,不过也习惯了手写了。
--apple0668
3. re: eclipse的第一个struts2插件:Alveole Studio MVC Web Project An eclipse plugin for Struts 2
使用过struts struts2 和spring mvc做控制器开发项目,现在感觉还是struts2 简单方便,尤其是spring mvc很烦,尤其在提交表单涉及复杂对象的时候
--Bryan
4. re: 利用hibernate中的SchemaExport生成数据表
可以使用annotation生成数据库的脚本,然后在通过数据库生成hbm,这样很快
--Bryan
5. 更改QQ密码
更改密码
--付汝祥
阅读排行榜
1. eclipse的第一个struts2插件:Alveole Studio MVC Web Project An eclipse plugin for Struts 2(4268)
2. Tomcat:IOException while loading persisted sessions: java.io.EOFException解决手记(2590)
3. Subversion之路---实现精细的目录访问权限控制<转>(2000)
4. Tomcat启动端口被占用异常处理(1772)
5. ssh2三大框架使用时遇到的一个ConstraintViolationException异常(1439)
评论排行榜
1. eclipse的第一个struts2插件:Alveole Studio MVC Web Project An eclipse plugin for Struts 2(28)
2. Tomcat启动端口被占用异常处理(7)
3. 升级瑞星防火墙2008后,在myeclipse6.0中启动tomcat遇到怪问题!(7)
4. Tomcat:IOException while loading persisted sessions: java.io.EOFException解决手记(6)
5. Log4配置(3)