Tomcat v7サーバーでEL関数を実行しようとしましたが、失敗しました。は、デフォルトの名前空間が指定されていない場合にプレフィックスを使用する必要があります
JSP:
<input type="hidden" name="" id="Rcept_<%=i%>" value="${QStr.str_hl(incidentTpEtt.rceptCtts)}">
エラー:
The function str2html must be used with a prefix when a default namespace is not specified
だから私は、次のコードを試してみました
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<input type="hidden" name="" id="Rcept_<%=i%>" value="${fn:str_hl(QStr, incidentTpEtt.rceptCtts)}">
または
<input type="hidden" name="" id="Rcept_<%=i%>" value="${fn:QStr(str_hl, incidentTpEtt.rceptCtts)}">
エラー:
The function str_hl cannot be located with the specified prefix
QStr
:
public static String str_hl(String as_str) {
char[] l_str = null;
int li_len = 0;
StringBuffer l_return = new StringBuffer();
if(as_str == null)
return null;
l_str = as_str.trim().toCharArray();
li_len = l_str.length;
for(int i=0 ; i<li_len ; i++) {
if (l_str[i] == '&') l_return.append("&");
else if(l_str[i] == '<') l_return.append("<");
else if(l_str[i] == '>') l_return.append(">");
else if(l_str[i] == '"') l_return.append(""");
else if(l_str[i] == '\'') l_return.append("'");
else l_return.append(l_str[i]);
}
return l_return.toString();
}
どのように私はこの問題を解決することができますか?
I変更コード の'> - > $ {QSTR .str_hl(incidentTpEtt.rceptCtts)} – senam
なぜ否定的な投票ですか?わずか数行のコードを見るだけで完全なソリューションを期待していますか?私は彼に、これらの行ではELを使うことはできないが、「scriplet」を使うべきであるという例を与えている。 –