例如,Mojarra v2.1.29-redhat-1是否意味着正在使用JSF 2.1?
我在https://javaserverfaces.java.net/上找不到明确的信息
对于其他RedHat(显然还有其他供应商的)产品,版本号之间存在脱节,例如JBoss企业应用平台(EAP)和JBoss应用服务器(AS)之间的断开,所以我想确定.
如果你知道答案,你是怎么做到的?
在搜索框中,用户输入一个词,如“iPhone”,点击“搜索”,系统进行后台搜索,返回“iPhone”的所有信息。最后还通过wordController.related变量输出一个相关的词“iPod”。如果用户点击“iPod”链接,系统需要将iPod作为另一个词进行搜索,并再次返回结果。我的问题是,如何将“iPod”(“相关”变量)作为另一个搜索变量传递并执行后端搜索?这一次,它不是通过 h:inputText 和 h:commandButton,因为它不是用户输入的值。
感谢您的帮助!
<h:form id="wordForm">
<h:panelGrid columns="3">
<h:outputLabel for="word">Enter a word:</h:outputLabel>
<h:inputText id="word"
value="#{wordController.word}" />
<h:message for="word" />
</h:panelGrid>
<h:commandButton id="search" value="Search!"
action="#{wordController.info}" />
</h:form>
<br />
<h:outputText value="#{wordController.wordInfo}"
rendered="#{not empty wordController.wordInfo}" />
<h:link value="#{wordController.related}" />
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用PHP中的以下函数获取给定子类别的父类别.
require_once("Connection.php");
$flag=true;
function get_parent_id($cat_id, $parent_id)
{
if ($parent_id==0)
{
return($cat_id);
}
else if ($flag==true)
{
$data1=mysql_query("select parent_id from category where cat_id=" + $cat_id);
while($row = mysql_fetch_assoc($data1))
{
$parent_id=$row['parent_id'];
}
$flag = false;
}
else if ($flag==false)
{
$data2=mysql_query("select cat_id from category where cat_id=" + $parent_id);
while($row = mysql_fetch_assoc($data2)) //The warning comes from here.
{
$cat_id=$row['cat_id'];
}
$flag = true;
}
$cat_id = get_parent_id($cat_id, $parent_id);
return($cat_id);
}
}
echo get_parent_id($ed_id, $parent_id); //Call the above function.
Run Code Online (Sandbox Code Playgroud)
它总是会提示以下警告.
Warning: mysql_fetch_assoc(): supplied argument …Run Code Online (Sandbox Code Playgroud) 以下两种方法可以很好地编译并完成它们的功能.
public int returnArray()[]
{
int a[]={1 ,2};
return a;
}
public String[] returnArray(String[] array[])[]
{
return array;
}
Run Code Online (Sandbox Code Playgroud)
根据这个方法签名,我们不能以某种方式有如下方法签名吗?
public <T>List rerurnList(List<T> list)<T>
{
return new ArrayList<T>();
}
Run Code Online (Sandbox Code Playgroud)
此方法旨在返回java.util.List泛型类型.它不编译.必须按如下方式对其进行修改才能成功编译.
public <T>List<T> rerurnList(List<T> list)
{
return new ArrayList<T>();
}
Run Code Online (Sandbox Code Playgroud)
在这种情况下,我们不能像第一种情况那样有方法签名吗?
我在AP计算机科学,我们刚刚学会了如何使用我们自己的静态方法.这是我使用它们的第二个程序,但这次涉及数组,我的输出非常奇怪.我希望有人可以帮我找出原因,我认为我没有正确返回结果数组.
该程序的目的是计算太阳系中所有行星的表面重力.我需要帮助的两件事是:
printf(),这真的搞砸了.[D@7248989f每个数字,我无法弄清楚为什么.public static double[] surfaceGravity (double[] r,double[] m) {
double[] g = new double[r.length];
for (int count = 0; count < r.length; count++) {
g[count] = (6.67 * m[count]) / (r[count] * r[count]);
}
return g;
}
public static void printIntro() {
System.out.printf("%8s%17s%12s%12s%n","Planet","Diameter (km)","Mass (kg)","g (m/s^2)");
System.out.println("-------------------------------------------------------------------");
}
public static void printData(String[] planet, double[] r, double[] m, double[] g) {
for (int count = 0; count < r.length; count++) {
System.out.printf("%9s%9.0f%17.6f%12.2f%n",planet[count],(r[count] * 2),m[count],g[count]); …Run Code Online (Sandbox Code Playgroud) 我正在尝试编写一个处理地震和震级的小程序.
程序运行时,它会要求用户输入一个数字,表示用户想要提交的地震数量.根据响应,程序然后提示用户输入每次地震的幅度.我在下面写了下面的代码但是遇到了麻烦for loop.
显然在for循环中,i <= numberOfEarthquakes不允许程序正确编译.什么是给出i与用户输入的数字相关的条件的简单方法.非常感谢.
(这是我希望写的更大程序的一小部分)
import java.util.*;
public class Earthquakes {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
System.out.print("How many magnitudes will you enter? ");
String numberOfEarthquakes = console.next();
for (int i = 1; i <= numberOfEarthquakes; i++) {
System.out.print("Enter magnitude for earthquake " + i);
String magnitudeOfEarthquake = console.next();
}
}
}
Run Code Online (Sandbox Code Playgroud) 所以我有一个代码,将打印一个二维数组的表.我遇到的问题是我完全不知道如何繁殖并找到数组的乘积.任何帮助表示赞赏.谢谢
public class MultiplyingArrays {
public static void main(String[] args) {
int firstarray[][] = {{1, 2, -2, 0}, {-3, 4, 7, 2}, {6, 0, 3, 1}};
int secondarray[][] = {{-1, 3}, {0, 9}, {1, -11}, {4, -5}};
System.out.println("This is the first array");
display(firstarray);
System.out.println("This is the second array");
display(secondarray);
}
public static void display(int x[][]) {
for (int row = 0; row < x.length; row++) {
for (int column = 0; column < x[row].length; column++) {
System.out.print(x[row][column] + "\t");
} …Run Code Online (Sandbox Code Playgroud) 关于以下代码片段,我有一个非常简单的问题.
public class SuperClass {
public SuperClass() {
this.test(); //Always invokes the overridden method in the sub-class.
}
public void test() {
System.out.println("test() in SuperClass.");
}
}
public final class SubClass extends SuperClass {
public SubClass() {
super();
}
@Override
public void test() {
System.out.println("test() in SubClass.");
}
}
public final class Test {
public static void main(String... args) {
SubClass subClass=new SubClass();
}
}
Run Code Online (Sandbox Code Playgroud)
在此示例中,方法中的唯一行main()间接地将调用传递给超类构造函数,在该构造函数中,它尝试将test()方法调用为this.test().
this.test()但是,在超类构造函数中调用的方法是重写的方法SubClass.
为什么this.test() …
我有这个以下的程序,我想有一个循环,询问用户是否他想再次播放,如果他想要该程序或播放重新开始.
import java.util.*;
public class Crapl {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
double budget;
int toGo = 1;
while (toGo == 1) {
Scanner input = new Scanner(System.in);
System.out.print("What is your budget");
budget = input.nextDouble();
play(budget);
}
}
// rool method
public static int roll() {
Random ran = new Random();
int dice1, dice2;
dice1 = ran.nextInt(6) + 1;
dice2 = ran.nextInt(6) + 1;
System.out.printf("\tYou rolled %d+%d=%d\t", dice1, dice2, dice1 …Run Code Online (Sandbox Code Playgroud) 好像标题所说,我必须转换double[]为a long[]但我不知道我该怎么做.
我试试这个:
double[] ids = getIds(); // The ids I'm getting return in double format
List<Long> myArray = new ArrayList<Long>();
for (double _ids : ids) {
myArray.add((long)_ids);
}
System.out.println(myArray); // Works! the list is now long, I can print also in myArray.toArray()
// Now I need pass this on a long[] array for the system wich request the data
// Receive "getStringsById(String string, long... Ids)"
Run Code Online (Sandbox Code Playgroud)
我非常感谢你的帮助.
谢谢你的时间.
java ×7
arrays ×2
jsf ×2
methods ×2
double ×1
generic-list ×1
inheritance ×1
long-integer ×1
matrix ×1
mojarra ×1
php ×1
printf ×1
recursion ×1