trouble getting the html:link tag to work

Discussions

General J2EE: trouble getting the html:link tag to work

  1. trouble getting the html:link tag to work (4 messages)

    Hello,

    I have a JSP that is making use of the struts-html tag library. specifically, I have the following code snippet:

    <c:forEach var="record" items="${sessionScope.resultSet}" varStatus="status">
    <tr>
    <td><html:link page="/action1.do?name=${record.name}">name</html:link></td>
    ....
    <td><c:out value="${record.name}"></c:out></td>
    ....

    My problem is the link generated seems to have ${record.name} appended literally instead of the evaluated value. I have tried replacing the html:link tag with c:url but the same outcome. I also know that the ${record.name} variable is being populated properly as it appears as expected in the second column of the above table.

    I must be missing something very basic but I can't seem to find the problem. Any and All help is greatly appreciated.
  2. Are you using the EL version of the Struts tags?

    The Struts tag library does not have EL support by default. What you want is:

    <html:link action="/action1" paramId="name" paramName="record" paramProperty="name">name</html:link>

    The paramId is the query string attribute name. The paramName is the name of the bean you are going to get the query string attribute value from and finally the paramProperty is the property of the bean that contains your value.

    I guess a second thought would be to make sure that the objects in your "resultSet" have a getName() method.

    Hope this helps.
  3. How can I tell if my version of Struts tags support EL?

    Are you using the EL version of the Struts tags?The Struts tag library does not have EL support by default. What you want is:<html:link action="/action1" paramId="name" paramName="record" paramProperty="name">name</html:link>The paramId is the query string attribute name. The paramName is the name of the bean you are going to get the query string attribute value from and finally the paramProperty is the property of the bean that contains your value.I guess a second thought would be to make sure that the objects in your "resultSet" have a getName() method.Hope this helps.
  4. There is a different set of taglib jars that are something like "-el". They used to be in a "contrib" directory off the main distributions, but I don't have it handy to check where they are now.

    Here is more information: http://struts.apache.org/faqs/struts-el.html

    Glad to help.
  5. Your suggestion worked for properly creating a link. Now how would I populate a drop down box. Below is what I tried...
    <html:select property="code">
      <c:forEach var="record" items="${sessionScope.list}" varStatus="status">
        <html:option value="$record.code}">${record.description}</html:option>
      </c:forEach>
    </html:select>

    But again I am getting the literal string in the drop down box instead of the corresponding values.

    There is a different set of taglib jars that are something like "-el". They used to be in a "contrib" directory off the main distributions, but I don't have it handy to check where they are now.Here is more information: http://struts.apache.org/faqs/struts-el.htmlGlad to help.