how to implement the struts project into my own project? - struts2

As a trainee I have been working on a project, a java web application. Till now i have used javascript and jquery for validations but now I also know struts 1.x and struts 2 and want to apply that instead of javascript... So I have to copy all the files from my struts app. into my project folder in net beans ... I mean all the specific file like the one's in web-inf i have to copy them exactly ?
Or there's another way of doing it in net beans like merge projects or something ?

Related

Include more than one filter from existing JAR into a Grails project

I have a Grails project and want to add existing filters from a JAR file.
I used the WebXmlConfig plugin, mentioned in this answer:
How to add filters to a Grails app
and that worked great for a single filter, but I can't figure out how to extend that to more than one filter.
Do I need to change approach and edit the web.xml template directly?
I'd use the pluginator plugin and put the definitions in doWithWebDescriptor just like you would in a plugin - you can add as many elements as you want. It's a slick plugin that lets apps do things that are generally only supported in plugins, like conveniently editing web.xml (although with a seriously weird DSL) and registering custom artifact types.

Struts 1 or Struts 2 . Which one is advisable for web application development?

I am little bit confused to choose Struts 1 or Struts 2 for my new web application development assignment. Could any one suggest me which framework should I use for development from architecture point of view? What are the points I should take care of to choose the struts version before I go for development of the application?
Any help will be appreciated.
Hi I prefer struts 2 because,
Struts 1.x
In struts 1.x front controller is ActionServlet
In struts 1.x we have RequestProcessor class
In struts 1.x we have multiple tag libraries like html, logic, bean..etc
In struts 1.x the configuration fine name can be [any name].xml and we used to place in web-inf folder
In struts 1.x we have form beans and Action classes separately
In struts 1.x an Action class is a single ton class, so Action class object is not a thread safe, as a programmer we need to make it as thread safe by applying synchronization
In struts 1.x we have only jsp as a view technology
Struts 2.X
In 2.x front controller is FilterDispatcher
In 2.x we have Interceptors instead RequestProcessor
In 2.x we do not have multiple libraries, instead we have single library which includes all tags
In 2.x the configuration file must be struts.xml only and this must be in classes folder
In 2.x form bean, Action classes are combinedly given as Action class only, of course we can take separately if we want
In 2.x an Action class object will be created for each request, so it is by default thread safe, so we no need to take care about safety issues here
In 2.x we have support of multiple view technologies like velocity, Freemarker, jasper reports, jsp.
Since you have mentioned that it is going to be a new web-application,Just go with Struts2.Struts1 has already in EOL which means there will be no loner support for the Struts1.
Also Struts2 is a new and very flexible framework and will provide you a lot more control.Here are
Choose latest version of Struts2 to start work with (2.3.15.1)
If you are planning to write your service layer in Spring, you can use Struts2-spring plugin to let spring DI manage struts2 component for you.
Since you seems new to Struts2, i suggest to pay special attention to OGNL which is a core building block in struts2 and you will going to use it a lot in your Tags at UI.
Struts2 has a very flexible plug-able architecture which let you to create as well use many plugin which can save your time to build functionality from start.
Hope this might help you.Additionally You can review and look in to other MVC framework also
I also prefer going with Struts2 itself rather than Struts1 because Struts1 is old and its EOL has been announced on September 1, 2013 with the message "the Struts 1.x web framework has reached its end of life and is no longer officially supported."
[Source:- wikipedia.org]
So it is better to go with Struts2[i have been using version:-2.3.1.1 as I faced some "Dispatcher error"(jar files in the package were not compatible with each other) issue while using 2.3.16 version]
Hope this might help.
I've had a similar dilemma as you do, but instead of going with Struts, I've chosen Tapestry after some consideration.
Some of its awesome features are
Pages as POJOs
Really good dependency injection
Scalable
Easy to learn with lots of examples
much more...

sharing views, css, javascript between multiple asp.net mvc 3 projects

It seems to be impossible/hard to share views between several asp.net mvc 3 projects. At least, that's what Google tells me. Please correct me if I am wrong ...
What's about css and js files? Did someone do this already? If so, what is the best practice to achieve this (within a vs studio 2010 solution with several asp.net mvc 3 projects)?
Just curious, is it possible to share css and js between mvc3 areas?
Since you mention svn - it has "svn:externals" property that lets you map a folder (even from a different repository) to a location under the web site root folder. We used it with success to reuse multiple library tools with external resources (scripts, css files, images and views) in a number of MVC applications.
There is a cool way to share js, cshtml, css etc. files using "Add as Link" feature of VS. There is a great answer here describing the whole process. Also dont forget to add a build task to copy the files on build so you'd be able to debug them.

ASP.NET MVC's Content/Themes/base Directory

What's the purpose of the Content/Themes/base directory in an ASP.NET MVC application? I see that it has some images (which as far as I can tell, are not used); and a bunch of jQuery CSS files.
What are these files for? Are they used by default in a new ASP.NET MVC application?
jQuery UI is included with new ASP.NET MVC projects; these files are used by all the different widgets. If you're not going to use jQuery UI, or if you want a custom download package (available from their website), you can delete all of these files (and the references to them in the layout/master page file).

Is it possible to add Grails MVC classes at deployment time?

I'm writing a Grails app which I'd like 3rd parties to augment at runtime. Ideally they would be able to add a JAR/WAR to the webapp directory which contains new domain, controller and service classes, new views, and other content.
Is there a simple way to do this within grails? Would it be simplest to create a startup script which copies the new classes etc. into the relevant directories and then updates grails.xml and web.xml?
You will be able to do this in version 2 of grails in which plugins will be also OSGI plugins http://jira.codehaus.org/browse/GRAILS/fixforversion/15421
It seems that the Grails plugins will actually fit quite well for this: http://www.grails.org/Understanding+Plugins
A plugin can do just about anything... One thing a plugin cannot do though is modify the web-app/WEB-INF/web.xml or web-app/WEB-INF/applicationContext.xml files. A plugin can participate in web.xml generation, but not modify the file or provide a replacement. A plugin can NEVER change the applicationContext.xml file, but can provide runtime bean definitions

Resources