<html:link>标记</html:link>

时间:2009-11-12 09:03:53

标签: struts

我是struts标记库的新手。我想生成一个锚来定义同一文档中的超链接目标。我的代码是这样的:

<html:link anchor="abc" >
            This is to test anchors
</html:link> 

...Some other tags here

<html:link linkName = "abc"  >
           Anchor
</html:link>

我得到的错误是Cannot create rewrite URL: java.net.MalformedURLException: You must specify exactly one of "forward", "href", or "page"

有谁能告诉我如何解决这个问题? 感谢

2 个答案:

答案 0 :(得分:1)

我理解struts和来自apache

  

您必须准确指定action属性,forward属性,href属性,linkName属性或page属性中的一个。

所以在你的第一个标签中,我猜你需要添加一个href标签,并将锚添加到其上。那么带有linkname的标签应该可以使用

<html:link href="someurl" anchor="abc" >
            This is to test anchors
</html:link> 

答案 1 :(得分:1)

这对我有用。 以下是我收到错误的情况。

<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">&gt; Details</html:link>
      </div>
   </td>

这引发了以下错误:

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) 

我所做的就是在最后添加了封口:

</appl:resource>

问题解决了,我现在很好。

谢谢, Shunmuga