I have a request object with String attribute name1. When request is sent to JSP I would like to use name1 parameter as a name of application scope bean to retrieve its status. I have tried
<jsp:getProperty name="${name1}" property="status" />
and
${${objName}.status}
and
${applicationScope.${objName}.status}
but it does not w...
How do I correct this statement:
${model.myHashtable[model.data.id]}.
myHashtable is defined as
Hashtable<String, String>
But, ${model.data.id} returns an int.
I tried to do something like
${model.myHashtable['model.data.id']}
But it does not work. Any other ideas, aside from changing the type of id to String?
...
I know this isn't hard, but I'm not having any luck.
I want to make fooList from a Servlet available in a JSP. So in the Servlet I have:
request.setAttribute("list", fooList);
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/myJsp.jsp");
dispatcher.forward(request, response);
Then in the JSP, I want:
<c:for...
I have a HashMap (hshFields) of HashMaps (ecd_date, owned_by, etc..) with keys (label, size, etc..that I access as such:
<c:out value="${hshFields.ecd_date.label}" />
<c:out value="${hshFields.owned_by.label}" />
<c:out value="${hshFields.fnd_source.label}" />
(note: I must use JSTL and not EL)
the about spits out the a "label" of th...
I would like to concatenate a string within a ternary operator in EL(Expression Language).
Suppose there is a variable named value. If it's empty, I want to use some default text. Otherwise, I need to append it with some static text.
${(empty value)? "none" : value + " enabled"}
This will not compile however. What would be a correct ...
I have simple JSP:
<jsp:directive.attribute name="severity" type="java.lang.String" required="true"/>
<jsp:directive.attribute name="currentSeverity" type="java.lang.String" required="true"/>
<c:if test="${severity ne currentSeverity}">
<c:url value="/session" var="url">
<c:param name="severity" value="${severity}"/>
...
Our Topic object has BOTH isChannel and getChannel public methods. The object graph is too complex to change this. Channel has an Integer type.
We are migrating from one application server to Tomcat. When using this expression ${topic.channel.type}, in JSPs our current app server finds the getChannel method. However, Tomcat finds the ...
In current project I need to create a panel that will contain an HTML content created by the user elsewhere in the application. This content can be easily inserted like this:
<h:outputText value="#{myBean.dynamicHTMLContent}" escape="false"/>
An example content:
<p>User text</p>
Now we need to give the user more freedom and allow h...
How to make work something like that:
<c:forEach items="#{bean.data}" var="key" >
<h:outputText value="#{m[#{key}]}" />
</c:forEach>
I need to get value from messages.properties, but dynamically using #{} expression.
...
I need to access a property of a bean whose name is stored in a variable using EL in a JSP page.
If I were to access a property named "description", then I would go ${bean.description}, but since the name of the property is stored in the variable "name", I have no idea how I would do it in EL.
Is this possible? If not, does anyone have...
I am trying to dynamically generate content using JSP.
I have a <c:forEach> loop within which I dynamically create bean accessors. The skeleton resembles this:
<c:forEach var="type" items="${bean.positionTypes}">
${bean.table} // append 'type' to the "table" property
</c:forEach>
My problem is: I want to change the ${bean.table}...
I have a bean called EmployeeRoster:
public class EmployeeRoster {
protected List<Employee> janitors;
protected List<Employee> teachers;
}
In JSP, I want to access the different lists of Employees by type. I know that I can do something like:
${employeeRoster.getJanitors}
However, I have many different types of employees and ra...
How do you reference an interface constant with EL on a JSP page?
I have an interface Addresses with a constant named URL. I know I can reference it with a scriplet by going: <%=Addresses.URL%>, but how do I do this using EL?
...
when we can access all the implicit variables in jsp , why do we have pageContext.
solution :
if we use el expressions or jstl , to access or set the attributes we need pageContext. let me know whether i am right.
...
public class Foo extends Properties {
public String getVal(){
return "2";
}
}
In my HttpServlet class' doGet(..) method I am doing this,
Foo foo = new Foo();
request.setAttribute("key", foo);
Then in the .jsp is this code,
1 ${key}
2 ${key.val}
3 <%=request.getAttribute("key")%>
4 <%=((Foo)request.getAttribute(...
Hello experts,
How can I set a value using JSP 2?
I mean, if ${val} is the new version of <c:out value="${val}" />, what is the JSP 2 version of <c:set var="val" value="bla" />?
...
Hi all,
I have some html code rendered on the server side. This is passed to a jsp which renders a javascript-call with this html:
<script type="text/javascript">
window.parent.${param.popup_return}("${helpId}", "${content}");
</script>
content is like
"
This is a <p class="xyz">test</p>
"
My problem is that - according to the...
I was following a tutorial today that had me scratching my head for an hour. Consider:
public class MyClass {
public int getTotal() {
amount = 100;
return amount;
}
}
and an excerpt from a JSP:
<p>Total: ${objectOfTypeMyClass.total}</p> //object instantiated elsewhere
Nowhere in the code was an instance vari...
I'm trying to pass a <f:param name="id" value="{someValue.id}" /> and retrieve it in the next page (so I can put it in an output link). This is what I tried:
<h:outputLink value="#{linkController.clientEdit}?id={id}">#{linkController.clientEdit}?id={id}</h:outputLink>
The problem is, the part that is between the tag prints what I want...
I'm having tough time figure out how to display object's properties in ArrayList using EL expression.
Many tutorial outside shows simple example like:
List<String> test = new ArrayList<String>();
request.setAttribute("test", test);
test.add("moo");
And it works fine.
<p>${test[0]}</p>
When the ArrayList contains actual object with...