---
title: "struts2 超链接 到另一个action"
author: "Roader123"
date: "2010-08-10T23:52:11Z"
tags: []
categories: ["Web前端"]
slug: "struts2-action"
draft: false
lastmod: "2010-08-10T23:52:11Z"
id: 734111
url: "https://roader123.iteye.com/blog/734111"
---

```
1.
需要你去看你的struts配置文件。假如action的namespace='/company'；action的名字为xx则应该写为：
<a href="/company/xx.action">链接<a>
如果需要传参数a，且a的值为1：
<a href="/company/xx.action?a=1">链接<a>
如果传参个数大于1，则将参数之间用&连接：
<a href="/company/xx.action?a=1&b=1">链接<a>

如果配置文件中的namespace没有写，那么链接写为

<a href="xx.action">链接<a>

错了哦，应该写为：
<a href="bmaction.action?bname=<%='一个人'%>"></a>
```

2\.

想在SiteMesh模板的侧栏做'超链接'，当点击'超链接文本'时，server响应一个action，action返回一个result，从而打开 想要'链接'的页面\*.jsp。本来想用&lt;s:a&gt;&lt;/s:a&gt;,没找到合适的方法，Struts2标签用的还不行。  
&lt;a href=&lt;s:url action="produceShow"&gt;  
      &lt;/s:url&gt;&gt; 查看用户信息&lt;/a&gt;

补充：  
&lt;a href="produceShow.action"&gt;查看用户信息&lt;/a&gt;

 

[3.](http://hi.baidu.com/skyofdemon/blog/item/debcfab541514ec737d3ca29.html)

 

[http://hi.baidu.com/skyofdemon/blog/item/debcfab541514ec737d3ca29.html](http://hi.baidu.com/skyofdemon/blog/item/debcfab541514ec737d3ca29.html)