Annotations in web applications - struts2

I want to know why Annotations are preferred over XML in Struts2 Applications?

It's easier to refactor code with annotations than refactor code and then find out you broke your application because you forgot to change the XML file. This is more of a general answer than just for Struts 2, though.

Related

How to use the shared layout with the swagger UI (ASP CORE)

I'm using swagger to make a documentation to my API in ASP.NET Core.
And, I would like to use the shared layout to get the same menu on the top of the documentation page.
I would love to do it without re-creating a custom css file, like the documentation says.
I just hope that someone though the same as me, and I was wondering how.
Thanks in advance,

How to use plugins in php mvc framework

I want to know that , i am using my own (modal view controller) framework and want to add some plugins like live chatting ,Facebook/g-mail/twitter (sign up/sign in using these websites).
type of features how can i do this?
I am novice in this field so sorry in advance if my question has some stupidity.
I am using notepad++ editor.
thanks in advance.
Use observer pattern or Event dispatcher pattern for plugins.
Have a look how other frameworks allow you to implement these features.
If one of those features just need js/css and custom html markup to work (like a Facebook like-button for example), you might find some inspiration from Zend Framework's View Helpers.
Search through github/packagist if one of those features has not yet been developed. If you find some library, find a way to use it in your custom code.

TypeScript in MVC

Im bulding a website using MVC4. Recently I've read about TypeScript. It looks really nice however I cannot find any use for it in a MVC website. Am I missing something? Do you use it? Where?
TypeScript is a pre-compiler for JavaScript. Hence you can use TypeScript only as a replacement for JavaScript (server-side, e.g. Node.js, or client-side, i.e. in the browser).
As you are probably writing MVC4 code with C#, TypeScript will be of no use for you in relation to MVC4.
Regarding the client-side it's somewhat different.
I guess the main point you need to know is that TypeScript is not (yet) just another language on the server, that you can exchange with C#.
I find it quite useful for building largish apps with lots of logic on the client. The interfaces help avoid some errors. It compiles to javascript so you could use it instead of javascript. If you're just writing a couple of lines I wouldn't bother though.
You can link to the generated javascript files from TS files directly in the script bundles or HTML. If you want to automatically link to many JS files, use require JS. This will save you having to link to many js files.

Map a struts2 action result to a controller instead of a jsp

I'm working on on a site built using struts2. The vast majority of our targets generate xml, so mapping the result to a jsp page makes sense. A couple of our targets actually generated binaries. I'm wondering if there is a convenient way to say that the result should come from a servlet/controller instead of a jsp.
Obviously this could be done by modifying the web.xml so the struts filter doesn't apply to those targets and mapping those targets as servlets, but this is non-ideal. Currently, the struts filter applies to the entire site, and we would like to keep it that way.
Ideas?
Thanks!
I am not sure I understand you scenario, but it seems to me you want the Stream Result
Here you can find an excellent tutorial with code examples about Struts2 file upload and file download that covers the Stream Result:
http://www.jeetrainers.com/struts2-course/chapter12-13-1-1#slide

How to add a skin engine to asp.net MVC system

I'm implementing a solution in ASP.NET MVC that later can be applied to couple of other fields. To do so it will require to re-brand the UI even though the underlying business logic wont need to change. I'd like to write the code in such a way that will allow other developers to only develop code that will only changes the UI. This is similar to the way that themes can be written against Wordpress Blog software.
Can any one suggest how to organize my project to make such feature work?
http://pietschsoft.com/post/2009/03/ASPNET-MVC-Implement-Theme-Folders-using-a-Custom-ViewEngine.aspx
I would not use bult in Themes (not actually sure if these still exist in MVC) But you could multiple sets of CSS (with related images) in a Themes folder with a separate path per theme eg: Themes\Default, Themes\Classic, etc where the only configuration is the Path element. This would split the styling from the core code and you would'nt need to use any Theme "Engines" etc.
In your MasterPages/Pages/Views you could just set the path to the stylesheets dynamically.
Have you tried using MasterPages?

Resources