我正尝试让类似BT传输的下载面板的东西(这里的图像:http://www.transmissionbt.com/images/screenshots/Mac-Large.jpg),但有一些问题I'm.我用进度条,标签,图标和按钮创建了一个JPanel,然后将这个面板添加到一个容器(再次使用JPanel),但我需要使这个组件可选.
我怎样才能做到这一点?
我有一个带有一个简单实体和一个 JPA 存储库的 Spring 项目。该实体具有三个变量:Name (String)、active (boolean)和date (java.util.Date)。部署后,Hibernate 在我的 MySQL 数据库中使用varchar,tinyint和datetime. 一切似乎都正确,但是当我创建/修改实体的实例并调用save()存储库的方法时,除日期外的所有字段都被保存。使用 JPA 存储库存储日期是否有任何问题,或者我做错了什么?
我没有在这里放任何代码,因为它只是一个简单的类和存储库的接口。此外,实体正在被保存。我的问题仅与日期字段(以及我可以定义的任何其他日期字段)有关。话虽如此,如果有什么需要,尽管问。
编辑:
根上下文.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd">
<!-- Root Context: defines shared resources visible to all other web components -->
<import resource="infraestructure.xml" />
<jpa:repositories base-package="com.smarttabletv.repository" />
</beans>
Run Code Online (Sandbox Code Playgroud)
servlet-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context …Run Code Online (Sandbox Code Playgroud) 我在Sprint MVC应用程序上使用Apache Tiles,我有这个tiles.xml:
<tiles-definitions>
<definition name="defaultLayout" template="/WEB-INF/tiles/template/defaultLayout.jsp">
<put-attribute name="title" value="" />
<put-attribute name="header" value="/WEB-INF/tiles/template/header.jsp" />
<put-attribute name="content" value=""/>
<put-attribute name="footer" value="/WEB-INF/tiles/template/footer.jsp" />
</definition>
<definition name="home" extends="defaultLayout">
<put-attribute name="title" value="Alsa" />
<put-attribute name="content" value="/WEB-INF/pages/home.jsp" />
<put-attribute name="active" value="index" />
</definition>
</tiles-definitions>
Run Code Online (Sandbox Code Playgroud)
我要做的是使用active属性将类添加到活动菜单项.为此我在header.jsp中有这个:
<%@ taglib uri="http://tiles.apache.org/tags-tiles-extras" prefix="tilesx" %>
<tilesx:useAttribute name="active" />
Run Code Online (Sandbox Code Playgroud)
问题是每次我尝试渲染页面时都会收到此错误:
org.apache.tiles.template.NoSuchAttributeException:导入属性时出错.属性"active"为null
我究竟做错了什么?
之前我问过这个问题,但是我打算用一个解决方案来完成这个问题并提出另一个问题.
我正在使用这个类来创建异步WebRequest:
class HttpSocket
{
public static void MakeRequest(Uri uri, Action<RequestCallbackState> responseCallback)
{
WebRequest request = WebRequest.Create(uri);
request.Proxy = null;
Task<WebResponse> asyncTask = Task.Factory.FromAsync<WebResponse>(request.BeginGetResponse, request.EndGetResponse, null);
ThreadPool.RegisterWaitForSingleObject((asyncTask as IAsyncResult).AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), request, 1000, true);
asyncTask.ContinueWith(task =>
{
WebResponse response = task.Result;
Stream responseStream = response.GetResponseStream();
responseCallback(new RequestCallbackState(response.GetResponseStream()));
responseStream.Close();
response.Close();
});
}
private static void TimeoutCallback(object state, bool timedOut)
{
Console.WriteLine("Timeout: " + timedOut);
if (timedOut)
{
Console.WriteLine("Timeout");
WebRequest request = (WebRequest)state;
if (state != null)
{
request.Abort();
} …Run Code Online (Sandbox Code Playgroud) java ×2
spring ×2
android ×1
apache-tiles ×1
c# ×1
date ×1
hibernate ×1
jpanel ×1
spring-data ×1
spring-mvc ×1
swing ×1
webrequest ×1