struts2中数据如何从action类传输到Jsp页面
struts2中数据如何从action类传输到Jsp页面。 在将其控制权转移到 jsp 页面之前,是否在操作类内部构建了任何类型的堆栈,或者使用了其他机制。
How the data transfer from the action class to Jsp page in struts2.
Is any kind of stack is build inside the action class before its transfer its control to the jsp page , or there is something other mechanism is used for that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Anshul,
您的实现有些正确。对于 Struts2,我们可以通过以下方式查看它
值堆栈是 Struts2 框架中的虚拟堆栈,是框架放置与请求处理相关的所有数据的中心位置。在 Struts2 中,操作也被视为数据载体,因此确切发生的情况是,当操作完成其工作时,它被放置在值堆栈的顶部。
现在让我们在 Action 中拥有类似的东西,
逻辑框架将 Action 实例放置在值堆栈的顶部并且
firstname
和lastname
将位于顶部后,action 将返回它的。这里
(%{firstname}) OGNL
将到位,它将尝试查看值堆栈中是否存在名为firstname
的属性,因为操作已开启位于值堆栈的顶部,并且其中包含属性名称firstname
,因此 OGNL 会找到它。我希望这会帮助你
Anshul,
You are some what correct in your implementation.For Struts2 we can see it in following manners
Value stack is a virtual stack in Struts2 framework and a central place where all the data related to request processing will be placed by the Framework.In Struts2 Actions are also treated as a data carrier, so what exactly is happening is when the action done its work it is being placed on the top of value stack.
Lets we have something like this in Action
now when action will return after the logic framework will place action instance on the top of value stack and
firstname
andlastname
will be on the top of it.here
(%{firstname}) OGNL
will come in to place and it will try to see if there is a property in the value stack with namefirstname
,since action is on the top of value stack and it has property namefirstname
in it so OGNL will find it.i hope this will help you