Reputation: 11
I am new to struts tag libraries. I want to generate an anchor to define a hyperlink destination inside the same document. My code is like this:
<html:link anchor="abc" >
This is to test anchors
</html:link>
...Some other tags here
<html:link linkName = "abc" >
Anchor
</html:link>
The error I am getting is Cannot create rewrite URL: java.net.MalformedURLException: You must specify exactly one of "forward", "href", or "page"
Can anybody tell me how to solve this?
Thanks
Upvotes: 0
Views: 8166
Reputation: 11
This worked for me. Below is the scenario, in which i got the error.
<appl:resource defaultValue="Appl Error" op="GET" category="shunmugaActionMapping" name="specification" property="shunmugaType" id="shunmugaStartMapping" type="string" >
<td class="<xd:valueOf name="rowStyle"/>">
<div class="listRowLink"><html:link page="<%=shunmugaStartMapping%>" paramName="specification" paramProperty="routerId" paramId="detailRouterId">> Details</html:link>
</div>
</td>
This was throwing the following error:
servlet E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E:
Uncaught exception created in one of the service methods of the servlet
/jsp/List.jsp in application Sundaram. Exception created :
com.ibm.websphere.servlet.error.ServletErrorReport:
javax.servlet.jsp.JspException: Cannot create rewrite URL:
java.net.MalformedURLException: You must specify exactly one of
"forward", "href", "page" or "action"
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:695)
All i did is i added the closure at the end:
</appl:resource>
The problem got solved and I am fine now.
Thanks, Shunmuga
Upvotes: 1
Reputation: 2522
as i understand struts and from apache
You must specify exactly one of the action attribute, the forward attribute, the href attribute, the linkName attribute, or the page attribute.
so in your first tag, i would guess that you would need to add an href tag and the anchor is added on to that. then your tag with linkname should work
that is
<html:link href="someurl" anchor="abc" >
This is to test anchors
</html:link>
Upvotes: 1