jspstruts

Is there any way to reduce the verbosity of JSP pages


After three years on a RESTful Java/ExtJS application, I have taken over development of a Java/JSP application.

New to Java Struts, I am finding the use of struts tags in JSP pages to be insanely verbose, e.g.

<input type="button" value='<bean:message key="button.addDoc"/>' />

Of course there are about 1700 message tags in every page, and it would seem that something like $m("button.addDoc") would be quite enough. Is there some way to shorten the bean:message elements to something less noisy, or is this just the Java way?


Solution

  • or is this just the Java way?

    That's just the Struts way. It's a pretty legacy MVC framework. You could consider to look for a different MVC framework which resolves properties by just EL, for example JSF.

    E.g.

    <h:commandButton value="#{bundle.addDoc}" />
    

    It's only going to be a lot of work with that much pages/tags. Since it's apparently an assignment, I'd just live with it and keep it for the future in mind to deny old Struts based projects.