小编Ket*_*tan的帖子

JSF - 在单个方法中检查null和empty

目前我的代码就像

<h:panelGroup rendered="#{templatePrescriptionMaintenanceBackingBean.allSelectedMedicationList != null && !empty templatePrescriptionMaintenanceBackingBean.allSelectedMedicationList}">
        <b>List of Selected Drugs</b> // and some other stuff
</h:panelGroup> 
Run Code Online (Sandbox Code Playgroud)

现在allSelectedMedicationList将在后端做很多过程.调用webservice并在当前数据库中添加数据等等......

现在问题出现在我需要检查nullempty- 这次调用的方法的2倍.再次当我使用相同的方法与数据表时,它将再次调用1次.我想为JSF自己创建一个方法或东西,它将检查nullempty同时返回列表.可能吗?

java jsf

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

a4j:commandLink with onClick返回true或false不正常工作

我的代码如下,

<a4j:commandLink  oncomplete="openSignatureModel();" id="requestText"  reRender="sigPassword"  title="Send Prescription"
actionListener="#{patientNotePresBackingBean.sendPrescriptionId}"
onclick="return pharmacyCheck('#{row}');"> 
<f:param name="sendPrescriptionId" value="#{patientNotePrescriptionVar.id}" />
<f:param name="processOfPrescription" value="Send" />
<h:graphicImage value="/images/send-prescribe.png" style="border:0;"></h:graphicImage>
</a4j:commandLink>
Run Code Online (Sandbox Code Playgroud)

我的java脚本就像......

function pharmacyCheck(rowID) {
    var a = document.getElementById("prescriptionId:patientNotePresListId:"+rowID+":pharmacyRcopiaId");
    if(a.value == -1) {
        alert("Please select Pharmacy");
        return false;
    } else {
        return true;
    }

}
Run Code Online (Sandbox Code Playgroud)

实际上当它返回true时它应该调用patientNotePresBackingBean.sendPrescriptionId 对吗?

但它没有相同的说法......有什么理由吗?

java jsf richfaces

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

Hibernate不保存数据

我从一开始就在学习Hibernate.我从RoseIndia下载了hibernated演示.为特定数据库设置hibernate.cfg.xml的配置.并运行下面的代码.指定在上面的表'contact'是自动创建的,但是在代码下面无法保存新记录.下面的代码有什么问题吗?

package roseindia.tutorial.hibernate;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;


/**
 * @author Deepak Kumar
 *
 * http://www.roseindia.net
 * Hibernate example to inset data into Contact table
 */
public class FirstExample {
    public static void main(String[] args) {
        Session session = null;

        try{
            // This step will read hibernate.cfg.xml and prepare hibernate for use
            SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
             session =sessionFactory.openSession();
                //Create new instance of Contact and set values in it by reading them from form object
                System.out.println("Inserting Record");
                Contact contact …
Run Code Online (Sandbox Code Playgroud)

java hibernate

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

使用Java检查给定文件是简单文本文件

我需要将大文本文件导入数据库.该文本文件的结构是预定义的,使用几个分隔符和所有.我只需要检查给定文件是否是文本文件(无论扩展名如何).

如何使用Java?

java

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

java和javascript中的正则表达式

我有一个用Java构建的正则表达式.

String expr = "<a.*?id=\"(pres.*?)\".*?>Discharge.*?Medications:</a>";
Run Code Online (Sandbox Code Playgroud)

我想在Javascript中使用相同的正则表达式.它会有所不同吗?

javascript java regex

0
推荐指数
1
解决办法
1097
查看次数

Query中有什么问题

我试图在下面查询...

它有什么问题吗?

delete from user_role 
WHERE user_id in (
    select u.user_id from user u, user_role ur 
    where u.USER_ID=ur.USER_ID and ur.ROLE_ID=4 and u.USER_ID not in (
        select user_id from referrers));
Run Code Online (Sandbox Code Playgroud)

mysql

0
推荐指数
1
解决办法
64
查看次数

标签 统计

java ×5

jsf ×2

hibernate ×1

javascript ×1

mysql ×1

regex ×1

richfaces ×1