I seem to be having a weird issue where I can not pass a Scriptlet variable to an EL function call. It will all run properly but it sends a null value instead of what I set in the jsp... I feel like I am missing something very basic here.
<!DOCTYPE html>
<html>
<head>
<%@ Sudo / All other tag's required.... %>
<%@ taglib prefix="fn_" uri="/WEB-INF/tags.tld" %>
<script>
<% LinkedList<MyBean> mb = (LinkedList<MyBean>)request.getAttribute("mBean"); %>
<% String f="first"; %>
</script>
</head>
<td>${fn_:getMyBean(mb,f)}</td>
<?xml version="1.0" encoding="UTF-8"?>
<taglib
xsi:schemaLocation= "http://java.sun.com/xml/ns/javaee web-jsptaglibrary_2_1.xsd"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.1">
<tlib-version>1.1.2</tlib-version>
<uri>http://some.thing/mine</uri>
<function>
<name>getMyBean</name>
<function-class>com.glass.MyBean</function-class>
<function-signature>java.lang.String getMyBean(java.util.List, java.lang.String)</function-signature>
</function>
</taglib>
package com.glass;
import java.util.LinkedList;
import java.util.List;
public class MyBean{
public static String getMyBean( List<MyBean>cb, String st) {
return "Hit! "+ st;
}
The output will give this:
Hit!
And does not return the string value. When I run the debugger I can see that the string value is null. I also tested below if I just try to get the String value like : <%=f%>
It does properly show me the value.
How do I properly use a String value in a EL Function call?
Set the value of f
as follows:
<c:set var="f" scope="request" value="first"/>
and then use it as follows:
${fn_:getMyBean(mb,f)}