Which Framework to choose - struts2

I am going to develope a web application. Which framework(struts1 or struts2) should i choose?
Which one is easier to understand and code.
Is applying CSS/HTML in struts2 difficult?

I have used Struts1 and Struts 2 extensively. Struts2 is far better than Struts 1. Struts 2 is the way forward. There are a whole lots of improvements in Struts 2.
The use of interceptors.
Pojo like actions
No action forms.
Easy integration with other frameworks like spring, dwt etc

[I deleted the part about this being a too generic question, as I misread the initial question, sorry...]
Use struts2 since they obviously learned from what was flawed in Struts1. They introduced interfaces so that you can extend your own classes and use Dynaforms for form data binding (in struts 1 you have to write such a FormBean for every f*** form in your app). If you use struts you should also use tiles.
Another framework that is definitely worth a look is Wicket. So far so good. Good luck!

I think struts2 is better .Please read the below article
http://www.java-samples.com/showtutorial.php?tutorialid=200

Use struts 2 and you can also integrate it with spring.

Related

Implementation of CRUD with Grails framework

I've been searching all day for an answer to my problem, and don't seem to be able to find an answer.
I'm trying to implement a CRUD web application using Grails, with the IntelliIDEA IDE. Whereas with JSF i could use primefaces which allowed me to do this with general ease, i am disappointed to see, or at least seems to be that way, that the framework is a step backwards when it comes to development of html pages.
All i want is to have a table that is populated from data that is coming from a controller, and whenever i add a record it is also displayed in this table. I want to be able to edit any record on this table and also remove records. It would be awesome if there could be a component like primefaces datatables that allows me to do this easily, without having to use JavaScript. I've taken a look to the Dojo plugin, but it's so outdated and incomprehensible to me that i have discarded this option, mainly because there is no documentation on the site on how to use it with Grails, specifically.
Also, i do not want to use scaffolding. I am trying to learn how to do this from scratch, and it is of my understanding that it doesn't work too well with domains with many to many relationship, for example.
In a nutshell, what I am looking for is the best way to make a CRUD application on Grails that doesn't involve the use of scaffolding.
I would suggest you to go through "Grails in Action" book and follow the creation of web application "Quote of the Day" and "Hubbub", don't use scaffolding instead create your own views and controller using documentation provided.
This will help you to understand basic CRUD operations in Grails.
And also looking into documentation http://grails.github.io/grails-doc/latest/guide/theWebLayer.html
See if this can help you.
You are aware that the scaffolding also can generate code for you to learn from and continue your work from there (i.e. it doesn't have to happen magically behind the curtains). I would say that is the typical means of starting out with Grails and CRUD.
Otherwise, no Dojo probably won't help you out a lot. Maybe have a look at some other plugin, for instance the Easygrid plugin? It is based on Javascript though, which most solutions do.
The "Grails in Action" recommendation is probably your best bet for the long-term, learning it from the pro's rather than learning-by-doing/top-to-bottom CRUD-style.

Is there anything better than Tiles for Struts2?

I'm new to the Struts 2 world. I just figured out how to use the Convention plugin and I must say it's quite nice.
However, all of my JSP files of course have the complete head, title, etc. I want to build a reusable template and plug in various views (much like how Rails does it with the application.html.erb)
I got Tiles to work on a Struts 1 site before and it was a total nightmare. In my Struts 2 app, I am using the convention pattern so I have had almost no XML and would like to keep it that way.
Is there an easier way to do this other than Tiles?
Thanks.
Yes. Use the JSP 2.0 tag file feature. My answer to a previous, similar question may be of some use to you.
JSP, can it work similar to yield, layout, content_for in Ruby/Rails/Erb

Options for asp.net MVC Validation Framework

I'm thinking of two options right now for model-base validation for an ASP.net project I'm starting:
xVal (Steve Sanderson's project) and the Enterprise module that Stephen Walther uses on this page
I don't really know enough to talk about the preferences as I haven't used either of them yet. Any ideas?
Update Using LinqToSql for ORM right now, but am open to changes.
One difference I see in reviewing the two is that Stephen Walther's blog post describes a library which does only validation in the Web server, where as xVal works with jQuery validators to do in-browser validation, as well. This feature, incidentally, is almost completely automatic.
FluentValidation is nice. NHibernate also has built in model validation. Then you need something like Scott Guthrie's technique for binding errors to the UI.
I've been using xVal to and i have integrated it into the IDataErrorInfo interface introduced into MVC RC1. I like it.
Here is a post I wrote which explains a few things.
http://schotime.net/blog/index.php/2009/03/05/validation-with-aspnet-mvc-xval-idataerrorinfo/
Hope this helps.
Shamelessly promote my validation library. Built for jQuery validate & Enterprise Library and work out of the box for just that. That said, functionality and code are simple enough to modify/extend if you want.
You could also check out this new technique on LosTechies http://www.lostechies.com/blogs/hex/archive/2009/06/10/opinionated-input-builders-for-asp-net-mvc-part-5-the-required-input.aspx I like the fact that you inputs are setup globaly which is really DRY. Also you could just skip the client side validation and do an jquery ajax submit form to the server, which performs validation model and business logic all in one place, which is also DRY :) Also it means you will get the product out the door quicker and you can add client side validation later as a bonus or to progressively enhance the forms.
Another vote for xVal. It's real sweet. I like using Buddy Classes and DataAnnotations to do the validation lifting. Outside of making things work with Linq2Sql as you cannot add attributes to your fields, buddy classes give one a bit of flexibility to have multiple models share the same validation info. Comes in real handy for those ModelEditData classes that seem to always become neccessary.
Are you using an ORM? If so, which one are you using? I've had a lot of luck, when using Castle ActiveRecord, simply sticking with their default model-level validation. If you're not using that, though, this is probably not too helpful. :-)

How to create wizard screen layout using struts2?

I want to build a wizard screens for my project. For that i am using struts2 framework. Can anyone help me....
You will want to implement the ScopeInterceptor to create wizard like interfaces. An alternative is to implement custom conversational scope. A great tutorial on this can be found here.
My suggestion is... don't. At least not directly. Use Spring Webflow. It is vastly superior at wizard and conversational state style processes. Note: Spring Webflow can be used on top of other Web frameworks, most notably Spring MVC and JSF. There is a Struts 2 Webflow plug-in.
If you're not going to use Webflow, it's not really much different to coding normal controllers/actions/views/forms, except the logic can get really tedious.

How to localize ASP.NET MVC application?

What would be best practice to localize your ASP.NET MVC application?
I would like to cover two situations:
one application deployment in IIS which would handle multiple languages
one language/application deployment.
In first situation should you go with some kind of view based thing like, ~/View/EN, ~/View/FI, ~/View/SWE or something different?
What about second case, just application based config via Web.config and point these different languages to different URLs?
You can also take a look here ASP.NET MVC 2 Localization complete guide and ASP.NET MVC 2 Model Validation With Localization these entires will help you if you working with ASP.NET MVC 2.
You would localize your ASP.NET MVC application very much in the same way you would a classic ASP.NET Web Form application.
You wouldn't use different pages/views for each language, but each page would support multiple languages using satellite assemblies.
You can look at Matt Hawley's blog entry for more explanation and examples.
Unfortunately, Matt Hawley's original code doesn't work in the release version of ASP.NET MVC. Check out an updated post: http://blog.eworldui.net/post/2008/10/ASPNET-MVC-Localization-via-View-Engines.aspx
In general, the localization process isn't as smooth in the VS 2008 / ASP.NET MVC world as it is with traditional web forms. http://www.guysmithferrier.com/post/2009/05/Localizing-ASPNET-MVC.aspx
Have a look at Rob Connery's MvcStore project. He does a screencast showing one way to solve the globalization problem.
http://wekeroad.com/2008/04/24/mvcstore-part-5
I've never been convinced of handling localization within a form as Elijah suggests - the different lengths and directions can lead to very complex or vary naff looking forms.
I'm only just starting with MVC but taking the decoupling method you would wan to use the same controller regardless of the language (treating language just as a view) - this would then give you /Controller/Action/language/form
There is good tutorial with recent update on How to localize asp.net mvc application covering all aspects including DisplayName localization, Validation, using Routing (storing culture name in URL), issues with output cache and so on... Alex Adamyan Blog - While my keyboard gently weeps
We actually went a complete different with overriding the
DataAnnotationsMetadaDataProvider.
In there you can make sure that the DisplayNameAttribute values are resolved into the correct language.
Actually you could even get rid of that attribute and resolve by field names only if that would be any help.
I wrote this article a while ago. It uses a custom view engine.
http://blog.oimae.com/2011/02/20/cultured-view-engine-for-mvc/
And another tutorial for different solution
Tutorial: Create ASP.NET MVC localization with language detection

Resources