Is it possible to write a custom JSP tag to take an i18n message key and output the translation phrase for the given request?
Normally in JSP/JSTL, I do:
<fmt:message key="${messageKey}"><fmt:param>arg1</fmt:param></fmt:message>
And I get the translation phrase. Now I need to do the following (there's a good reason for this):
<cust...
Hi, everyone,
I want to ask a question about the web programming. I learn the servlet and the JSP before, but I don't know what is the JSTL and the different between the JSP and the JSTL. Can anyone help me? Thank you.
...
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...
I am migrating an ADF application to run in Websphere 7.
Basically I am moving to jstl 1.2
I have created a new project and I am now at the point where I can run jsps.
I started getting errors with the taglibs. Then I found out that I have to replace all my c taglib declarations with the new uri of java.sun.com/jsp/jstl/core instead...
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" />?
...
javax.servlet.jsp.JspTagException: 'begin' < 0
Once in a while you run into an error and you say: What the WHAT?? tagexception begin < 0. Seen this wonder before??
...
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...
How can I check if the Submit button was clicked in JSTL?
...
I'm trying to call my custom tag from the JSTL tag <c:url>.
Because of the quotes, the custom tag is shown as a string instead of a tag.
Can I use an escape character here?
<img align="left" src="<c:url value='/getFile/getfile?<myTag:getValue type="web" name="person" />'/>" alt="person" title="person" width="55" height="70"/>
...
How to get cell data of a specific row from the dynamically created HTML table in JSP?
I am creating JSP Page in the following way
Connect to MySQL Databse
Fetch rows from table based on criteria
Construct HTML table dybamically based on the rows returned in step 2
The first column of table contains checkbox
JSP page contains ...
I'm having difficulty showing the model values from my controller to my JSP view. Everything works in Tomcat 6. But it doesn't work in Tomcat 5.5. Here are my files.
web.xml for Tomcat 5.5 (For Tomcat 6, I use version="2.5" and the correct schema)
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
...
I am trying to get the domain name from the url with JSTL. The 2 methods I know return the wrong info. I need exactly what is in the url.
When I do: ${pageContext.request.remoteHost} I get an IP. When I do ${pageContext.request.serverName} I normally get the right domain name but on a server we have on amazon it is returning "server1" ...
I have an object with a method
public boolean hasPermission(String role) {
return permissions.contains(role);
}
I want to do the equivalent of:
<c:if test="${row.hasPermission(role)}">
<td></td>
</c:if>
But I cannot access the hasPermission method from within the JSP file. How can I do it?
...
Is nesting of EL Expressions in Ternary Operator allowed?
What is wrong with the following expression?
<input class="text_field" type="text" name="receivedBy" id="receivedBy" style="width:250px;" maxlength="64" value="${empty obj.val ? obj1.attr1.val ' ' obj2.attr1.val: obj3.val"}/>
...
Hi, I've been googling around for quite some time now and I've decided to ask this here,
how would I make the following code work?
<c:if test="${null != searchResults}" >
<c:forEach items="${searchResults}" var="result" varStatus="status">
I've tried many different variations of this, such as:
<c:if test="${search...
is it possible to use the implicit object 'Application' using EL in JSP 2.0? For example, instead of
<%=application.getInitParameter("appkey")%>
I want an EL version. I know I can use JSTL initParam but wondering if there is a way with Application.. thanks.
...
Why would the pageContext variable not be findable in this custom tag installed in the WEB-INF/tags directory of a Spring MVC app?
<%@ tag import="com.ocpsoft.pretty.time.PrettyTime, java.util.Date"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ attribute name="dateParam" required="true" type="java.util.Date" %>
...
The string:
${prettyDate}
is output to the page by this custom tag instead of the prettified Date string:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ tag import="com.ocpsoft.pretty.time.PrettyTime, java.util.Date"%>
<%@ attribute name="dateParam" required="true" type="java.util.Date" %>
<%
PrettyTime p = ne...
I want to print decremental numbers like:
<c:forEach var="i" begin="10" end="0" step="-1">
... ${i} ...
</c:forEach>
then I got jsp exception:
javax.servlet.jsp.JspTagException: 'step' <= 0
javax.servlet.jsp.jstl.core.LoopTagSupport.validateStep(LoopTagSupport.java:459)
org.apache.taglibs.standard.tag.rt.core.ForEachTag.s...