小编Dav*_*cía的帖子

Swing中的可选面板

我正尝试让类似BT传输的下载面板的东西(这里的图像:http://www.transmissionbt.com/images/screenshots/Mac-Large.jpg),但有一些问题I'm.我用进度条,标签,图标和按钮创建了一个JPanel,然后将这个面板添加到一个容器(再次使用JPanel),但我需要使这个组件可选.

我怎样才能做到这一点?

java swing jpanel

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

Spring数据不保存日期

我有一个带有一个简单实体和一个 JPA 存储库的 Spring 项目。该实体具有三个变量:Name (String)active (boolean)date (java.util.Date)。部署后,Hibernate 在我的 MySQL 数据库中使用varchar,tinyintdatetime. 一切似乎都正确,但是当我创建/修改实体的实例并调用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)

java spring hibernate date spring-data

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

在Apache Tiles上找不到属性

我在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

我究竟做错了什么?

spring spring-mvc apache-tiles

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

在异步请求中使用超时回调

之前我问过这个问题,但是我打算用一个解决方案来完成这个问题并提出另一个问题.

我正在使用这个类来创建异步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)

c# android webrequest android-asynctask

0
推荐指数
1
解决办法
4950
查看次数