[JAVA] Disadvantages in selecting Struts1

Now, this information is really that, but in 2019, is Struts 1 still popular with some old men? Because it looks like ... That's security, but from other perspectives.

ActionForm, routing, etc.

Feature

Settings such as routing by XML It packs request parameters into an object called ActionForm If scope is set to session, ActionForm containing request parameters will be packed into the session as it is. If the request parameter is empty, it will get the data from the session. The server side is unaware of whether it is GET or POST. Either way, treat it in the same way.

Demerit

It takes time to write XML (also called XML hell). If you try to jump to another Action (Struts1 original class that inherits HttpServlet), it feels like spaghetti. ActionForm is not POJO. It depends on how the user uses it, but sometimes ActionForm is set to scope = session, all variables used in JSP are packed in ActionForm, and things that do not have to be sessions are packed in the session. Global variables of variables! Since Action is tightly coupled with HttpServlet, it is difficult to test with JUnit. For security reasons (such as CSRF), GET and POST should be distinguished. In terms of design, it is better to incorporate GET and POST into the design. For example, if it is a reference but POST, you cannot go to the page even if you hit the URL, which affects usability.

JSP custom tag

Feature

It seems like an idea that is not aware of HTML tags and is not aware of the front end. Is it possible to operate like a Java object? ..

Demerit

In the first place, you can't write HTML5 custom data attributes because you can't add arbitrary attributes to JSP custom tags. The disadvantage is that the HTML tags after evaluating the JSP are hard to imagine from the JSP custom tags (though the idea is that the front end is not imagined or conscious) in many ways. There are educational issues, but newcomers mistakenly think that the browser interprets the JSP directly. When you want to operate the DOM from JavaScript, you may feel that the source code does not match the JSP custom tag. For example, the property attribute of a JSP custom tag has a different word such as the name attribute in HTML.

Validator

I don't know much because I haven't used it, but it seems that I write XML.

Finally…

If possible, move to another FW ...

Spring is popular, but if it is not a large-scale development, if you want to use it a little different from how to use FW, or if you do not like the slow startup time, I think Spring is not suitable. In such a case, if you are limited to Java, the following micro framework is recommended.

jooby - do more! more easily!! Javalin - A lightweight Java and Kotlin web framework Spark Framework: An expressive web framework for Kotlin and Java

Recommended Posts

Disadvantages in selecting Struts1
Role organization memo in Struts