关于Struts 2框架中的html标签 [英] About html tags in Struts 2 framework

查看:83
本文介绍了关于Struts 2框架中的html标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否确实可行,并允许使用html标签,使用struts2框架通过name属性在操作类中设置值,例如:

I want to know if it's actually possible, and allowed to use html tags, to set values in the action class via name attribute using struts2 framework, for example:

人豆:

String name; 

动作类具有以下这一行:

Action class has this line:

Human human;

表格:

<s:textfield name="human.name"/>

但在这种情况下,将是:

but in this case, would be:

<input type="text" name="human.name"/>

在这种特殊情况下,需要使用输入的html标记,因为使用jquery动态并重复地生成了表单的一部分,并且似乎在生成struts标记时遇到问题,第一次加载页面时,它实际上没有加载,它会重定向到某个maden error.jsp,当您刷新页面时,它就可以工作,当我生成标准html标签时不会发生这种情况,不应该那样做,我们不在测试代码,首先是用户界面,所以我需要知道这一点.有可能这样做吗?如果是的话,性能或质量会受到影响吗?

In this particular case, it is required to use the input html tag, cause part of the form is being generated dynamically and repeatedly using jquery, and it seems to have issues generating struts tags, the first time the page loads, it actually doesn't load, it redirects to some maden error.jsp, when you refresh the page, then it works, which doesn't happen when I generate the standard html tag, shouldn't be like that, we're not testing code yet, first the user interface, so I need to know this. Is it possible or allowed to do that? and if it is, Would the performance or quality be affected?

推荐答案

Struts和用于在服务器上生成HTML的任何其他JSP标记,无论如何,您都可以在浏览器中看到框架生成的HTML源代码.使用input元素的name属性映射到操作属性.标记是在客户端上执行javascript时在服务器上处理的,因此它不会影响服务器性能.

Struts and any other JSP tags used to generate HTML on server, in any case, you could see the HTML source code generated by framework in the browser. Use the name attribute of the input elements to map to the action properties. Tags are processed on server while javascript is executed on the client, so it should not affect the server performance.

这篇关于关于Struts 2框架中的html标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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