
额,不知道你数据库中是怎么存的,应该会有状态的吧,假如是个checked吧,有选中的那个option里的属性是selected 的
private String selected
假设如果选中的话你的selected的值就是selected,否则是null
<option value="xxx" <jsp:getProperty name="bean" property="selected"/>>下拉框数据</option>
楼主想要的应该是这种位置,前面那段是楼主tomcat的位置就好了D:\Program Files\Apache Software Foundation\Tomcat 5.0\conf\Catalina\localhost\工程名.xml
在这个文件中配置JNDI就可以了,另外.xml也给个楼主参考
<?xml version='1.0' encoding='utf-8'?>
<Context displayName="for test" docBase="D:\workspace31\test" path="/test">
<Resource name="jdbc/test" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/test">
<parameter>
<name>maxWait</name>
<value>5000</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>10</value>
</parameter>
<parameter>
<name>password</name>
<value>4321</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@192.168.1.101:1521:care</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.OracleDriver</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>5</value>
</parameter>
<parameter>
<name>username</name>
<value>puderty</value>
</parameter>
</ResourceParams>
</Context>
如果楼主的日期字符串每个日期都符合yyyy-mm-dd的格式,即年总是四位,月总是2位,日总是两位,且年月日之间总有一个字符的分隔符的话,根据 puderty - 经理 五级 的回答,可以这样查询
/*入住日期为 2008-08-11 */
select *
from tmp_A
where (charindex('2008-08-11',datestring)-1)%2=0
/*离店日期为 2008-08-11 */
select *
from tmp_A
where (charindex('2008-08-11',datestring)-1)%2=1
-----------------------------------------------------------------------
--如果日期字符串不总是yyyy-mm-dd的格式,可以写一个自定义函数
/*建立测试数据*/
select * into tmp_A
from(
select 0 as FH, '2008-08-11|2008-08-13|2008-08-12|2008-08-22' as dateString
union all select 1 ,'2008-08-31|2008-08-13|2008-08-12|2008-08-22'
union all select 2 ,'2008-08-31|2008-08-13'
union all select 3 ,'2008-08-31|2008-08-13|2008-08-12|2008-08-22|2008-07-03|2008-08-01'
union all select 4 ,'2008-08-31|2008-08-13|2008-08-11|2008-08-22'
union all select 5 ,'2008-08-11|2008-08-22'
union all select 6 ,'2008-08-31|2008-08-11|2008-08-12|2008-08-11'
union all select 7 ,'2008-08-12|2008-08-11'
) as TabA
------------------------------------------------
/*自定义函数开始*/
/*
取所有入住日期或离店日期,返回值以逗号分隔
*/
CREATE FUNCTION [dbo].[FN_GetInDateString]
(
@sText varchar(8000), /*日期字符串*/
@sDelim varchar(20), /*分隔符*/
@iType int/*查找类型,0 为入住日期,1为离店日期*/
)
RETURNS varchar(8000)
AS
BEGIN
declare @value as varchar(8000)
declare @idx as int /*出现的次数,从1开始*/
declare @pos as int /*分隔符的位置*/
set @idx=0
set @value=''
if len(@sText)=0 return @value
if len(@sDelim)=0 return @value
while 1=1
begin
set @pos= charindex(@sDelim,@sText)
if @pos=0
begin
/*不含分隔符*/
if @idx % 2=@iType
begin
set @value=@value+','+@sText
break
end
else
break
end
else
begin
/*含分隔符*/
if @idx % 2=@iType
begin
set @value=@value+','+left(@sText,@pos-1)
end
set @sText=SUBSTRING(@sText,@pos+1,len(@sText))
end
set @idx=@idx+1
if len(@sText)=0
break
end
/*返回值,并去除第一个逗号*/
RETURN SUBSTRING(@value,2,len(@value))
END
/*自定义函数结束*/
------------------------------------------------
/*使用示例*/
/*查找入住日期为 2008-08-11 的数据*/
select *
from tmp_A
where (dbo.FN_GetInDateString(datestring,'|',0)) like '%2008-08-11%'
/*查找离店日期为 2008-08-11 的数据*/
select *
from tmp_A
where (dbo.FN_GetInDateString(datestring,'|',1)) like '%2008-08-11%'
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)