Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using bean:write with html:link

 
SivaC Kumar
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to send a value as a request variable to action class.But I am getting an exception.
My code is
<logic:iterate name="searchResultsForm" id="results" property="searchResults" type="com.ng.wft.wl.form.SearchUserForm" scope="session">
<tr>
<td><html:link action="/searchUser.do?user=<bean:write name="results" property="userId"/>&methodToCall='showDetails'"><bean:write name="results" property="userId" /></html:link></td>
<td><bean:write name="results" property="firstName" /></td>
<td><bean:write name="results" property="lastName" /></td>
</logic:iterate>

but it is giving a servlet Exception


[ServletException in:/content/jsp/admin/searchResults.jsp] /content/jsp/admin/searchResults.jsp(24,73) equal symbol expected'

this is code where the exception is coming

><html:link action="/searchUser.do?user=<bean:write name="results" property="userId"/>&methodToCall='showDetails'"><bean:write name="results" property="userId" /></html:link></td>


Can any one help me Plz!!!
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't use a <bean:write> tag inside an <html:link> tag. Struts doesn't support it.

The easiest way to fix this is to abandon use of <html:link> and just use the plain old html tags <a></a>. Then you will have no problem substituting parameters with <bean:write> tags.

The only advantage <html:link> has over the plain html tag is that it automatically does URL rewriting (Adding of the jsessionid to the URL so that sessions may be tracked even if the user has turned cookies off). If you're not using this function anyway, as most modern websites don't, you may as well use the html tag.

If you still want to use <html:link>, use the struts-el version of the html tags and use EL expressions instead of <bean:write> tags.
 
gao zhixin
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some example using JSTL:

<a href="asdfasdf?action=${param.name}">aaaa</a>
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic