简体   繁体   中英

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:

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. 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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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