使用Struts2的标签是不是有点恐怖?

使用Struts2框架的日期选择器导致页面加载缓慢,整体大小增加至481KB,严重影响用户体验。博主尝试探究更高效轻量级的日期选择器实现方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

刚刚接触struts2的标签,做了以下一个测式

在jsp的头部加入 <head><s:head /></head>

在<body><s:datetimepicker tooltip="Select Your Birthday" label="生日"
name="birthday" displayFormat="yyyy-MM-dd"/>
</body>

当执行上面的jsp时,页面得到的结果如下:
<link rel="stylesheet" href="/struts/xhtml/styles.css" type="text/css"/>
<script type="text/javascript">
// Dojo configuration
djConfig = {
baseRelativePath: "/struts/dojo",
isDebug: false,
bindEncoding: "UTF-8",
debugAtAllCosts: true // not needed, but allows the Venkman debugger to work with the includes
};
</script>
<script type="text/javascript"
src="/struts/dojo/dojo.js"></script>
<script type="text/javascript"
src="/struts/simple/dojoRequire.js"></script>

<link rel="stylesheet" href="/struts/xhtml/styles.css" type="text/css"/>
<script type="text/javascript">
// Dojo configuration
djConfig = {
baseRelativePath: "/struts/dojo",
isDebug: false,
bindEncoding: "UTF-8",
debugAtAllCosts: true // not needed, but allows the Venkman debugger to work with the includes
};
</script>
<script type="text/javascript"
src="/struts/dojo/dojo.js"></script>
<script type="text/javascript"
src="/struts/simple/dojoRequire.js"></script>

可以正常显示,但是在firefox 用firebug 的YSlow插件测式,在本机都要用个三四秒,只是为了加一个日期选择,整个页面就被引入了481KB,YSlow的平分由98分,降到42分,太惨不忍赌了,不知道大家都用些什么方式引入日期选择器呢?

这些都是struts标签包装好的,struts2引入的dojo.js就有二百多KB,如果网速慢还得了,在本机都要用个3秒中,再加上页面的查询,那不是要命么,不知道有没有其它用法
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值