Alternative to JSP templates

[This is a cross post. I posted the same thing over at the coderanch: http://www.coderanch.com/t/554956/JSP/java/Alternative-JSP-templates]
Hey,
I've built and worked on quite a number of web applications using JSP for HTML templates.
I always found that the templates would get quite messy and confusing even if you use JSTL instead of scriptlets.
In a few projects I used other libraries for the HTML templates, Velocity for example.
Though, that's just the same in a slightly different syntax. I've also worked with numerous other technologies in Ruby land,
but I'm not happy with them either.
To come to the point of this post: I don't like it very much and so I've created an alternative: Wandledi
To describe it shortly: Instead of including scriptlets or custom tags into HTML files Wandledi uses a separate layer that's only responsible
for transforming HTML markup in order to fill it with dynamic data and so on.
For further information please have a look at http://wandledi.org *.
The idea isn't entirely new, though I don't know any other library that implements it in this way and not only for Java,
but for Scala, too.
The reason I post this here is that I was hoping to get some feedback from Java (and possibly Scala) developers on the whole thing.
Do you find the idea totally ludicrous or do you think it could make sense?
I for one am actually using Wandledi in several projects and I like it very much.
However, I might be a little biased. ;)
Regards,
Markus
* For an actual Java example see: http://wandledi.org/spells/duplication.html
Edited by: user5480329 on 06.10.2011 12:25
Edited by: user5480329 on 06.10.2011 13:33

First off: Thank you for your input.
Please let me point out that Wandledi is in no way a web framework. It is a rather small library merely 'living in the presentation layer'.
889994 wrote:
+"The HTML markup stays clean and can even be edited with HTML editors such as Dreamweaver without getting confused.+" - This kind of argument is pretty widespread. Both ways. If there is some existing text editor for a given format they say - you may use editor XXX. If the format is too new they will tell - you do NOT need any special editor and sell that as an advantage. As of me I call that a "tools oriented approach" - as if starting a brand new technology we should first of all take a decision which editors it will comply to.
In reality developing a technology as a whole (really new ideas included) costs non less than 50 times more than any editor. Editors must follow technology, not vice verse.I agree. This point I added because I thought of it as a little bonus.
It's not something I had considered in the design of Wandledi. I use redcar for everything anyway! ;o
889994 wrote:
HTML files can be changed directly and the view is updated without recompilation. No compilation or runtime errors as a result of changes to templates - they may tell this. If is not a case they may tell something about how it is reliable when everything is compiled in advance.
My 15 years of contact to JSP pages tells me that all end-up with including compilation of JSP as a step of a build. Otherwise you have a convenience of extra redeployments to production.Well, in the end the only thing that brings relative security are integration tests, I suppose.
Cucumber to the rescue.
Still the point of making recompilation unnessary is pretty valuable for development,
because it makes it way quicker if you only make changes to the markup, which happens rather often
when you're trying to circumvent another IE6 bug. ;)
889994 wrote:
"By putting the transformation logic into plain classes you can use the full power of the language (Java, Scala, ...) to describe the view transformations.
This includes inheritance, composition and polymorphism to build up larger, more complex transformations OOP-style." - I have strong doubts that transformation logic is something needed for presentation. What about "the markup is also easier to read for humans, too."? - once you hide all under Java-coded transformations.This is a valid point. You can do all sorts of mischief with those transformations. But that's possible with any technology and it lies in the responsibility
of the developer to be reasonable about it. It's important to point out that you usally do not want to generate HTML with Wandledi (referring to your print("<html>") statement). You merely transform. That is add, remove or change HTML attributes or duplicate portions of markup that is already there.
One of the motivations behind Wandledi is that you should be able to express conditions and loops in an actual programming language instead of a cumcersome surrogate language or tags. The framework you suggested also makes this possible, which is good.
To bring an example of Wandledi for loops.
When you usally would do something like this:
JSP:
&lt;ul class="users"&gt;
  &lt;% for (String user : users) { %&gt;
    &lt;li&gt;&lt;%= user.name %&gt;&lt;/li&gt;
  &lt;% } %&gt;
&lt;/ul&gt;I find this very ugly. The use of EL only improves the situation mildly.
With Wandledi this would look like this:
HTML:
&lt;ul class="users"&gt;
  &lt;li&gt;Hans&lt;/li&gt;
&lt;/ul&gt;
Scala:get("ul.users li").foreachIn(users)( (li, user) => li.text = user.name )What I hope is that already in this small example the markup is more comfortable to read without the obfuscation through JSP. It is to me.
Also it isn't more code, less even in this example. Just put into another file.
Of course this would be less consise in Java. You would need about 5 lines of Java to express the same thing.
889994 wrote:
"The web designer can start building a functioning HTML page locally first without needing a server. Also they don't need to know jack about Java, JSP, JSTL, etc.." I agree. But. That may be said about ANY technology, including the JSP itself.That's not entirely true. What I mean is that the web designer can actually build the page locally and view it in his browser, simply by opening the file he is working on. Of course that is no longer possible once you start building stuff by including other files and so on.
But you can build the components and simply view them in the browser. You can build concrete instances.
Just as I did in the example above by inserting "Hans" instead of some variable name.
You can show the page to anyone with a browser, no fragments. But mock content which will later get replaced with actual content.
889994 wrote:
One big piece missing in your proposal is about components and code reuse in general. That's the thing. It isn't. Because it is already there. You just do it the same way you would do it with your normal Java code.
Because it is normal Java code.

Similar Messages

  • Jsp templates using tiles

    hi all,
    i want to use Tiles in my application for designing jsp templates.
    how can i use tiles?is there any best tutorial with complete example on Tiles in Jsp templates?
    your suggestions are appreciated.
    regards and thanks in advance

    You may also wish to take a look at Sitemesh, a replacement for Tiles:
    http://www.opensymphony.com/sitemesh/
    The AppFuse web app startup environment uses it over Tiles and they seem to be happy with it. (Although it is somewhat more complex to learn.)
    Glen

  • Customization of Search JSP Template in Commerce Server

              Hi
              I am currently amending the search.jsp template provided by BEA in the wlcs/commerce
              folder within Commerce Server 3.5 and according to them, one could carry out searhes
              on virtually any fields within the table provided ie WLCS_PRODUCT.
              I am trying to restrict field searching to the WLCS_PRODUCT_KEYWORD table so that
              the primary keys would be used to do searches on the Product Catalog table.
              Does any one have a good idea on how to do this?
              

    The Javascript is returned inside the page, just as if it were a static
              .html file that you had put Javascript into. Thus it works entirely on the
              client. The client is unaware of whether a JSP engine put the page together
              or whether it is was just a static HTML file.
              Peace,
              Cameron Purdy
              Tangosol Inc.
              << Tangosol Server: How Weblogic applications are customized >>
              << Download now from http://www.tangosol.com/download.jsp >>
              "Bola Taylor" <[email protected]> wrote in message
              news:3b9dd5fc$[email protected]..
              >
              >
              > I am currently using BEA Commerce Server and written some JSPs to be used
              in the
              > application. I am trying to carry out some validation of some fields in my
              JSP
              > and thats how javascript came up.
              >
              > The question I have is that does the javascript that I want to put on the
              jsp
              > run on the server or on the client like a normal html page? The questiion
              sounds
              > basic but I am considering writing a class to carry out validation as the
              user
              > could turn off javascript on browser.
              >
              >
              >
              >
              

  • Need Help In JSP template

    hey guys,
    i need jsp template tutorials or documentations ..... I read the tutorial from sun site, but i could not got clearly...So somebody suggest some web links or something else to help me ..
    Thanks & regards
    Satish
    [email protected]

    JSPs are best used for displaying UI - since you already have it working in the middle layer with Java classes you should keep it that way.
    If you want to pass data back and forth between the Java class that sends mail and the JSP use JavaBeans and make use of jsp:useBean tag and other related tags.
    Also so consider upgrading to JSTL 1.1 , instead of using scriptlets in JSPs.
    I don't know why you want to make it work in the JSP itself. If you still want it to work in the JSP the post more details about what error you're getting - look in the log files if necessary.

  • Jsp template wizard missing?

    Hi,
    jdev prev4
    I found in "Help" that a JSP template wizard is available ( file extension .jjt) BUT I cannot find that template in the "new->all technologies->web tier->jsp"
    I would like to know if that template has been removed in 11g or where is it located.
    Regards

    Hi again,
    1-The JSP template is defined in jdeveloper prev4->help menu->full text search->"create jsp template wizard - welcome" and look for the same title in the results (mine is the 7th and 8th)
    2-by using the JSF-> new JSF Template wizard, there is no option for JSP (and only JSP), then the result template is in JSF format. I'm not sure, but the JSP template was available in 10g
    Maybe, full JSP support is no longer available in next releases of JDev (I understand that), but it is a pity because if you develop a web application by using Ajax and you have enough knowledge of JSPs, you don't need to know anything of JSFs, no extra files (faces-config), no extra libraries, and so on.
    Thanks!

  • JSF JSP Template

    Hi all, I'm using JDev 10.1.3. I have been trying to create some templates for my web pages but cannot get to the wizard. The "JSF JSP Template" item is not available in the "New Gallery". Any help is appreciated.

    It would be very interesting to have a more clear status about templating technology that will be implemented in the adf faces next release :
    1) does the technology be based on tiles, jsp, other
    2) what enhancements oracle plan to developp in templating, do you plan to introduce protected an updateable region like asp.net, do you plan to permit inheritance (extension)
    This is very important for people planing to use this technology at an enterprise level to build current application in a compatible way (reducing migration when the technology will be available) ?

  • How to use myself JSP template for my projects

    I am using JDev 10. .I realized the default templates of JSP in JDev don't match with my projects so I want to create my own template for JSP Pages. I read some threads in Forum about this problem but I am a beginner, I cannot understand fully and don't know the way to create template nor adding it into Project. Someone can tell me where I can find the tutorials, examples(demo).
    Thank you very much.

    Hi,
    The Bex report uses the Standard Template 0ANALYSIS_PATTERN while it is executed.
    So if your sure that the look and feel of all the Reports is going to remain same, you don't need to even attach all these Queries to Templates in WAD.
    When you execute the BEx query, it would pick up the standard template and run it in portal.
    But if you want to customize the Report Template:
    1) You can change this standard template 0ANALYSIS_PATTERN  and customize it according to ur requrement in WAD.
    2) Or you can create a copy of this standard template and change it as required. Then change the template in spro (transaction RSCUSTV27) to point to this Z template.
    Let me know if you need more details.
    Regards,
    Forum

  • ANN: JPlates 2.1 is available - great alternative to JSP

              I know you're all busy with your current projects, but maybe the next
              one will be much easier if you use JPlates.
              JPlates 2.1 is now available for licensed use and evaluation. JPlates
              is a fully object-oriented template-processing system that combines
              many of the best features of Java with great template processing
              features to create a terrific alternate to JSP. JPlates works great
              with Struts and you can replace your JSPs one at a time.
              JPlates generates true JVM classes that are seamlessly compatible with
              Java, and every JPlates method is an executable template. What that
              means is that you can build your MVC views using objects and classes
              and methods (and not includes), just like you build everything else.
              Take a look at http://www.jplates.com, and please follow the link on
              the left side to the note about JSP scriptlets.
              Thanks for reading,
              Dan Jacobs
              Founder, JPlates Inc.
              

    You should always try to keep client and server patch levels syncronised. Client should never be earlier than server. Ideally you should try and install the latest database version (10.2.x) and latest patch (10.2.0.3.0) or if you must work with 9.2.x use 9.2.0.8.0 for the database version you are using. Note 9.2.0.1.0 and 9.2.0.2.0 are not supported for XML DB

  • HTML Server Pages - an alternative to JSP

    Your comments would be appreciated on an alternative approach for
    developing web applications using HTML Server Pages (HSP).
    Rather than convert the Server Pages to Java code, the approach
    is to create the Server Page as an XHTML document and
    process it as XML.
    The id attribute is used to link the HTML tags to the servlet
    code. For example:
    <p id="greeting"> </p>
    The servlet code uses a Framework based on the MVC design pattern. A
    value is displayed by creating a Text Model object and associating
    it with the id attribute.
    The advantage of this approach is that the Server Page can be
    validated against the XHTML DTD and there is a clear separation of the
    HTML and Java code.
    For more details see the Brill Software web site:
    http://www.brillsoftware.co.uk
    Thanks
    Chris

    Thank you 'maesj' and Robert for taking the time to post some very interesting comments.
    Please find below my comments on the points raised.
    Best Regards
    Chris Bulcock
    Also every page redirect, link goes through a kind of a commandservlet that processes the page?The HSP Framework follows the same approach as that used by the JSP Model 2 architecture. The entry point is a Java Servlet.
    You can store and process JSP's as XML, too.The advantage of using XHTML is that a web designer can edit the pages using an XHTML aware editor such as Adobe GoLive and Preview them.
    <p id="greeting"> </p>
    What exactly does this do?The id attribute is used to connect the <p> tag with the dynamic content that is generated by the application. When displaying the page the Framework will get the Text Model that the application has created and insert the contents into the Text Element part of the <p> tag. If the Model contained "Hello World" the HTML sent to the Web Browser would be
    <p id="greeting">Hello World</p>
    How do you do loops?The HSP Framework supports a Table Model for the display of tables. The row HTML is duplicated for each row in the table.
    I think it is a bad idea to use the id since this is normally meant to uniquely identify instances in an XML document. If you want to adhere to this rule you could easily insert the same contents twice in a single page.A number can be included in the id attribute to make it unique within the document. e.g. greeting-1, greeting-2.
    Rather than duplicate the same content twice the common HTML can be placed in a single file and included in other pages as required. The <object> tag is used for this purpose.
    How then does the data get into the XHTML element?The data is inserted by the Framework.
    But you have to bind them together in some place.The id attribute is used to bind the XHTML tags to Model objects.
    Plus: fixing the format to XHTML prevents such things as inclusion of other files. This OTOH would impove the options for a modular design.The XHTML <object> tag is used to include one file (View) within another. With the Brill Software web site the Menu bar and Footer are held in separate files and included into each page.
    Unfortunately I did not find documentation there.The documentation is at:
    http://www.brillsoftware.co.uk/bswebapp/bsservlet?cmd=DisplayCmd&view=UserGuide1
    I would not buy such a framework since there are good and mature frameworks out there - for free.The cost of a framework needs to be considered in relation to the overall cost of a project. If a framework saves you time and effort it may be worth paying for. It depends on what value you place on your time and the time saved by using a particular framework.

  • Best way to design jsp/template structure

    I am trying to create one page comprising of multiple pages without using frames.
    My thought was to create a template.jsp, which has the following includes:
    <jsp:include page="<%=header%>"></jsp:include>
    <jsp:include page="<%=menu%>"></jsp:include>
    <jsp:include page="<%=content%>"></jsp:include>
    <jsp:include page="<%=footer%>"></jsp:include>Here is an example of the question that arises...
    In the HTML code of the 'menu' included page, I have a link to some other page (ex. 'abc.jsp' )
    When clicking on this link, I would like to call the template.jsp with 'abc.jsp' being inserted where the 'content' tag is.
    So, what is the best way to do this without frames?
    Do I have every link call a controller servlet which stores the links in a request. Then the controller servlet calls the template.jsp with the link as a request parameter?
    Is there a built in function in JSP that does this w/o any extra code?
    Any other suggestions/practices that are more common or easier to implement?
    Also, Is there major overhead on including 4 pages each call? Or after it compiles with the included page, the overhead is negligable, until a new page is swapped in place of an existing included page?
    Thank you

    A thought:
    <%
    String content = request.getParameter("content");
    %>
    <jsp:include page="<%=header%>"></jsp:include>
    <jsp:include page="<%=menu%>"></jsp:include>
    <jsp:include page="<%=content%>"></jsp:include>
    <jsp:include page="<%=footer%>"></jsp:include>
    Once everything is compiled, the overhead is in executing the pages. If you pass in a page that hasn't been compiled yet, obviously that would have to be compiled. I haven't tried dynamic includes like that - does it work?

  • AJAX tool for making JSP templates

    Hello, can you help me spread the word for some beta testers for a new open source HTML/CSS design tool?
    All you need is a Windows 98/2000/XP Computer (Mac version is still very buggy) and the latest Firefox browser (version 1.5).
    If you are interested, goto:
    http://www.arrowplain.com/
    and test out the program. It runs within the Firefox browser. The idea
    is to let you visually layout exactly the template you want and let the
    program generate proper HTML and CSS for you. It's like Dreamweaver
    only the code it produces is really clean, good for SEO HTML.
    Looking for bug reports / suggestions on how to make the program better. Please forward to any JSP people.
    Thanks!

    there is no real best one, they all have their ups and downs. It all depends on what you are planning to do with them.
    For me, I like scriptaculous the most because it for one has a nice example suite and the code internally is also easy to follow, making it possible to use the package even where documentation is lacking.Your mileage may vary.

  • JavaMail - Sending Email from JSP Templates

    Is there any existing method of sending emails (I'm using JavaMail) from templates written as JSP files? I've done quite a bit of Googling on the matter, and I'm still a bit new to JSP.
    The solution I'm looking for is a way to have an HTML template for an email with variables embedded, which are to be replaced by data from the servlet.
    I know numerous individuals have run in to a similar situations, so I'm sure a solution exists.

    The content of an email can come from a "DataSource"
    There is an implementation of Datasource that can download from a URL (javax.activation.URLDataSource)
    That means you can write a JSP which will be your "email" and then call that JSP to generate the email text.

  • Advanced JavaServer Pages - JSP Templates

    Great book but example template code not working..
    I am having trouble getting the template example6.jsp working with the code supplied with the book. The code seems to be buggy when attempting to nest regions within regions.
    Has anybody else had this problem ?
    Problem as below
    javax.servlet.jsp.JspException: regions can be created from a template or another region,but not both at
    tags.regions.RegionDefinitionTag.doStartTag(RegionDefinitionTag.java:18)
    at /example6.jsp._jspService(/example6.jsp.java:89) (JSP page line 5)

    Book source can be downloaded at
    http://www.phptr.com/advjsp/
    the source is contained within a jar, the location within the jar is as follows
    \booksource\4\regions_examples\
    Example6.jsp and Example7.jsp, which contain nested regions, are the two examples which are not working correctly.
    There is also a pdf download of the Templates Chapter 4 on the web page. Well worth a read.
    Thanks for any help.

  • DTW Alternative Items - Which Template?

    Hi Experts,
    The subject says it all really.  I have tried oAlternateCatNum but hit errors, and the file contained a column called 'Substitute', rather than the expected 'Match Factor'.
    I cannot see any other likely candidates.  Does it exist?
    Thanks
    Greig

    Dear Greig,
    Unfortunately it is not currently possible to import Alternative Items
    via the DTW.
    You could post your requirement in our SAP Business  One Product
    Development Collaboration forum by using the following thread.
    /community [original link is broken]
    As a workaround you can create a small addon by using DI API to add the
    alternative items in the database.
    Regards,
    Rakesh Pati
    SAP Business One Forum Team.

  • Alternative AppsLocalLogin.jsp

    I want to restrict all users from logging into the system with some exceptions. To achieve this I want copy the AppsLocalLogin.jsp to XXAppsLocalLogin.jsp and provide this to the list of users who are in the exception list.
    I will also replace the AppsLocalLogin.jsp (with information about the cause).
    But when I copy the page to XXAppsLocalLogin.jsp it's not working, it says "page cannot be displayed". What could be the problem???
    We have just patched the EBS with ATG RUP5. In ATG RUP4 it worked.
    Activated logging for Jserv
    [13/03/2009 12:05:35:198 CET] <servletLog> java.lang.RuntimeException: Cannot access oracle.app.fnd.sso
    at oracle.apps.fnd.sso.SSOAccessEnabler.&lt;init&gt;(SSOAccessEnabler.java:47)
    at oa_html._XXAppsLocalLogin._jspService(_XXAppsLocalLogin.java:196)
    at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:119)
    at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java:417)
    at oracle.jsp.JspServlet.doDispatch(JspServlet.java:267)
    at oracle.jsp.JspServlet.internalService(JspServlet.java:186)
    at oracle.jsp.JspServlet.service(JspServlet.java:156)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
    at org.apache.jserv.JServConnection.processRequest(JServConnection.java:456)
    at org.apache.jserv.JServConnection.run(JServConnection.java:294)
    at java.lang.Thread.run(Thread.java:534)
    Found the following in a technical form
    https://metalink2.oracle.com/metalink/plsql/f?p=200:27:3752157369023068857::::p27_id,p27_show_header,p27_show_help:708067.992,1,1
    Edited by: ahlqvism on 2009-mar-13 04:50

    Hi,
    Found the following in a technical form
    https://metalink2.oracle.com/metalink/plsql/f?p=200:27:3752157369023068857::::p27_id,p27_show_header,p27_show_help:708067.992,1,1
    Does it mean that this is no longer an issue?
    Regards,
    Hussein

Maybe you are looking for