小编Sri*_*san的帖子

java获取日期标记字段(上午/下午)

我需要在日期对象中获取字段AM/PM.我怎么才能得到它?

这是我的代码.

String startTime ="01:05 PM";
 SimpleDateFormat sdf = new SimpleDateFormat("hh:mm aa");

 Date st = sdf.parse(startTime);
Run Code Online (Sandbox Code Playgroud)

java

8
推荐指数
2
解决办法
2万
查看次数

getHibernateTemplate().flush()和getSession()之间有什么区别.flush()

我正在使用Hibernate 3.2.6.我面临例外

在冲洗之前保存瞬态实例

在我的代码中,有时我们正在使用getSession().flush(),有时我们getHibernateTemplate().flush()在一个事务中使用.

你能否告诉我这两者有什么区别?

java spring hibernate

8
推荐指数
1
解决办法
1204
查看次数

如何使用某种格式的c:out标签显示日期

我正在使用JSTL.我想在JSP中使用<c:out ..>标签显示日期.

我试过了<c:out value = "<fmt:formatdate value = '${datevar}'"/>.

但它显示<fmt:formatdate value = '${datevar}'在HTML中.

需要更改哪些内容以预期格式显示日期?

jsp jstl

7
推荐指数
1
解决办法
2万
查看次数

装箱的值将取消装箱,然后立即重新装箱

我收到Findugs错误"盒装值未装箱然后立即重新装箱".

这是代码:

Employee emp = new Employee()
Long lmt = 123L;

emp.setLimit(Long.valueOf(lmt)); 
Run Code Online (Sandbox Code Playgroud)

在此,Employee limit字段是类型Long.你能告诉我这是什么错误吗?

java autoboxing findbugs

6
推荐指数
2
解决办法
2万
查看次数

间接引用所需的.class文件

我在STS中遇到以下错误:

无法解析org.springframework.core.env.EnvironmentCapable类型.它是从所需的.class文件间接引用的

java spring spring-tool-suite

6
推荐指数
1
解决办法
3万
查看次数

FindBugs - 冗余比较为null

我有以下代码的findbugs错误,

if( obj instanceof CustomerData )
{
    CustomerData customerData = (CustomerData)obj;

    if (customerData == null) 
    {
        errors.reject("Error", "Null data received");
    }
}
Run Code Online (Sandbox Code Playgroud)

错误说明:

obj的冗余nullcheck,已知为非null(包名和方法名称,我因安全违规而删除)

此方法包含对常量null的已知非空值的冗余检查.

请告诉我这里的错误是什么.

java code-analysis findbugs

5
推荐指数
1
解决办法
9195
查看次数

Findbugs - Method忽略异常的返回值

我在下面的代码中得到了Findbugs错误.请告诉我需要做什么?

码:

public void myMethod(Key key, long timestampMillis) {
        File file = createFile(key, timestampMillis);
        boolean deleted = file.delete();
    }
Run Code Online (Sandbox Code Playgroud)

<<Package/classname>>忽略异常返回值此java.io.File.delete() 方法返回未检查的值.应检查返回值,因为它可以指示异常或意外的函数执行.例如,如果无法成功删除文件(而不是抛出异常),则File.delete()方法返回false.如果不检查结果,则不会注意方法调用是否通过返回非典型返回值来表示意外行为.

findbugs

5
推荐指数
1
解决办法
9887
查看次数

收集与阵列性能明智

能不能让我知道性能明智为什么ArrayCollection更好?

java

5
推荐指数
1
解决办法
2755
查看次数

如何避免跨页面拆分 HTML 中的 DIV

下面是我的代码:

<!DOCTYPE html>
<html>
<head>
<style>
    @media print
    {
      .page-break  { display:block; page-break-inside: avoid;}
    }

} 
</style>    
</head>
<body>
  <p>This is some text.</p>
  <p>This is some text.</p>
  <p>This is some text.</p>
  <p>This is some text.</p>
  <p>This is some text.</p>
  <p>This is some text.</p>
  <p>This is some text.</p>
  <p>This is some text.</p>
  <p>This is some text.</p>
  <p>This is some text.</p>
  <p>This is some text.</p>
  <p>This is some text.</p>
  <p>This is some text.</p>
  <p>This is some text.</p>
  <p>This is some text.</p>
  <p>This …
Run Code Online (Sandbox Code Playgroud)

html css

5
推荐指数
1
解决办法
2187
查看次数

如何将Java与Tally应用程序集成

我需要将我的Java Web应用程序与Tally软件集成.

可能吗?请提供一些想法.

java tally

4
推荐指数
1
解决办法
1万
查看次数