超级基础的一些配置总结

本文汇总了Spring配置如注解激活、定时任务设置,Struts2过滤器与动作映射,以及JSP中百分比显示、复选框状态处理和正则表达式验证等基础但实用的技巧。
摘要由CSDN通过智能技术生成

1.h3:

id生成策略:<generator      class="sequence"><param name="sequence">SEQ_T_WARNVALUEI_INFO2.

============================================================================================

2.<!-- 激活spring的注解. -->
<context:annotation-config />
<context:component-scan base-package="com.jiankong..*,com.ctid..*">
<context:include-filter type="annotation" expression="org.aspectj.lang.annotation.Aspect" />
</context:component-scan>  

============================================================================================

<!-- spring监控任务定时配置 -->
<bean id="quartzDetail"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject">
<ref bean="monitorSysInfoQuart" />
</property>
<property name="targetMethod">
<value>toWritemassage</value>
</property>
</bean>
<bean id="simpleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail" ref="quartzDetail" />
<property name="startDelay" value="3000" /><!-- 调度工厂实例化后,经过5秒开始执行调度 -->
<property name="repeatInterval" value="3000" /><!-- 每300秒调度一次 -->
</bean>
<bean autowire="no"class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref local="simpleTrigger" />
</list>
</property>
</bean>
===============================================================================================

3.web.xml中

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:/com/config/spring/*.xml
</param-value>
</context-param>
<listener>  
   <listener-class>  
       org.springframework.web.context.ContextLoaderListener   
   </listener-class>  
</listener>

=========================================================================================

 <filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>


<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

=================================================================================================

jsp中:

1:<fmt:formatNumber value="${cpuUsage}" type="percent"  maxFractionDigits="2"/>  百分数显示 

2:<input type="checkbox"  disabled="true" value="chooseMessage" <s:if test='chooseMessage==1'>checked</s:if> /> 选中,不能操作

<s:if test='chooseMessage=="1"'>
<s:checkbox name="chooseMessage" fieldValue="1"checked="checked" />
</s:if> <s:else>
<s:checkbox name="chooseMessage" fieldValue="1"class="cbox"/>
</s:else>

input的checked可以用,但是s:checkbox不可以。

3.   οnblur="checkperc(this)"  参数传递this

 function checkPerc(obj) {
if(obj.value.trim() == ""){
alert("使用率不能为空");
obj.focus();
return;
}
var regExp = /^((\d+\.?\d*)|(\d*\.\d+))\$/g;
result = regExp.test(obj.value);
if (!result) {
alert("请输入0-1之间的数字");
obj.focus();
return;
}  
if(obj.value.trim()<0 || obj.value.trim()>1){
alert("请输入0-1之间的数字");
obj.focus();
return;
}
}


var telReg = !!tel.match(/^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/);
//如果手机号码不能通过验证
if(telReg == false){
alert("手机号格式不正确");
obj.focus();
}

==================================================

1:<s:fielderror ></s:fielderror><s:actionerror/>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值