This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of Zero to AI - A non-technical, hype-free guide to prospering in the AI era and have Nicolò Valigi and Gianluca Mauro on-line!
See this thread for details.
Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Struts Convention/Rest Plugins

Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

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 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.
Saloon Keeper
Posts: 6625
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
girl power ... turns out to be about a hundred watts. But they seriuosly don't like being connected to the grid. Tiny ad:
the value of filler advertising in 2020
    Bookmark Topic Watch Topic
  • New Topic