alternate of Masterpage of ASP.Net in JSF - asp.net

I got stucked in search of finding alternate of Master page in JSF.I want to convert a web application developed in ASP.Net into JSF.Now when i collided with this application's Master page , then I thought it can be handled by facelets but still I don't know that Is it right approach? Here's the thing, I found that facelets are alternate of user controls of ASP.net So can I use them for Master page?Even this thing clicks me that i am going wrong
Thanks

It's indeed Facelets. Your only other option is JSP, but it doesn't offer any templating capabilities like ASP.NET MasterPages and Facelets. Even more, JSP is deprecated since JSF 2.0.
See also:
Java EE 6 tutorial - Facelets
Facelets 1.x developer guide (skip chapters 1.1-1.4 for Facelets 2.x)
How to include another XHTML in XHTML using JSF 2.0 Facelets?
When to use <ui:include>, tag files, composite components and/or custom components?

Related

What, why or when it is better to choose cshtml vs aspx?

I would like to know what, why or when it is better to choose cshtml and what, why or when it is better to choose aspx technologies? What are these two technologies intended for?
Thank you,
As other people have answered, .cshtml (or .vbhtml if that's your flavor) provides a handler-mapping to load the MVC engine. The .aspx extension simply loads the aspnet_isapi.dll that performs the compile and serves up web forms. The difference in the handler mapping is simply a method of allowing the two to co-exist on the same server allowing both MVC applications and WebForms applications to live under a common root.
This allows http://www.mydomain.com/MyMVCApplication to be valid and served with MVC rules along with http://www.mydomain.com/MyWebFormsApplication to be valid as a standard web form.
Edit:
As for the difference in the technologies, the MVC (Razor) templating framework is intended to return .Net pages to a more RESTful "web-based" platform of templated views separating the code logic between the model (business/data objects), the view (what the user sees) and the controllers (the connection between the two). The WebForms model (aspx) was an attempt by Microsoft to use complex javascript embedding to simulate a more stateful application similar to a WinForms application complete with events and a page lifecycle that would be capable of retaining its own state from page to page.
The choice to use one or the other is always going to be a contentious one because there are arguments for and against both systems. I for one like the simplicity in the MVC architecture (though routing is anything but simple) and the ease of the Razor syntax. I feel the WebForms architecture is just too heavy to be an effective web platform. That being said, there are a lot of instances where the WebForms framework provides a very succinct and usable model with a rich event structure that is well defined. It all boils down to the needs of the application and the preferences of those building it.
Razor is a view engine for ASP.NET MVC, and also a template engine. Razor code and ASP.NET inline code (code mixed with markup) both get compiled first and get turned into a temporary assembly before being executed. Thus, just like C# and VB.NET both compile to IL which makes them interchangable, Razor and Inline code are both interchangable.
Therefore, it's more a matter of style and interest. I'm more comfortable with razor, rather than ASP.NET inline code, that is, I prefer Razor (cshtml) pages to .aspx pages.
Imagine that you want to get a Human class, and render it. In cshtml files you write:
<div>Name is #Model.Name</div>
While in aspx files you write:
<div>Name is <%= Human.Name %></div>
As you can see, # sign of razor makes mixing code and markup much easier.
While the syntax is certainly different between Razor (.cshtml/.vbhtml) and WebForms (.aspx/.ascx), (Razor's being the more concise and modern of the two), nobody has mentioned that while both can be used as View Engines / Templating Engines, traditional ASP.NET Web Forms controls can be used on any .aspx or .ascx files, (even in cohesion with an MVC architecture).
This is relevant in situations where long standing solutions to a problem have been established and packaged into a pluggable component (e.g. a large-file uploading control) and you want to use it in an MVC site. With Razor, you can't do this. However, you can execute all of the same backend-processing that you would use with a traditional ASP.NET architecture with a Web Form view.
Furthermore, ASP.NET web forms views can have Code-Behind files, which allows embedding logic into a separate file that is compiled together with the view. While the software development community is growing to be see tightly coupled architectures and the Smart Client pattern as bad practice, it used to be the main way of doing things and is still very much possible with .aspx/.ascx files. Razor, intentionally, has no such quality.
Cshtml files are the ones used by Razor and as stated as answer for this question, their main advantage is that they can be rendered inside unit tests. The various answers to this other topic will bring a lot of other interesting points.

Which GUI framework/component should I use. I am using Spring MVC with Java and intend to create web applications

Which GUI framework/component should I use. I am using Spring MVC with Java and intend to create web applications
I was looking for something similar to primefaces. But it seems that primefaces only works with spring web flow. I believe only a certain category of applications can be created with spring web flow which could be a negative point for using primefaces with spring.
I could use jquery but the jquery is not as good as primefaces when it comes to quickly creating web pages...
Thanks for the help guys..
I suggest you to have look at Thymeleaf [ http://www.thymeleaf.org ] as a template engine, combined with either mere jQuery or (as you say you consider it a bit too simple) jQuery + backbone.js (which is a javascript MVC framework) [
http://documentcloud.github.com/backbone/ ]
The client side would be well covered with these two js libs, and thymeleaf's javascript inlining capabilities would ease integration a bit...

Is there any analog of ASP.NET master page in pure JSP?

Pls give a link with sample if possible
Sorry, didn't read your question properly.
The answer would be: no.
But, if you can use JSF, Facelets templates are pretty similar to ASP.NET master pages.
According to this article, JSP does not have an equivalent technology:
Although various JSF IDEs offer page
templating to a certain extent such as
IBM page templating, there is not yet
a uniform easy way to build page
templates such as how you use
Microsoft "Master Page" templating
technology.
No, not really. Here is an idea of how you might put one together that sort of works like ASP.NET.
ASP.NET master page is a templating technology. JSP itself is already less or more a templating technology. There's under each the <jsp:include> tag to include templates. You can use it dynamically with EL, but it is however not very advanced/enhanced. Facelets has brought changes in it.
JavaServer PagesTM (JSPTM) technology, previously used as the presentation technology for JavaServer Faces, does not support all of the new features available in JavaServer Faces 2.0. JSP is considered as a deprecated presentation technology for JavaServer Faces 2.0.
On Facelets you can use JSF, which is a component based MVC framework like ASP.NET MVC.
Alternatives outside the Java EE API are Apache Tapestry and Apache Tiles.

Templating engines for Asp.net

Are there any third-party Templating Engines for Asp.net like we have smarty,savant for php ?
Spark: http://sparkviewengine.com/
Your question does not explicitly states what "breed" of ASP.NET you are using, so I guess it is most likely web forms. If this assumption is correct, I would not recommend for you to replace the default view engine. In order to make good use of the build in controls, you really want to keep the abstraction where HTML like elements can be marked runat=server and accessed from the server side code.
If you happen to use ASP.NET MVC, the picture is completely different. Here, there are lots of different view engines available - including NDjango, NHaml, Spark. If you are the type of web developer who care about the templating engines, you are likely to prefer ASP.NET MVC as a whole, and you might want to check it out before starting your next project.

sparkviewengine alternative for WebForms project

I like the html dominated structure of the sparkviewengine very much.
Is there a version of it for WebForms projects?
I want to use it for generating presentation only html (I mean, the output will not contain any html input controls).
Or can you recommend an alternative?
VS.Net 2010 Framework 4.0
thanks for your time
Unfortunately, traditional ASP.NET WebForms does not allow the developer to switch out View Engines. There is only one and that's WebForms. Only with ASP.NET MVC did this concept of interchangeable view engines come about which gave you the option.
If the View Engine in traditional ASP.NET was switchable, then you would have been able to use the Spark view engine because it already understands the <%=blah %> syntax and delegates that rendering, but I'm afraid the extensibility points are just not there...
Update
I stumbled across this blog post which talks about using Spark on the WebForms project - you may have some luck following up on that...
Hope that helps,
Rob

Resources