我在http://docs.jquery.com/Plugins/Authoring上定义了我的插件
(function( $ ){
var methods = {
init : function( options ) { },
show : function( options ) { },
hide : function( ) { },
update : function( content ) {
// How to call the show method inside the update method
// I tried these but it does not work
// Error: not a function
this.show();
var arguments = { param: param };
var method = 'show';
// Error: options is undefined
methods[ method …Run Code Online (Sandbox Code Playgroud) 我有一个抽象类定义为:
public abstract class TCV<T extends MF> {
public Map<String, MVR<T>> operation() {
...
}
}
Run Code Online (Sandbox Code Playgroud)
主要代码:
TCV<? extends MF> o = new TCVConcrete();
Map<String, MVR< ? extends MF>> map = o.operation();
Run Code Online (Sandbox Code Playgroud)
日食错误:
Type mismatch: cannot convert from Map<String,MVR<capture#5-of ? extends MF>> to Map<String,MVR<? extends MF>>
编辑
public class TCVConcrete extends TCV<MFV2> {
}
public class MFV2 extends MF {
}
Run Code Online (Sandbox Code Playgroud) 我想根据几个文件的存在激活一个配置文件.在下面的例子中,我想配置文件将被激活,如果这两个文件my.marker和another.marker存在.
<activation>
<file>
<exists>${basedir}/my.marker</exists>
<exists>${basedir}/another.marker</exists>
</file>
</activation>
Run Code Online (Sandbox Code Playgroud)
它不起作用,因为它对模式无效.有没有办法在不使用命令行属性的情况下做这样的事情?
我有一个无状态的控制器,负责处理表格.这被定义为ApplicationScoped.在我的页面上,我有一个与支持bean关联的表单定义为a ViewScoped.
我想处理表单时遇到的错误:
serverError: class com.sun.faces.mgbean.ManagedBeanCreationException Unable to create managed bean myController. The following problems were found:
- The scope of the object referenced by expression #{myFormBean}, view, is shorter than the referring managed beans (myController) scope of application
Run Code Online (Sandbox Code Playgroud)
在我的形式:
Name: <h:inputText value="#{myFormBean.name}" id="name" />
<h:commandButton value="Save Name" action="#{myController.processForm}">
<f:ajax render="nameResult" />
</h:commandButton>
Your name is <h:outputText value="#{myFormBean.name}" id="nameResult"/>
Run Code Online (Sandbox Code Playgroud)
控制器:
@ManagedBean
@ApplicationScoped
public class MyController {
@ManagedProperty("#{myFormBean}")
private MyFormBean myBean;
public void processForm() {
System.out.println(myBean.getName());
// Save …Run Code Online (Sandbox Code Playgroud) 我需要解析一个XSD,XSOM但这个XSD包含循环导入.
A.xsd
<xs:schema xmlns=”ns1” targetNamespace=”ns1”>
<xs:import namespace=”ns2” schemaLocation=”B.xsd”/>
<xs:element name=”MyElement” type=”xs:string”/>
</xs:schema>
Run Code Online (Sandbox Code Playgroud)
B.xsd
<xs:schema xmlns=”ns2” targetNamespace=”ns2” xmlns:ns1=”ns1”>
<xs:import namespace=”ns1” schemaLocation=”A.xsd”/>
<xs:complexType name="MyComplex">
<xs:sequence>
<xs:element ref="ns1:MyElement" minOccurs="0"/>
<xs:sequence>
<xs:complexType>
</xs:schema>
Run Code Online (Sandbox Code Playgroud)
XSOM无法解析模式,因为它检测到由于循环导入而已定义的元素.所以我试图通过外化由A定义并在B中使用的元素来打破循环导入.
C.xsd包含A使用的元素B.请注意,这些元素不在A中使用.不要问我为什么在A中定义了这些元素.
<xs:schema xmlns=”ns1” targetNamespace=”ns1”>
<xs:element name=”MyElement” type=”xs:string”/>
</xs:schema>
Run Code Online (Sandbox Code Playgroud)
A.xsd成了
<xs:schema xmlns=”ns1” targetNamespace=”ns1”>
<xs:import namespace=”ns2” schemaLocation=”B.xsd”/>
</xs:schema>
Run Code Online (Sandbox Code Playgroud)
B.xsd(导入C.xsd而不是A.xsd)成为
<xs:schema xmlns=”ns2” targetNamespace=”ns2” xmlns:ns1=”ns1”>
<xs:import namespace=”ns1” schemaLocation=”C.xsd”/>
<xs:complexType name="MyComplex">
<xs:sequence>
<xs:element ref="ns1:MyElement" minOccurs="0"/>
<xs:sequence>
<xs:complexType>
</xs:schema>
Run Code Online (Sandbox Code Playgroud)
XSOM可以解析XSD.但现在我无法使用以下代码创建架构:
SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
sf.setResourceResolver(new MyResourceResolver());
Run Code Online (Sandbox Code Playgroud)
我使用与JDK 1.7捆绑在一起的标准实现.我得到了例外:
src-resolve: Cannot resolve the …Run Code Online (Sandbox Code Playgroud) 我尝试使用requirejs和async插件加载适用于JavaScript的Google API客户端库:
require.config({
paths : {
async : '../lib/requirejs/async'
},
waitSeconds: 60
});
define('gapi', ['async!https://apis.google.com/js/client.js!callback'],
function(){
console.log('gapi loaded');
return gapi.client;
}
);
require(['gapi'], function(){
console.log("Callback");
console.log(gapi);
});
Run Code Online (Sandbox Code Playgroud)
加载此库的常用方法是
<script src="https://apis.google.com/js/client.js?onload=handleClientLoad"></script>
Run Code Online (Sandbox Code Playgroud)
一切都在不到2秒内加载,但我总是得到这个错误:
Uncaught Error: Load timeout for modules: async!https://apis.google.com/js/client.js!callback_unnormalized2,async!https://apis.google.com/js/client.js!callback
http://requirejs.org/docs/errors.html#timeout
Run Code Online (Sandbox Code Playgroud) 我想在对话框中显示复合组件.它工作但是如何从复合组件关闭该对话框.
<p:commandButton value="Display Data Value Assertion Dialog" onclick="dlg2.show();" type="button"/>
<p:dialog header="Modal Dialog" widgetVar="dlg2" modal="true" height="600" width="800">
<tcmt:DataValueAssertion managedBean="#{dataValueAssertionController}"/>
</p:dialog>
Run Code Online (Sandbox Code Playgroud)
在我的复合组件中:
<h:commandButton value="Save Assertions">
<f:ajax listener="#{datatypeAssertionController.saveDatatypeAssertion}"></f:ajax>
</h:commandButton>
<h:commandLink value="Close">
<f:ajax listener="#{datatypeAssertionController.closeDatatypeAssertion}"></f:ajax>
</h:commandLink>
Run Code Online (Sandbox Code Playgroud)
单击"保存"时,我希望能够保存数据并关闭对话框.单击取消时,我只想关闭对话框而不保存.两者saveDatatypeAssertion和closeDatatypeAssertion方法都是占位符.我需要找到一种方法来获取对话框的引用dlg2,然后hide()在其上调用方法.
我有一个HQL查询的问题.我希望将管理性别设置为"M"或没有管理性的所有PID(在Java中将值设置为null).
PID.class
@Entity
@Table(name = "PatientIdentification")
public class PID {
@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "administrativeSex", referencedColumnName = "is_id")
private IS administrativeSex;
...
}
Run Code Online (Sandbox Code Playgroud)
IS.class
@Entity
@Table(name = "CodedValueForUserDefinedTables")
public class IS {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "is_id")
private Integer id;
private String value;
...
}
Run Code Online (Sandbox Code Playgroud)
HQL查询
from PID where administrativeSex is null or administrativeSex.value = 'M'
Run Code Online (Sandbox Code Playgroud)
生成的SQL
select
pid0_.pid_id as pid1_84_,
pid0_.administrativeSex as adminis11_84_,
pid0_.birthOrder as birthOrder84_,
pid0_.birthPlace as birthPlace84_,
pid0_.citizenship as citizen12_84_,
pid0_.countyCode as countyCode84_,
pid0_.dateTimeOfBirth …Run Code Online (Sandbox Code Playgroud) 我有以下类层次结构:
public interface Message
public interface V2Message extends Message
public interface V3Message extends Message
Run Code Online (Sandbox Code Playgroud)
我定义了另一个接口来验证消息。
public interface Validation {
boolean validate(Message message);
}
Run Code Online (Sandbox Code Playgroud)
实现的每个类都Validation可以处理 V2 和/或 V3 消息,因此在我的实现中,我必须区分要验证的消息类型,因为代码会有所不同。
public class MyValidation implements Validation {
public boolean validate(Message message) {
if(message instanceof V2Message) {
return validateV2((V2Message)message);
} else if (message instanceof V3Message) {
return validateV3((V3Message)message);
}
}
Run Code Online (Sandbox Code Playgroud)
我想知道是否有办法删除instanceof.
我希望我的表格中的文字能够自动换行.约束是我无法更改HTML,因为它是由服务器生成的.
我创建了一个JSFiddle
万一它不工作:
<div style="width: 25%">
<table class="af_selectManyCheckbox" id="pt1:r1:1:smc1" cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr>
<td class="af_selectManyCheckbox_label" valign="top"/>
<td valign="top" class="AFContentCell" nowrap="">
<div class="af_selectManyCheckbox_content">
<div>
<span class="af_selectManyCheckbox_content-input">
<input class="af_selectManyCheckbox_native-input" type="checkbox" value="0"/>
</span>
<label class="af_selectManyCheckbox_item-text">It allows a component to partially refresh another component whose partialSubmit property is set to true.</label>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
Run Code Online (Sandbox Code Playgroud)