我对于同一主题提出了另一个问题仍犹豫不决,但至少现在我正在阅读正确的文档.
所以,这堂课:
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?
我右键单击了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?
不幸的是,我不明白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) (滚动到结尾以查找与此相关的可能错误.)
这个连接池似乎是正确的,至少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) 没有的情况下web.xml,欢迎文件配置在哪里?
背景:
10.10 欢迎文件
Web 应用程序开发人员可以在 Web 应用程序部署描述符中定义称为欢迎文件的部分 URI 的有序列表。
Java Servlet 规范版本 3.0 修订版 2010 年 12 月
我正在使用 Netbeans 8,但没有意识到web.xml现在的职责主要是通过注释完成的。但是,我似乎找不到与欢迎文件相关的注释。目前,index.html负载,我想将其重新配置为foo.jsp. 可以在不创建文件的情况下完成此操作吗web.xml?
也可以看看:
更新:
我补充道:
<?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.
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) 如何获取从变量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) 使用?添加 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) 我启用了 groovy options > miscellaneous,但没有看到 gradle 的插件。如何为 Netbeans 11 启用 gradle?
也可以看看:
gradle ×4
netbeans ×4
java ×3
glassfish ×2
java-ee ×2
build.gradle ×1
cdi ×1
dependencies ×1
ear ×1
ejb ×1
facelets ×1
groovy ×1
io ×1
jakarta-ee ×1
jar ×1
jboss-weld ×1
jdbc ×1
jsf ×1
jsp ×1
jtable ×1
kotlin ×1
manifest.mf ×1
maven ×1
netbeans-11 ×1
netbeans-7 ×1
netty ×1
plugins ×1
selenium ×1
servlets ×1
sockets ×1
storage ×1
swing ×1
web.xml ×1