小编Tin*_*iny的帖子

Java 中的大值应该选择哪种数据类型?

Java 中哪种数据类型可以处理最大值?

我必须存储不带逗号的大数字(我还不知道实际大小)。

在 C 中,我认为我会使用类似 unsigned long int 的东西。

Java 中最适合使用什么类型?

java variables double int

-1
推荐指数
1
解决办法
8205
查看次数

使用PrimeFaces验证

我有一个带有一个字段的表单,emai有一个非常简单的验证required = true.现在,当我点击按钮时,它会执行AJAX回调.我想知道无论如何在客户端进行验证而不调用服务器?

<h:form class="lfrm" id="lfrm">
    <p:panel id="lpanel" header="Login">
        <p:messages id="lmessages" showDetail="true" autoUpdate="true"/>

        <h:panelGrid id="lgrid" columns="2" cellpadding="5">
            <h:outputText value="Email: *" />

            <p:inputText styleClass="email"
                         id="lemail"
                         value="#{Registration.user.email}"
                         required="true" requiredMessage="Email is required">
            </p:inputText>

            <p:commandButton process="lemail"
                             value="Sign in"
                             immediate="true"
                             validateClient="true"/>
    </p:panel>
</h:form>
Run Code Online (Sandbox Code Playgroud)

jsf primefaces

-1
推荐指数
1
解决办法
573
查看次数

ManagedBean不声明公共无参数构造函数

我正在使用PrimeFaces 5.0,并希望<p:treeTable>在单击事件后在弹出框中创建内容,但显示以下错误

无法创建托管bean popupTreeTableManagedBean。结果发现以下问题: -托管bean类 beans.PopupTreeTableManagedBean的托管bean popupTreeTableManagedBean不声明一个公共的无参数的构造函数。-管理bean类beans.PopupTreeTableManagedBean的托管bean popupTreeTableManagedBean不声明一个公共的无参数的构造函数。

这是我的代码片段

index.xhtml:

<p:dialog header="" widgetVar="dlg1" minHeight="200">
    <p:treeTable value="#{popupTreeTableManagedBean.root}" var="node" style="" >
        <p:column>
            <f:facet name="header">Name</f:facet>
            <h:outputText value="#{node.name}"></h:outputText>
        </p:column>

        <p:column>
            <f:facet name="header">Value</f:facet>
            <h:inputText value="#{node.value}" style="border-style: hidden;"/>
        </p:column>
    </p:treeTable>
</p:dialog>
Run Code Online (Sandbox Code Playgroud)

PopupTreeTableManagedBean.java

@ManagedBean
@SessionScoped
public class PopupTreeTableManagedBean {

    private TreeNode root = new DefaultTreeNode("Root Node", null);
    List<String> selectedParams;
    TreeNode scanParamsRoot = null;

    PopupTreeTableManagedBean() {
        selectedParams = GenrateScanList.getParamList();
        createRootAndLeafNodes();
    }

    private TreeNode createRootAndLeafNodes() {
        TreeNode scanSubRoot = null;
        int …
Run Code Online (Sandbox Code Playgroud)

jsf constructor managed-bean

-1
推荐指数
1
解决办法
1298
查看次数

返回Java异常

public class TestException {

    int m1() {

        try {
            int i = 10, j = 0;
            System.out.println("s1");
            i = i / j;
            return 11;
        } catch (Exception e) {
            System.out.println("s2");
        } finally {
            System.out.println("s3");
        }

        System.out.println("s4");
        return 2222;
    }

    public static void main(String[] args) {
        System.out.println(new TestException().m1());
    }
}
Run Code Online (Sandbox Code Playgroud)

O/P: -

s1
s2
s3
s4
2222
Run Code Online (Sandbox Code Playgroud)

s3以前为什么s4

finally在方法返回之前不调用?

我在这里错过了什么?

java exception

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

java.sql.SQLException:Io异常:端口号的数字格式无效

package jdbcconnection;

import java.sql.*;

public class Jdbc2{

    public static void main(String[] args) throws Throwable {

        //Resgister the driver through 

         Class.forName("oracle.jdbc.driver.OracleDriver");
         System.out.println("registered driver successfully");
         //Create the connection and assign to connection reference
         Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:CUSTDB", "scott", "tiger");
         System.out.println("connection successsfully");
         //create a statement through connection reference and assign to statement reference
         Statement stmt=con.createStatement();
         System.out.println("statement object created successfully");
         //call the executequery method through statement reference and pass the query as argument.
         ResultSet rs=stmt.executeQuery("select * from emp");

         System.out.println("query is executed");

         while(rs.next()){
             int i=rs.getInt(1);
             String str=rs.getString(2); …
Run Code Online (Sandbox Code Playgroud)

java jdbc ojdbc

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

确定给定数字是否是另一个数字的因子(30)

package cornett1;

import javax.swing.JOptionPane;

public class ProgramOne {

    public static void main(String[] args) {

        int nmbr;
        nmbr = Integer.valueOf(JOptionPane.showInputDialog("enter a number less than 1000"));

        {
            if ((nmbr % 2) == 0) {
                System.out.println(nmbr + "Is even.");
            }
            System.out.println(nmbr + "Is odd.");
        }

        if ((nmbr % 5) == 0) {
            System.out.print(nmbr + "is a multiple of 5.");
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

现在我需要看看是否nmbr是30的因数

java

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

f:查看和丰富:页面:内部还是外部?

<f:view>标签是否应该在标签外面(周围)<rich:page>?还是里面呢?

请注意,我确实想要一个<f:view>标签,因为我想设置locale.

jsf richfaces facelets

-10
推荐指数
1
解决办法
639
查看次数