小编Thu*_*fir的帖子

@Produces返回FacesContext ---为什么?

我对于同一主题提出了另一个问题仍犹豫不决,但至少现在我正在阅读正确的文档.

所以,这堂课:

class FacesContextProducer {
   @Produces @RequestScoped FacesContext getFacesContext() {
      return FacesContext.getCurrentInstance();
   }
}
Run Code Online (Sandbox Code Playgroud)

事实上,从焊接文档中,此方法适用于Glassfish: GlassFish使用WELD作为JSR-299的参考实现:Java上下文的Java上下文和依赖注入(CDI).

对于上面的课程,它会在哪里使用?为什么你需要一个单独的类@Produces一个FacesContext?

jsf glassfish facelets cdi jboss-weld

3
推荐指数
2
解决办法
2282
查看次数

Netbeans:如何从"设计"GUI构建器向JTable添加valueChanged侦听器?

我右键单击了JTable并将一些代码插入到一个糟糕的kludge中的"post listeners code"中.

我没有看到添加的选项

table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
  public void valueChanged(ListSelectionEvent evt) {
Run Code Online (Sandbox Code Playgroud)

到JTable的"设计"视图中的"事件".我确定有一种方法可以从设计视图中添加valueChanged(ListSelectionEvent evt),但是如何?

也许这是一个错误

行选择更改事件由JTable的ListSelectionModel生成,而不是由JTable本身生成 - 因此事件无法在Component Inspector中呈现(作为JTable的事件).处理此事件必须手动完成,例如:

jTable1.getSelectionModel().addListSelectionListener(
    new javax.swing.event.ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            customRowSelectionEventHandler(evt);
        }
    }
);
Run Code Online (Sandbox Code Playgroud)

虽然可能有一种方法可以在"蓝色","托管"代码之外获取JTable的ListSelectionModel?

java swing netbeans jtable netbeans-7

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

netty DefaultChannelPipeline exceptionCaught

不幸的是,我不明白netty服务器的这个输出:

BUILD SUCCESSFUL
Total time: 3 seconds
Jul 27, 2014 2:04:44 AM io.netty.handler.logging.LoggingHandler channelRegistered
INFO: [id: 0xcad25a31] REGISTERED
Jul 27, 2014 2:04:44 AM io.netty.handler.logging.LoggingHandler bind
INFO: [id: 0xcad25a31] BIND(0.0.0.0/0.0.0.0:4454)
Jul 27, 2014 2:04:44 AM io.netty.handler.logging.LoggingHandler channelActive
INFO: [id: 0xcad25a31, /0:0:0:0:0:0:0:0:4454] ACTIVE
Jul 27, 2014 2:04:59 AM io.netty.handler.logging.LoggingHandler logMessage
INFO: [id: 0xcad25a31, /0:0:0:0:0:0:0:0:4454] RECEIVED: [id: 0xff40b8a2, /127.0.0.1:37558 => /127.0.0.1:4454]
Jul 27, 2014 2:04:59 AM net.bounceme.dur.netty.ServerHandler <init>
INFO: starting..
Jul 27, 2014 2:04:59 AM io.netty.channel.DefaultChannelPipeline$TailContext exceptionCaught
WARNING: An exceptionCaught() event was fired, …
Run Code Online (Sandbox Code Playgroud)

java sockets io multithreading netty

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

Glassfish:缺少数据源的驱动程序类的名称

(滚动到结尾以查找与此相关的可能错误.)

这个连接池似乎是正确的,至少ping是成功的,但它是如何由EJB模块实际引用的?

thufir@dur:~$ 
thufir@dur:~$ glassfish-4.1/glassfish/bin/asadmin
Use "exit" to exit and "help" for online help.
asadmin> 
asadmin> list-jdbc-connection-pools
CLI031: Warning: Option "target" is obsolete and will be ignored.
CLI031: Warning: Option "target" is obsolete and will be ignored.
__TimerPool
DerbyPool
SamplePool
connectionPool
legacy_on_glassfish
Command list-jdbc-connection-pools executed successfully.
asadmin> 
asadmin> ping-connection-pool legacy_on_glassfish
Command ping-connection-pool executed successfully.
asadmin> 
asadmin> list-jdbc-resources
jdbc/sample
jdbc/__TimerPool
jdbc/__default
jdbc/local
jdbc/legacy_resource
Command list-jdbc-resources executed successfully.
asadmin> 
Run Code Online (Sandbox Code Playgroud)

(我不知道如何用asadmin输出jdbc连接属性)

使用Netbeans向导,这是生成的persistence.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> …
Run Code Online (Sandbox Code Playgroud)

netbeans connection-pooling jdbc glassfish java-ee

3
推荐指数
2
解决办法
8407
查看次数

欢迎文件配置替代 web.xml

没有的情况下web.xml,欢迎文件配置在哪里?

背景:

10.10 欢迎文件

Web 应用程序开发人员可以在 Web 应用程序部署描述符中定义称为欢迎文件的部分 URI 的有序列表。

Java Servlet 规范版本 3.0 修订版 2010 年 12 月

我正在使用 Netbeans 8,但没有意识到web.xml现在的职责主要是通过注释完成的。但是,我似乎找不到与欢迎文件相关的注释。目前,index.html负载,我想将其重新配置为foo.jsp. 可以在不创建文件的情况下完成此操作吗web.xml

也可以看看:

/sf/answers/1352222931/

更新:

我补充道:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>foo.jsp</welcome-file>
    </welcome-file-list>
</web-app>
Run Code Online (Sandbox Code Playgroud)

asweb.xml并且它工作得很好 - 但希望在没有xml.

jsp netbeans web.xml servlets jakarta-ee

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

Gradle:找不到提供的方法()(组)

provided当这是Maven 指定的语法时,为什么Gradle找不到方法?

thufir@doge:~/NetBeansProjects/gradleEAR$ 
thufir@doge:~/NetBeansProjects/gradleEAR$ gradle clean

FAILURE: Build failed with an exception.

* Where:
Build file '/home/thufir/NetBeansProjects/gradleEAR/build.gradle' line: 40

* What went wrong:
A problem occurred evaluating root project 'gradleEAR'.
> Could not find method provided() for arguments [{group=javax, name=javaee-api, version=7.0}] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 8.684 secs
thufir@doge:~/NetBeansProjects/gradleEAR$ 



plugins {
    id …
Run Code Online (Sandbox Code Playgroud)

ear ejb java-ee gradle maven

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

使用 mainClassName 中的 gradle 设置 Main-Class 标头

如何获取从变量jar设置标题的任务?Main-ClassmainClassName

thufir@dur:~/NetBeansProjects/props$ 
thufir@dur:~/NetBeansProjects/props$ gradle clean assembleDist;java -jar build/libs/props.jar 

BUILD SUCCESSFUL in 1s
6 actionable tasks: 6 executed

Publishing build scan...
https://gradle.com/s/qwirajeu4guhq

no main manifest attribute, in build/libs/props.jar
thufir@dur:~/NetBeansProjects/props$ 
thufir@dur:~/NetBeansProjects/props$ cat build.gradle 
plugins {
    id 'com.gradle.build-scan' version '1.8' 
    id 'java'
    id 'application'
}

buildScan {
    licenseAgreementUrl = 'https://gradle.com/terms-of-service'
    licenseAgree = 'yes'
}

buildScan {
    publishAlways()
}

sourceCompatibility = 1.9
targetCompatibility = 1.9

mainClassName = 'net.bounceme.dur.props.Main'

jar {
    manifest {
//    attributes 'Main-Class': mainClassName
    attributes 'Class-Path': configurations.compile.collect { …
Run Code Online (Sandbox Code Playgroud)

java jar manifest.mf gradle build.gradle

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

卷和分区有什么区别?

分区和卷有什么区别?

如果可能的话,请给出一个类比,因为我无法理解它们之间的区别。

storage

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

如何添加 Gradle Kotlin 依赖编译组:'org.seleniumhq.selenium'?

使用?添加 Selenium为依赖项的语法是Gradle Kotlin DSL什么?

错误:

thufir@dur:~/NetBeansProjects/HelloKotlinWorld$ 
thufir@dur:~/NetBeansProjects/HelloKotlinWorld$ gradle clean

> Configure project :
e: /home/thufir/NetBeansProjects/HelloKotlinWorld/build.gradle.kts:18:18: Expecting an element
e: /home/thufir/NetBeansProjects/HelloKotlinWorld/build.gradle.kts:18:20: Unexpected tokens (use ';' to separate expressions on the same line)
e: /home/thufir/NetBeansProjects/HelloKotlinWorld/build.gradle.kts:18:5: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: 
public val NamedDomainObjectContainer<Configuration>.compile: NamedDomainObjectProvider<Configuration> defined in org.gradle.kotlin.dsl

FAILURE: Build failed with an exception.

* Where:
Build file '/home/thufir/NetBeansProjects/HelloKotlinWorld/build.gradle.kts' line: 18

* What went wrong:
Script compilation errors:

  Line 18: …
Run Code Online (Sandbox Code Playgroud)

selenium dependencies gradle kotlin gradle-kotlin-dsl

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

如何为 Netbeans 启用 gradle?

我启用了 groovy options > miscellaneous,但没有看到 gradle 的插件。如何为 Netbeans 11 启用 gradle?

也可以看看:

Netbeans 11 支持 grails 吗?

groovy plugins netbeans gradle netbeans-11

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