I have been getting to grips with struts again which is something I've been doing for a while lol I have an issue, perhaps somebody could enlighten me. I decided that after understanding the concept of XML configuration I would attempt zero configuration. First off zero wasn't to bad, instead of a struts.xml I had a struts.properties which set constants for struts configuration. This was all ok. I integrated Hibernate with a MySQL database and developed a page which pulled some data out of one of the MySQL test databases and presented in an iterable table on a .jsp. I also messed around with jquery plugin and datatables, all ok. I then decided that I wanted to understand more about user authorisation so I thought I would create a simple login etc as you do. I wanted the login form to be presented at http://localhost:8080/test/login with no action extension configurable with a constant. I got to grips with the convention plugin scanning package names and classes that extended ActionSupport.
The problem I had was that I could not seem to figure out how to render a .jsp with the form on at http://localhost:8080/test/login then submit that form using the same action but a different method. As execute would have given a success result which sent the user to /test/login. I read the struts website about post back default but I was unable to get that working, Im not sure why. So I read on stackoverflow that you could do it but that the only other way of achieving this was to use the struts rest plugin. So off I went down that rabbit hole. Downloaded the sample application and got to grips with that and now I have a login form at test/login. But I had to revert to using a struts.xml due to global allowed methods.
The next hole that I want to go down is to look at security for the login but I don't like the idea of using spring security with struts seems backwards why not just go and use spring or is struts better than Spring. Spring seems like another headache after the headache getting this far with struts.
Struts is just an MVC framework, while Spring these days is everything and the kitchen sink, including an MVC framework and a security framework. If this a new project I would advise to omit Struts entirely, and use Spring MVC. Struts is rather long in the tooth these days, and not really progressing technologically.
What's brown and sticky? ... a stick. Or a tiny ad.
create, convert, edit or print DOC and DOCX in Java