简体   繁体   English

关于Struts 2框架中的html标签

[英]About html tags in Struts 2 framework

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: 我想知道是否确实可行,并允许使用html标签,使用struts2框架通过name属性在action类中设置值,例如:

Human bean: 人豆:

String name; 

Action class has this line: 动作类具有以下这一行:

Human human;

Form: 形成:

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

but in this case, would be: 但在这种情况下,将是:

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

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. 在这种情况下,需要使用输入的html标记,这是因为使用jquery动态重复生成了表单的一部分,并且似乎在生成struts标记时遇到了问题,页面第一次加载时实际上并没有。加载后,它会重定向到某个maden error.jsp,当您刷新页面后,它就可以工作了,当我生成标准html标签时不会发生这种情况,不应该那样做,我们还没有测试代码,首先是用户界面,所以我需要知道这一点。 Is it possible or allowed to do that? 有可能这样做吗? and if it is, Would the performance or quality be affected? 如果是,性能或质量会受到影响吗?

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. Struts和用于在服务器上生成HTML的任何其他JSP标记,无论如何,您都可以在浏览器中看到由框架生成的HTML源代码。 Use the name attribute of the input elements to map to the action properties. 使用input元素的名称属性来映射到动作属性。 Tags are processed on server while javascript is executed on the client, so it should not affect the server performance. 标记是在客户端上执行javascript时在服务器上处理的,因此它不会影响服务器性能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM