小编MDP*_*MDP的帖子

如何解决非活动InputConnection上的showStatusIcon

当我关闭我的应用程序时,我在LogCat上收到此消息 showStatusIcon on inactive InputConnection

我在某个地方读过,但我不确定,这意味着我没有发布一些与内存使用相关的东西.我怎么解决这个问题?

android

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

使用Eclipse导出存档文件或文件系统时出错(Android)

我想导出我的项目,以便将代码重用到新项目中.每次我尝试导出它时,"文件系统"和"存档文件"都会出错

Problems were encountered during export:
  Error exporting name_of_my_project/bin/jarlist.cache: Resource is out of sync with the file system: '/name_of_my_project/bin/jarlist.cache'.
    Resource is out of sync with the file system: '/name_of_my_project/bin/jarlist.cache'.
Run Code Online (Sandbox Code Playgroud)

也许这取决于我在不使用Eclipse的情况下将文件复制到我的项目文件夹中的事实.有办法解决问题吗?

eclipse android

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

动态GridLayout

我在另一个班级犯了一个错误,这就是为什么它不起作用.下面的代码似乎是正确的

我正在尝试创建一个动态的GridLayout.在另一个类中,不是这个,我有一个方法来设计我的gridlayout的行和列.在下面的课程中,我为GridLayout添加了一些按钮:

int buttons= 6;//the number of bottons i have to put in GridLayout
int buttonsForEveryRow = 3; // buttons i can put inside every single row
int buttonsForEveryRowAlreadyAddedInTheRow =0; // count the buttons added in a single rows
int columnIndex=0; //cols index to which i add the button
int rowIndex=0; //row index to which i add the button

for(int i=0; i < buttons;i++){          
    /*if numeroBottoniPerRigaInseriti equals numeroBottoniPerRiga i have to put the other buttons in a new row*/
    if(buttonsForEveryRowAlreadyAddedInTheRow …
Run Code Online (Sandbox Code Playgroud)

android

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

WebServlet无法解析为某种类型

我能够让我的应用程序再次运行,遵循user2821894的建议,但在尝试调用servlet后,tomcat 7再次停止工作!如果我尝试删除我调用我的servlet的代码我的web应用程序doesent'work !! 一旦我有一个servlet问题tomcat停止工作.

我在eclipse上启动我的web项目时遇到了问题.我遇到了Tomcat 7的问题.所以我从eclipse中删除'tomcat 7然后再添加它(再次添加tomcat 7).

现在我启动我的web项目没有问题,但我的servlet有问题.例如,我得到错误

 WebServlet cannot be resolved to a type
 The attribute value is undefined for the annotation type 
Run Code Online (Sandbox Code Playgroud)

我在我的项目中添加了servlet-api 3.0.jar,但我仍然遇到这些问题.

这是我的servlet的代码

 package Jeans;
    import java.io.IOException;
    import java.io.InputStream;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.SQLException;

    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.annotation.WebServlet;

    import com.sun.java.swing.plaf.windows.TMSchema.Part;


    import javax.servlet.http.Part;



    @WebServlet("/FileUploadDBServlet ")

  //// i got an error here//////////////////////////// 
    @MultipartConfig(maxFileSize = 16177215)  

    public class FileUploadDBServlet extends HttpServlet {


        private String dbURL = "db";
        private String dbUser = …
Run Code Online (Sandbox Code Playgroud)

java jsp servlets

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

自动装配不在@Entity类中工作

我有一个名为Menu的类,注释为@Entity,我需要在名为GestoreMessaggi的类中使用一个方法

....    
@Component
@Entity
@Table(name="menu")
public class Menu implements Serializable{

@Autowired
@Transient // because i dont' save this field on the DB
private GestoreMessaggi gestoreMessaggi;
.....
public void setCurrentLanguage(){

   /* I got the error both if use gestoreMessaggi
   this way and if I use the autowired istance of GestoreMessaggi*/
   GestoreMessaggi gestoreMessaggi = new GestoreMessaggi();  
   gestoreMessaggi.gest();        
}
.....
Run Code Online (Sandbox Code Playgroud)

这是GestoreMessaggi类的相关代码

 @Component
    public class GestoreMessaggi {    
        @Autowired 
        private ReloadableResourceBundleMessageSource messageSource;

        public void gest(){
        messageSource.doSomething() <--- here messageSource …
Run Code Online (Sandbox Code Playgroud)

java spring spring-mvc

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

如何在spring <form:form>中保存许多对象

@Component
@Entity
@Table(name="menu")
@Configurable
public class Menu implements Serializable{      
    ....        
    @OneToMany(mappedBy="menu", fetch=FetchType.EAGER)
    private Set<VoceMenu> voceMenuList; 

    public Set<VoceMenu> getVoceMenuList() {
        return voceMenuList;
    }

    public void setVoceMenuList(Set<VoceMenu> voceMenuList) {
        this.voceMenuList = voceMenuList;
    }
    .....   
}
Run Code Online (Sandbox Code Playgroud)

我打印一个表单来编辑菜单,以及它的相对VoceMenu对象,这样:

<form:form action="editMenu" method="post" commandName="menu"> 
     Menu id<form:input path="id" maxlength="11"/><br/>       
     ...... 
    <c:forEach items="${menu.voceMenuList}" varStatus="counter">            
        <form:input path="voceMenuList[${counter.index}].id" maxlength="11"/>
             .....
    </c:forEach>
    <input type="submit">
</form:form>
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试保存对象菜单时,我收到此错误:

bean类[com.springgestioneerrori.model.Menu]的属性'voceMenuList [0]'无效:无法从大小为0的集合获取索引为0的元素,使用属性路径'voceMenuList [0]'访问

java spring jsp jstl spring-form

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

如何动态定义可用作方法中参数的类?

我有一个方法用于验证Spring MVC中的POJO(这允许我依赖于@AnnotationPOJO,同时在不使用注释的情况下随时随地以编程方式验证POJO @Valid).

需要将对象的Class传递给方法才能验证:

public void validate(Class clazz, Object model, BindingResult result){      
    ...         
    Set<ConstraintViolation<clazz>> constraintViolations=validator.validate((clazz)model);
        for (ConstraintViolation<clazz> constraintViolation : constraintViolations) {
...
}
Run Code Online (Sandbox Code Playgroud)

我的代码不正确,因为得到错误:

clazz无法解析为某种类型

我应该如何编辑我的代码,以便能够将任何我想要的类传递给此方法?

谢谢

java arraylist

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

如何覆盖子类中的@annotations (javax.validation)

我有这个Entity,那是一个超级类:

@Entity
public class Father implements Serializable{    

    @Column(name = "name")
    @Size(min=1, max=10)
    @Pattern(regexp="^[A-Za-z ]*$")
    @NotNull
    private String name;

}
Run Code Online (Sandbox Code Playgroud)

这个,扩展了上面的一个:

@Entity    
public class FatherSub extends Father implements Serializable{  

    private String name;

}
Run Code Online (Sandbox Code Playgroud)

正如你所看到的,FatherSub我没有@Annotations也不想要它们。我怎样才能覆盖它们?有办法吗?

似乎注释@NotNull保留在子类中,并要求我填写 Father.name(不是FatherSub.name),正如您在这 2 个 Eclipse 打印屏幕图片中看到的那样。

在此处输入图片说明 在此处输入图片说明

谢谢

java hibernate jpa spring-mvc bean-validation

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

如何在使用@JoinTable时删除所有表中的记录(使用Hibernate)

我有一堂课叫News. 任何新闻都可以有很多Photo。这些是我的桌子

   news                   news_photo             photo
--------------      ----------------------     ------------
| id | title |      | id_news | id_photo |     | id | url |
--------------      ----------------------     ------------
  |                      |         |              |
  |----------------------|         |--------------|
Run Code Online (Sandbox Code Playgroud)

这是我的班级News

@Entity    
@Table(name = "news")
public class News extends ElementoPersistente implements Serializable{  
    ...
    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true)
    @JoinTable(name = "news_photo",
               joinColumns = { @JoinColumn(name = "id_news")},
               inverseJoinColumns = { @JoinColumn(name = "id_photo") }) 
    private List<photo> photos;
    ...
} …
Run Code Online (Sandbox Code Playgroud)

java mapping orm hibernate jpa

5
推荐指数
0
解决办法
670
查看次数

无法解析com.google.gms:google-services:3.0.0

我读了很多关于这个主题的帖子,但没有人帮助过我.我正在使用Android Studio并遵循本指南

这是项目的gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.google.gms:google-services:3.0.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}
Run Code Online (Sandbox Code Playgroud)

这是应用程序gradle:

apply plugin: 'com.android.application'

    android {
        compileSdkVersion 25
        buildToolsVersion "25.0.1"
        defaultConfig {
            applicationId "com.xyv.appname"
            minSdkVersion 15
            targetSdkVersion 25
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    } …
Run Code Online (Sandbox Code Playgroud)

java android google-play-services android-studio

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