I have some problem with using jstl. I have this:
<jsp:useBean id="view" class="user.View"></jsp:useBean>
<jsp:useBean id="user" class="user.Validation" scope="session"></jsp:useBean>
<c:if test="${user.getValid() == 0}">
<c:out value="${view.printUserData(user)}"></c:out>
</c:if>
and View class looks:
package user;
import java.lang.StringBuilder;
public class View {
public String printUserData(Validation val) {
String name = val.getImie();
mainText.append(name);
return mainText.toString();
}
}
but i have error:
org.apache.jasper.JasperException: /save.jsp(30,0) The function getValid must be used with a prefix when a default namespace is not specifie
How can i fix it?
The function getValid must be used with a prefix when a default namespace is not specified
This error message is typical when you are not using/running a Servlet 3.0 capable container yet, such as Tomcat 7, Glassfish 3, etc. Invoking arbitrary methods in EL is not supported until Servlet 3.0.
So, if you can't upgrade to Servlet 3.0, then you should specify the property name instead.
<c:if test="${user.valid == 0}">
You would also need to approach ${view.printUserData(user)}
differently. I'd use an EL function for this.
<c:out value="${f:printUserData(view, user)}">
with
public static String printUserData(View view, Validation validation) {
return view.printUserData(validation);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With