小编Bry*_*yan的帖子

如何使用LEFT OUTER JOIN创建JPA查询

我开始学习JPA,并基于我在SQL Server中测试的以下本机SQL实现了JPA查询的示例:

SELECT f.StudentID, f.Name, f.Age, f.Class1, f.Class2 
FROM Student f 
    LEFT OUTER JOIN ClassTbl s ON s.ClassID = f.Class1 OR s.ClassID = f.Class2
WHERE s.ClassName = 'abc'
Run Code Online (Sandbox Code Playgroud)

从上面的SQL我构建了以下JPQL查询:

SELECT f FROM Student f LEFT JOIN f.Class1 s;
Run Code Online (Sandbox Code Playgroud)

如您所见,我仍然缺少OR s.ClassID = f.Class2原始查询的条件.我的问题是,我怎样才能把它放到我的JPQL中?

java jpa jpql

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

Ipad +如何防止键盘在jquery datepicker上弹出

我想从我的Ipad禁用键盘弹出窗口,所以我做了这样的事情,但这不是我的愿望.

我有一个文本框:

<h:inputText id="txtDate" value="#{myDateController.selected.DOB}"
Run Code Online (Sandbox Code Playgroud)

我尝试使用"readonly"属性,但数据无法保存到数据库.我也用这个:$("#frmEdit \:txtDate").attr("disabled",true) - >但是不行

我在网上搜索并使用此链接应用我的代码,但它也不行:ipad web应用程序:如何防止键盘弹出jquery datepicker

$(function() {
  //$("#frmEdit\\:txtDate").attr("disabled", true)
    $("#frmEdit\\:txtDate").datetimepicker({
     // showOn: "button"
        showOn: "both",   
        buttonImage: "../images/calendar.png",
        buttonImageOnly: true,
        constrainInput: true,
        showButtonPanel: true,         
        dateFormat: 'dd-M-yy',
        addSliderAccess: true,
        sliderAccessArgs: { touchonly: false },
    onClose: function(dateText, inst){ 
        $(this).attr("disabled", false);
    },
    beforeShow: function(input, inst){
        $(this).attr("disabled", false);
    }
});
});
Run Code Online (Sandbox Code Playgroud)

我的代码出了什么问题?或任何其他解决方案吗?非常感谢

jquery ipad jquery-ui-datepicker

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

我该如何验证selectOneMenu的价值?

我正在验证我的表单,我可以获得textbox的值,但总是在uiClass变量(Error: java.lang.NullPointerException)中检索null值:有什么建议吗?

例外:

WARNING: /jsf/report/Edit.xhtml @39,99 listener="#{studentController.validate}": java.lang.NullPointerException
javax.el.ELException: /jsf/report/Edit.xhtml @39,99 listener="#{studentController.validate}": java.lang.NullPointerException
    at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:111)
    at com.sun.faces.facelets.tag.jsf.core.DeclarativeSystemEventListener.processEvent(EventHandler.java:131)
    at javax.faces.component.UIComponent$ComponentSystemEventListenerAdapter.processEvent(UIComponent.java:2464)
    at javax.faces.event.SystemEvent.processListener(SystemEvent.java:106)
    at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2168)
    at com.sun.faces.application.ApplicationImpl.invokeComponentListenersFor(ApplicationImpl.java:2116)
    at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:288)
    at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:246)

Caused by: java.lang.NullPointerException
    at entities.StudentController.validate(StudentController.java:163)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)  

@ManagedBean()
@SessionScoped
public class StudentController implements Serializable {
    public void validate(ComponentSystemEvent event) {
        FacesContext fc = FacesContext.getCurrentInstance();
        UIComponent components = event.getComponent();

        UIInput uiName = (UIInput) components.findComponent("frmStudent:name");
        UIInput uiClass = (UIInput) components.findComponent("frmStudent:myclass");

        String name = uiName.getLocalValue().toString(); …
Run Code Online (Sandbox Code Playgroud)

jsf-2

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

如何防止Primefaces的日历文本框中的用户输入数据

在我的代码中,我使用Primefaces的日历

<p:calendar id="cal" value="#{accountController.selected.mydate}" styleClass="custom" pattern="dd-MMM-yyyy HH:mm" />
Run Code Online (Sandbox Code Playgroud)
  • 如果我使用其他模式,例如:pattern ="dd/MM/yyyy HH:mm",pattern ="dd-MM-yyyy HH:mm"等等==>用户无法在日历文本框中输入数据.
  • 但是如果我使用pattern ="dd-MMM-yyyy HH:mm"==>用户可以在日历文本框中输入数据.

所以我想问:如果我使用pattern ="dd-MMM-yyyy HH:mm",如何防止日历文本框中的用户输入数据?

在Primefaces中有任何与Richfaces的enableManualInput属性等效的属性吗?

谢谢你的帮助

jsf primefaces

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

标签 统计

ipad ×1

java ×1

jpa ×1

jpql ×1

jquery ×1

jquery-ui-datepicker ×1

jsf ×1

jsf-2 ×1

primefaces ×1