小编Law*_*ong的帖子

错误:javax.el.PropertyNotFoundException:目标无法访问,'null'返回null

我在运行JSF页面时遇到了这个错误.

javax.el.PropertyNotFoundException:目标无法访问,'null'返回null ..

警告:/createStaff.xhtml @ 33,125 value ="#{staffBean.staff.firstName}":目标无法访问,'null'返回null javax.el.PropertyNotFoundException:/createStaff.xhtml @ 33,125 value ="#{staffBean.staff. firstName}":目标无法访问,'null'返回null

我不明白为什么我在使用value =时会遇到错误"#{staffBean.staff.firstName}".当我使用value = "#{staffBean.userName}"和value = "#{staffBean.passWord}"above 时没有问题.

这是我的createStaff.xhtml

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>Create Staff</title>
    </h:head>
    <h:body>
        <f:view>
            <h:form>
                <p:panel id ="panel" header="Staff Creation">
                    <p:messages id="msgs" />
                    <h:panelGrid columns="3" columnClasses="label, value">
                        <h:outputText value="Username: *" />
                        <p:inputText id="username" value="#{staffBean.userName}"   required="true" label="Username">
                        </p:inputText>
                        <p:message for="username" />

                        <h:outputLabel for="pwd1" value="Password 1: *" …
Run Code Online (Sandbox Code Playgroud)

jsf el propertynotfoundexception

11
推荐指数
2
解决办法
5万
查看次数

无法在 Android 中使用 Javascript webview 获取 GPS 坐标

我对 android、java 和 javascript 编码非常陌生。

我正在尝试获取我当前的 GPS 坐标并将其显示在 Android 设备上。我正在使用 webview,大部分代码都是用 javascript 编写的。

但是,当我的应用程序部署在我的 android 设备上时,我的代码无法正常工作,因为显示错误代码 2 的空白屏幕。

我已经浏览了很多网站,但仍然无法解决这个问题。

请问有什么帮助吗?

各种文件的代码位于下面。

地图.js

navigator.geolocation.watchPosition(
    function(position){
        var lat = position.coords.latitude;
        var lng = position.coords.longitude;
        document.getElementById("myPos").innerHTML = "lat?"+lat+"<br>long?"+lng;
    },
    function(error){
        document.getElementById("myPos").innerHTML = "Error Code?"+error.code;
    }
);
setTimeout("window.scrollTo(0,1)", 10);
Run Code Online (Sandbox Code Playgroud)

主文件

body {
    width: 320px;
    height:480px;
    background-color : white;
}
#myMap {
    position : absolute;
    left : 0px;
    top: 0px;
    width: 320px;
    height: 480px;
}
Run Code Online (Sandbox Code Playgroud)

主活动.java

package com.example.midnightmap;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import …
Run Code Online (Sandbox Code Playgroud)

javascript java gps android webview

5
推荐指数
1
解决办法
3871
查看次数

无法使用Selenium WebDriver在Chrome中加载默认配置文件

我正在使用Selenium WebDriver在需要http身份验证的页面上执行某些操作。

我已经登录了我的默认配置文件。但是硒chromedriver会为每次使用自动使用新的配置文件,因此我无法通过身份验证阶段。

因此,我正在考虑在Selenium WebDriver for Chrome上使用我的默认配置文件(具有帐户登录权限)。

即使我使用以下代码,默认配置文件似乎也没有加载到Chrome中

ChromeOptions options = new ChromeOptions();

options.AddArguments("user-data-dir=C:/Users/user_name/AppData/Local/Google/Chrome/User Data/Default");   


IWebDriver driver = new ChromeDriver(@"C:\Users\Lawrence\Desktop\selenium-dotnet-2.33.0\net40",options);
Run Code Online (Sandbox Code Playgroud)

有什么帮助吗?=)

c# selenium selenium-chromedriver selenium-webdriver

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

CLONE_VM未声明(首次使用此功能)

我在linux c中使用克隆功能.

但是,当我尝试编译代码时,我遇到了错误CLONE_VM未声明(在此函数中首次使用).

我去google寻求解决方案,其中一个提到的网站#include <sched.h>必须包含在代码中.我已经包含#include <sched.h>在我的代码中,但编译错误仍然存​​在.

有帮助吗?:)

int c = clone(child,p+STACKSIZE-1,CLONE_VM|SIGCHLD,NULL) ;
Run Code Online (Sandbox Code Playgroud)

c linux clone

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

实体表未使用JPA 2.1创建

我正在Netbeans中使用JPA 2.1创建我的实体。如果我的数据库没有表,那么它应该从实体创建表。

当我部署并运行企业应用程序时,userEntity表不会出现在mySQL数据库中。

这里有什么帮助吗?:)

以下是我的代码。

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">
  <persistence-unit name="CommonInfrastructure-ejbPU" transaction-type="JTA">
    <jta-data-source>jdbc/commonInfraDatasource</jta-data-source>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
      <property name="javax.persistence.schema-generation.database.action" value="create"/>
    </properties>
  </persistence-unit>
</persistence>
Run Code Online (Sandbox Code Playgroud)

userEntity.java

package entity;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

@Entity
public class userEntity implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long systemUserId;
    private String userName;
    private String password;
    private String email;
    private int activateStatus;
    private String accessGroup;
    private int lockOutStatus;



    @Override
    public int hashCode() {
        int hash = …
Run Code Online (Sandbox Code Playgroud)

java netbeans jpa ejb-3.0 jpa-2.1

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

Java Formatter 收据打印问题

我正在设计一张收据,以便使用 PrinterJob 类在 Java 中打印出来。

我需要一些建议。

基于我在这里看到的例子。

http://www.javadocexamples.com/java_source/__/re/Receipt.java.html

如何将上面示例中给出的输出存储在 jTextPanel 中?然后,我将使用 PrinterJob 类打印出 jTextPanel 内的文本内容。

当我从 POS 打印机打印出 jTextPanel 内的文本内容时,我希望获得以下输出。

在此输入图像描述

以下是我迄今为止所拥有的代码。

String s = String.format("Item Qty Price", "%-15s %5s %10s\n");
        String s1 = String.format("---- --- -----","%-15s %5s %10s\n");
        String output = s + s1;

        jTextPane1.setText(output);

        PrinterJob printerJob = PrinterJob.getPrinterJob();
        PageFormat pageFormat = printerJob.defaultPage();
        Paper paper = new Paper();
        paper.setSize(180.0, (double) (paper.getHeight() + lines * 10.0));
        paper.setImageableArea(margin, margin, paper.getWidth() - margin * 2, paper.getHeight() - margin * 2);
        pageFormat.setPaper(paper);
        pageFormat.setOrientation(PageFormat.PORTRAIT);
        printerJob.setPrintable(jTextPane1.getPrintable(null, …
Run Code Online (Sandbox Code Playgroud)

java formatter point-of-sale receipt

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

HiC:结构内的结构?

这是我第一次在结构中使用结构.编译程序时遇到此错误.错误:字段'结果'的类型不完整.

错误是指这行代码. - > struct result_t results;

有什么帮助吗?:) 谢谢.

typedef struct {
char moduleCode[8];
char grade[3];
} result_t;

typedef struct {
char name[31];
struct result_t results;
} student_t;
Run Code Online (Sandbox Code Playgroud)

编辑:

我改变了我的代码:

typedef struct {
char moduleCode[8];
char grade[3];
} result_t;

typedef struct {
char name[31];
result_t results;
} student_t;
Run Code Online (Sandbox Code Playgroud)

我收到了一个新的编译错误.错误:下标值既不是数组也不是指针.

触发该错误的代码行如下.printf("% - 7s%-2s%d \n",student.results [i] .module_code,student.results [i] .grade,student.results [i] .mc);

c compiler-errors structure

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

如何确定一个数字中的小数位数?

我正在用C写一个程序.

有没有确定一个浮点数(即小数的个数任何方式0.123 = 3,0.123456 = 6等等)?

除了将数字转换为字符串并使用字符串函数来拉小数位后的字符?

我有一个名为computeFare()的函数

float computeFare()
{
  totalFare =  (3.40 + basicFare) * (1 + surchargePercent);
  return totalFare; // **in this case totalFare = 34.567**
}

printf("Total fare is $%.2f\n", 
            computeFare());
Run Code Online (Sandbox Code Playgroud)

结果:总票价为34.56美元

我这样做了它返回34.56 ......我希望它是34.57美元

谢谢,劳伦斯.

c decimal

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

C输出格式问题

我在C中输出格式有一些问题.请参阅下面的图片了解我的输出

见图

我希望我的输出如下

输入字词:KayaK

皮划艇是一个回文.

    // palindrome.c
    #include <stdio.h>
    #include <string.h>
    #include <ctype.h>
    #define MAXLEN 20

    int isPalindrome(char [], int);

    int main(void) {
    char word[MAXLEN+1];
    int size;

    printf("Enter word: ");
    fgets(word,MAXLEN+1,stdin);
    size = strlen(word);
    if (isPalindrome(word, size-1)) //size - 1 because strlen includes \0
   {
    printf("%s is a palindrome.\n",word);
   }
   else
   {
    printf("%s is not a palindrome.\n",word);
   }
   return 0;
   }

 int isPalindrome(char str[], int size) {
int i;
for (i = 0; i < size; i++)
{
    if (tolower(str[i]) != …
Run Code Online (Sandbox Code Playgroud)

c formatting output

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