我试图通过定义一个操作方法并将其绑定到组件的“disabled”属性来禁用 jsf 组件。
我的 JSF 组件片段
<h:form id="bulk_sch_form1">
<a4j:commandButton id="alls" value="a. Search records form this company"
action="#{recordsTransferSearch.actionSearch}"
reRender="srtDlGrd, dlod_msg_grd, pending_student_table"
disabled="#{not recordsTransferSearch.isDisabled}">
</a4j:commandButton>
</h:form>
Run Code Online (Sandbox Code Playgroud)
支撑豆作用方法
public boolean isDisabled() {
if (searchResults != null) {
return true;
}
return false;
}
Run Code Online (Sandbox Code Playgroud)
searchResults 仅在返回成功的搜索结果后进行评估。但正如标题中所述,它isDisabled()根本没有调用操作方法,因此什么也没有发生。
仅当我刷新页面时才会调用操作方法。
谢谢。
我得到了这个例外
java.sql.SQLException: Unknown column 'auyu' in 'where clause'
Run Code Online (Sandbox Code Playgroud)
我的数据库外观类中的My Query和方法.
db.save("delete from users where name = auyu");
public static void save(String sql) throws Exception {
new DBFacade().connect();
synchronized (c) {
c.createStatement().executeUpdate(sql);
}
}
Run Code Online (Sandbox Code Playgroud) 这是我的代码片段,但它没有按我想要的方式执行.如果输入是非负/字符值,则第一个if语句成功执行,但如果它是负值则忽略elif语句.问题是什么.我正在使用Python 2.6
from math import sqrt
import cmath
y = raw_input("Enter your number:")
if y.isdigit():
x = int(sqrt(float(y)))
print "Answer is", x
elif y < 0:
print "Negative number", cmath.sqrt(y)
else:
print "Not a valid number"
raw_input("Press <enter> to Exit")
Run Code Online (Sandbox Code Playgroud) 如何在方法本身内测试参数.例如
class TestClass {
public void paraMethod(String para1, String para2) {
String testPara1 = para1;
String testPara2 = para2;
}
}
class TestingClass {
@Test
public void testParaMethod () throws Exception {
String myPara1 = "MyPara1";
String myPara2 = "MyPara2";
new TestClass().paraMethod(myPara1, myPara2);
}
}
Run Code Online (Sandbox Code Playgroud)
好了,才有可能以测试testPara1和testPara2设置正确,以我所传递的价值观?
谢谢.
虽然我正在寻找一个仅使用Javascript实现的模拟时钟的好例子,但我发现这个有趣的时钟由Emanuele Feronato编写,使用一个非常强大的Javascript库Raphaël
我正在玩它一段时间,然后我想在那些时间上有不同时间的多个时钟,可能根据不同的时区,但事实并非如此.
所以我所做的是创建单独的时钟对象并设置不同的时间.它工作但问题出现在脚本遇到setInterval()函数时,它没有真正起作用时钟的手不旋转.
我不是很擅长Javascript内置函数,我找不到解决方案来防止这个问题,无论如何我在这里发布我的代码.
function createClocks(){
/* for the time being assume these Date objects are unique */
var diffDate_01 = new Date();
var diffDate_02 = new Date();
/* create separate clock Objects */
var clok_01 = new clock(diffDate_01);
var clok_01 = new clock(diffDate_02);
/* calling update_clock function wrapped within setInterval to make the clock's hand rotatable */
setInterval("clok_01.update_clock(diffDate_01)", 1000);
setInterval("clok_01.update_clock(diffDate_02)", 1000);
}
function clock(diffDate){
/* this is the place where the base implementation of the …Run Code Online (Sandbox Code Playgroud) 假设我要通过运行单个脚本在列表中保存100个浮点数,很可能需要一些内存来处理.因此,如果此代码每次都作为应用程序的要求执行,则会有性能命中,所以我的问题是如何保持效率以获得性能.
模拟代码:
def generate_lglt():
float1, float2 = 27.2423423, 12.2323245
lonlats = []
for val in range(100, 0, -1):
lonlats.append(random.uniform(float1, float2))
lonlats.append(random.uniform(float1, float2))
lonlats.append(random.uniform(float1, float2))
lonlats.append(random.uniform(float1, float2))
lonlats.append(random.uniform(float1, float2))
print lonlats
Run Code Online (Sandbox Code Playgroud)
谢谢.
我尝试运行脚本时收到错误
Error:"IndentationError: unindent does not match any outer indentation"
Run Code Online (Sandbox Code Playgroud)
抛出错误的代码snipet:
def update():
try:
lines = open("vbvuln.txt", "r").readlines()
except(IOError):
print "[-] Error: Check your phpvuln.txt path and permissions"
print "[-] Update Failed\n"
sys.exit(1)
try:
Run Code Online (Sandbox Code Playgroud)
这是出现错误的实际行:
print "[-] Update Failed\n"
Run Code Online (Sandbox Code Playgroud) python ×3
java ×2
syntax ×2
ajax4jsf ×1
function ×1
indentation ×1
javascript ×1
jdbc ×1
jsf ×1
jsf-2 ×1
junit ×1
object ×1
optimization ×1
raphael ×1
richfaces ×1
testing ×1
unit-testing ×1