Struts2 中的变量声明 [英] Variable declaration in Struts2

查看:29
本文介绍了Struts2 中的变量声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 Struts2 中声明一个变量并为该变量赋值?

How to declare a variable and assign value to that variable in Struts2?

推荐答案

使用 set 标签:

<s:set var="myVar">hello</s:set>

读取变量:

<s:property value="#myVar"/>

<小时>

另一个例子:


Another example:

<s:set name="personName" value="person.name"/>
Hello, <s:property value="#personName"/>. How are you?

在你的价值栈中,person 是一个 bean

where person is a bean in your value stack

这篇关于Struts2 中的变量声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆