Reputation: 1655
I have defined a function something like below in the top of the jsp page
<%!
public boolean isSkillSelcted(String Skill1)
{
...
..
.
return true;
}
%>
Now I want to call the Function in the Check box as below
<input name="chkSkills" type="checkbox" id="chkJava" value="Java"
<c:if test='${isSkillSelcted("Java") == true}'>Checked</c:if>>Java
If the function return true then the check box will be marked as checked.Its Displaying exception as below.
org.apache.jasper.JasperException: /EditUser.jsp(73,71)
The function isSkillSelcted must be used with a prefix when a default namespace is not specified
When i append fn at beginning fn:isSkillSelcted its complaining function undefined
Upvotes: 0
Views: 4159
Reputation: 9366
The statement ${isSkillSelcted("Java")}
is a call to an Expression Language function.
When you use Expression Language function, you have to declare it in a .tld
file, and to specify a prefix to use them. This is explained here.
If you declare your function in the JSP page, you have to call it like this :
<input name="chkSkills" type="checkbox" id="chkJava" value="Java"
<% if (isSkillSelcted("Java")) { %>Checked<% } %> >
Upvotes: 1