struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Pratt <thechrispr...@gmail.com>
Subject Re: AJAX Jsp tags
Date Mon, 12 Aug 2013 06:20:10 GMT
Excellent post Ken.  I absolutely agree with everything you mention.  I too
use jQuery and jQuery UI directly in my JSP templates (not through some tag
library) and find it easier and more powerful.  I can also throw in a +1
for Tiles as a compositing technology that is indispensable in large sites.
  (*Chris*)


On Sun, Aug 11, 2013 at 10:26 PM, Ken McWilliams
<ken.mcwilliams@gmail.com>wrote:

> I have some experience creating custom struts2 tags, but for ajax I do not
> advise this route at all.  XML is not meant as a replacement for a
> programming language, it is meant for configuration. It might seem
> intuitive without further investigation that there are a limited number of
> HTML UI elements and their functionality quite straight forward and so it
> would seem reasonable that a configuration only route could work in the
> general case. This is wrong as evidenced by all efforts to define dynamic
> UI elements using XML.
>
> Even JavaFX tried to use xml and that was abandoned, they had the benefit
> of designing the entire environment from the ground up, which is hardly the
> case here.
>
> Not sure if you are familiar with the popular Question and Answer site
> "Stack Overflow", however a great many questions regarding the struts2 ajax
> tags go unanswered. If people could find solutions for their configuration
> issues I wouldn't be so open with my negative view of ajax tags. Since it
> is most often new users of Struts2 that attempt to use these tags and to
> what appears to be dismal results I can't help but think that these tags
> may actually be of harm to the struts2 image.
>
> I've only experimented with the jquery ajax tags breifly and experienced
> frustration. Also before that experimented with the now deprecated dojo
> tags. I had used the dojo tags within their prescribed limits but it is
> much more enjoyable to have freedom. They were just too cumbersome. As soon
> as you use JavaScript everything is far easier.
>
> Try to use Unobtrusive JavaScript:
> http://en.wikipedia.org/wiki/Unobtrusive_JavaScript
>
> This will make your html "tag like" while allowing you to use the
> JavaScript APIs as intended.
>
> It is worth noting that the tag libraries can be used as templates. I bring
> this up because one natural objection to not using a tag library would be a
> loss in terms of this particular use. There are a number of other solutions
> in this area one of them is Apache Tiles. JSPs, Freemarker, and Velocity
> are all view technologies and while they have facilities for templates it
> isn't their first concern. Apache tiles and Sitemesh both address the issue
> of reducing boiler plate head on. Tiles does not try to do what the
> aforementioned view technologies do, instead think of it as a way to factor
> commonality out of any of those view technologies. As such both Apache
> Tiles is a meta-view technology.
>
> What I advise:
>
> 1) Avoid ajax tag libraries and write JavaScript by hand - even if you
> don't know JS, you will be able to understand the documentation of the
> popular JS UI elements and achieve the same level of functionality as
> provided by the ajax tags even if all you do is cut and paste programming.
> 2) Follow the Unobtrusive JavaScript practice.
> 3) When writing JS do not hard code URLs use the struts2 URL tag (It will
> pick up changes to the context root that way).
> 4) When asking for help with the client side, no one needs to know what
> server side technology is used. The is greatly improve your chances for
> positive feedback.
> 5) Use the Struts2-JSON plugin to produce data for your ajax consuming UI
> elements and also as a means of accepting JSON data into actions.
> 6) When asking for server side support, try to insulate the audience from
> your particular JS. (Determine that the correct data is being sent to the
> server, if it not the issue is a client side, if the correct data is being
> sent only provide that data [the query string or the JSON string]).
> 7) Use firebug plugin fore Firefox, it is a huge help.
> ------------
> 8) Should you feel the need for a stronger templates solution consider
> tiles (or sitemesh), this link points to it in a rather current use of it:
> http://tech.finn.no/2012/07/25/the-ultimate-view-tiles-3/
>
> Hope the reasoning is clear enough. I sincerely want to save you and anyone
> else with similar concern some time and sanity.
>
>
>
>
>
> On Sat, Aug 10, 2013 at 3:05 AM, Alireza Fattahi <afattahi@yahoo.com>
> wrote:
>
> > Thanks for your comment.
> > Did you have any experience with struts jquery tag or other tags too?
> > Or you complete suggest that we write our own tags !
> >
> >
> >
> > ~Regards,
> > ~~Alireza Fattahi
> >
> >
> > ________________________________
> >  From: Ken McWilliams <ken.mcwilliams@gmail.com>
> > To: Struts Users Mailing List <user@struts.apache.org>
> > Sent: Friday, 9 August 2013, 8:22
> > Subject: Re: AJAX Jsp tags
> >
> >
> > Don't use a JSP AJAX tag library. The dojo JSP tags didn't work well not
> > because of dojo or an fault of the tag authors, the technologies simply
> > don't mesh. It's as sane to program Java via XML as it is to program
> > JavaScript via XML.
> >
> > XML is used for configuration. At first glance you think you'll only need
> > trivial behaviour but this is seldom ever the case,  JS UI components are
> > much easier to work with and you will need to provide your own handlers,
> > which are often required even in the simple cases. XML can not account
> for
> > all these cases and does not provides the means to add custom handlers
> in a
> > way that would be as simple as using the underlying JS framework
> naturally.
> >
> > Further the tag authors often lag behind the UI components that they
> wrap,
> > the documentation and features often fall behind too.
> >
> > With even a trivial understanding of JS you should be able to produce the
> > same results as the Tags in the same time frame, as you gain experience
> > you'll quickly superseded the capabilities of any tag library.
> >
> >
> >
> >
> >
> > On Thu, Aug 8, 2013 at 11:02 AM, Chris Pratt <thechrispratt@gmail.com
> > >wrote:
> >
> > > The dojo based tags are deprecated, the jQuery based tags are not.
> > >   (*Chris*)
> > >
> > >
> > > On Thu, Aug 8, 2013 at 9:54 AM, Alireza Fattahi <afattahi@yahoo.com>
> > > wrote:
> > >
> > > > Hi,
> > > >
> > > > I have confused with struts 2 ajax please correct me:
> > > > 1- The dojo plugin is deprecated (
> > > > http://struts.apache.org/release/2.3.x/docs/ajax-tags.html)
> > > > 2- According to above we are not recommended to use dojo plugin in
> new
> > > > projects.
> > > >  3- All tags that mentioned in above page like: a, autocompliter,bind
> > ...
> > > > shall not be used.
> > > > 4- According to page
> > > http://struts.apache.org/release/2.3.x/docs/ajax.html
> > > > :
> > > > "....First, you can use some type of JSP tag. Here, you don't have to
> > > know
> > > > very much at all about Ajax or JavaScript. The taglib does all the
> > work,
> > > > and you just have to figure out how to use the taglib. The standard
> > > > Struts 2 taglib includes several Ajax JSP tags,"
> > > > 5- The "Ajax JSP tags" link above will redirect to
> > > > http://struts.apache.org/release/2.3.x/docs/ajax-tags.html, which is
> > > > deprecated!!
> > > >
> > > > I don't get it !
> > > > Can we use AJAX Jsp tags or they are deprecated ?
> > > >
> > > >
> > > > ~Regards,
> > > > ~~Alireza Fattahi
> > > >
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message