【发布时间】:2015-08-23 01:32:41
【问题描述】:
在显示值 #{row.currentstring} 之前,我似乎无法让下面的代码运行 javascript。 下面是负责显示值的JSF代码
<rich:column styleClass="#{row.displayClass}" >
<f:facet name="header">
<h:outputText value="#{bundle.currentvocab}" />
</f:facet>
<h:outputText id="vocab_value" value="get_vocab('#{row.currentString}')" styleClass="#{row.displayClass}" />
</rich:column>
这里的 get_vocab 是我正在运行的 javascript,如下所示:
function get_vocab(inp)
{
var b = "car";
var c = "propose";
var d = "check";
var x;
var y;
if (inp.indexOf(b) > -1) {
x = inp.indexOf(b);
y = inp.substring(0,x+3);
}
else if (inp.indexOf(c) > -1) {
x = inp.indexOf(c);
y = inp.substring(0,x+7);
}
else if (inp.indexOf(d) > -1) {
x = inp.indexOf(d);
y = inp.substring(0,x+5);
}
else {
y = "value not found"
}
return y;
}
【问题讨论】:
标签: javascript jsf