Problems in implementing JSP using Struts2

1

After executing the following jsp :

<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Hey!</title>
</head>
<body>

    <c:choose>
        <c:when test="${session.loggedin == true}">
            <p>Welcome, ${session.username}. Say HEY to someone.</p>
        </c:when>
        <c:otherwise>
            <p>Welcome, anonymous user. Say HEY to someone.</p>
        </c:otherwise>
    </c:choose>

    <c:forEach items="${heyBean.allUsers}" var="user">
        <a href="
            <s:url action="say" method="post">
                <s:param name="username" value="session.username" />
                <s:param name="myFriend" value="${user}"/>
            </s:url>
            "><c:out value="${user}"/><br>
        </a>
    </c:forEach>

    <p><a href="<s:url action="index" />">Start</a></p>

</body>
</html>

I have the following bug:     According to TLD or attribute directive in tag file, attribute value does not accept any expressions

    
asked by anonymous 19.11.2014 / 20:35

1 answer

-1

In Struts tags, expressions are delimited by a percentage: %{...} . Unlike JSTL tags that use the dollar sign: ${...} .

Try to do this in your example:

<s:param name="myFriend" value="%{user}"/>
    
19.11.2014 / 21:41