Struts中,在JSP中如何用标签得到 /WebApp 路径及 Link 的参数赋值这两种功能?
Struts中,在JSP中如何用标签得到 /WebApp 路径及 Link 的参数赋值这两种功能?
<html:link action="/DemoAction?parameter="> Link </html:link>
<bean:write name="DemoBean" property="DemoParameter"/>
==============================
请问如何在 /DemoAction?parameter= 后面加上 <bean:write name="DemoBean" property="DemoParameter"/> 的值??
==============================
这样会出错:
<html:link action="/DemoAction?parameter=<bean:write name="DemoBean" property="DemoParameter"/>"> Link </html:link>
==============================
难道又要转换成以下:
<%
DemoBean d = request.getAttribute("DemoBean");
String DemoParameter = d.getDemoParameter();
%>
<a href="/DemoAction?parameter=<%= DemoParameter %>"> Link </a>
如果是这样做的话,那又脱离了 Struts 的设计了!
==============================
上面怎么处理?
(2)然后第二个问题:在javascript里面用到
document.location.href = "/DemoAction?some=true";
这时候 Struts 有没有提供方法可能得到 当前应用 /DemoApp 的路径的?
效果如:
document.location.href = "/DemoApp/DemoAction?some=true";
问题点数:20、回复次数:4Top
1 楼involved(solve)回复于 2005-03-03 13:14:49 得分 20
<html:link>标签用法:
带变量参数的属性链接
http://www.javawebstudio.com/bbs/dispbbs.asp?boardid=8&id=349&star=1#349Top
2 楼wealth(wealth)回复于 2005-03-03 14:09:43 得分 0
(2)然后第二个问题:在javascript里面用到
<script language="javascript">
function onfunc() {
document.location.href = "/DemoAction?some=true";
}
</script>
这时候 Struts 有没有提供方法可能得到 当前应用 /DemoApp 的路径的?
效果如:
<script language="javascript">
function onfunc() {
document.location.href = "/DemoAction?some=true";
}
</script>
这个可否实现?Top
3 楼wealth(wealth)回复于 2005-03-03 14:10:26 得分 0
错了:改为“document.location.href = "/DemoApp/DemoAction?some=true";”Top
4 楼YuLimin(阿敏总司令:简单就是美—钻石闪闪您快结贴!)回复于 2005-03-12 15:08:21 得分 0
<html:link>标签用法:带变量参数的属性链接
<html:link action="/html-link" paramId="stringProperty" paramName="newValue">
String via paramId and paramName
</html:link>
<html:link action="/html-link" name="newValues">
Float, int, and stringArray via name (Map)
</html:link>
<html:link action="/html-link" paramId="booleanProperty" paramName="testbean" paramProperty="nested.booleanProperty" module="/exercise">
Boolean via paramId, paramName, and paramValue (module)
</html:link>Top




