Discussions

News: New open source library: VMC Injection

  1. New open source library: VMC Injection (13 messages)

    At our company (vmcreative.com.au) we have started up an open source section (oss.vmcreative.com.au) and we have released our first open source library. The library, called VMC Injection, allows any Java data structure: (JDBC, POJOs, HashMaps etc) to be inserted/injected very easily into a text (HTML/XML etc) template. We use this library in our commercial offerings (web applications) to generate dynamic web pages with servlets, xml generation and latex template generation. This is our first attempt at releasing and managing an open source project and we are looking for feedback. Our open source projects are completely free and are released under the Apache 2 license. A quick example of what you can do with our library: to embed a JDBC ResultSet into a HTML file and return it via a servlet: ShowCustomer.html: Id: #id Name: #name Address: #address Phone: #phone Email: #email ---------------------------------------------------- ShowCustomer.java: public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Target InjectionTarget htmlTarget = new HTMLInjectionTarget("ShowCustomer.html"); // Data ResultSet rs = getCustomers(); HashMap injections = new HashMap(); injections.put("Customers", new SQLInjection(rs)); // Stream response.setContentType(CONTENT_TYPE); OutputStream out = response.getOutputStream(); InjectionStreamer injectionStreamer; injectionStreamer = new injectionStreamer(htmlTarget); injectionStreamer.streamTo(out, injections); } -------------------------------------------------- A couple of the aims of the project are: 1) Completely separate the text/template files (HTML/XML etc) from the program code so they can be worked on ndependently. 2) Allow any Java structure to be inserted without the need to use specific access methods of that structure and avoid having to write loops for structures that have multiple entries (ResultSets, Lists and Arrays etc). 3) Formatting of fields using Java's standard formatting classes (not shown in example above, see the website) More information and download of the library is available at the projects home page: http://oss.vmcreative.com.au/VMCInjection.html We are really interested to find out if people like our idea and any other general opinions they may have of what we are doing. Regards, Mark oss.vmcreative.com.au

    Threaded Messages (13)

  2. SQLInjection?[ Go to top ]

    I'm not sure that you want to associate the term SQL injection with your project. ;) --Matt
  3. Re: SQLInjection?[ Go to top ]

    How is this different from Velocity or any other general purpose template framework?
  4. Re: SQLInjection?[ Go to top ]

    Same question as Steven Goldsmith : Why don't just use existing templating engine or jsp/tagfiles ?
  5. Re: SQLInjection?[ Go to top ]

    Same question as Steven Goldsmith :

    Why don't just use existing templating engine or jsp/tagfiles ?
    It was a chance to try something new and attempt to improve the way things are done. Also this eliminates the need to learn jsp.
  6. Re: SQLInjection?[ Go to top ]

    One of the main differences is the simplicity of the template, no logic or functions are allowed in the template. The design also allows different template styles to be created. There is also direct support for the standard Java formatting classes.
  7. Can someone from serverside please tell me how this spam is getting through recaptcha. We're building a site and using recaptcha to limit the spam, so it would be really interesting to find out if we're not just wasting our time
  8. Suggestion[ Go to top ]

    I just like to comment about why I like VMC. It seems like a lot of framework like Struts, Spring MVC, Webwork etc are heavyweight, trying to do a lot of wiring and infrastructure plumbing to serve the needs for all types of web apps. I think that makes things unnecessarily complex, especially for simple web apps. The good point about VMC is simplicity, much simpler than template framework like Velocity for instance, if that can be a good comparison. One do not need to have too much knowledge about VMC, like providing all sorts of framework dependant import statements in the HTML/JSP. And this is a good thing as there is no "knowledge" of HTML coupled directly to VMC, except the facts that it contains VMC specific tag and # prefixed fields. It will be good if VMC could inject HTML based on CSS class or id, then that will make the HTML truely loosely coupled from even VMC! :) For instance, instead of using irow, igroup or iwindow, maybe VM could use ..., ... or ...? In this case, the browser still can choose to the display the text within span tag instead of ignoring them? Just a thought. I also have a question, does VMC support any POSTing back and saving the values of the fields, injected previously by VMC POJO for instance? In Spring MVC for instance, that will be known as Spring binding. If VMC support automatic binding to the model or the POJO or whatever you call it in VMC's programming model, that would be awesome!
  9. Does not work with JSP[ Go to top ]

    The sample given by this project was written in servlet, it will not work in JSP out of the box. One will receive the error - java.lang.IllegalStateException or getWriter() has already been called for this response This is due to OutputStream out = response.getOutputStream(); I think the method that need to be changed is injectionStreamer.streamTo which should not take Outputstream but rather JSPWriter or JSP's out.
  10. Re: Suggestion[ Go to top ]

    I just like to comment about why I like VMC. It seems like a lot of framework like Struts, Spring MVC, Webwork etc are heavyweight, trying to do a lot of wiring and infrastructure plumbing to serve the needs for all types of web apps. I think that makes things unnecessarily complex, especially for simple web apps.

    The good point about VMC is simplicity, much simpler than template framework like Velocity for instance, if that can be a good comparison. One do not need to have too much knowledge about VMC, like providing all sorts of framework dependant import statements in the HTML/JSP. And this is a good thing as there is no "knowledge" of HTML coupled directly to VMC, except the facts that it contains VMC specific tag and # prefixed fields.

    It will be good if VMC could inject HTML based on CSS class or id, then that will make the HTML truely loosely coupled from even VMC! :) For instance, instead of using irow, igroup or iwindow, maybe VM could use ..., ... or ...? In this case, the browser still can choose to the display the text within span tag instead of ignoring them?
    Simplicity is definitely what we're aiming for and I'm always looking to simplify what we have even more. The span idea is a great one and as I mentioned above the design allows for different template styles and it definitely an idea I'm going to take on board.
    Just a thought.

    I also have a question, does VMC support any POSTing back and saving the values of the fields, injected previously by VMC POJO for instance? In Spring MVC for instance, that will be known as Spring binding. If VMC support automatic binding to the model or the POJO or whatever you call it in VMC's programming model, that would be awesome!
    As mentioned above we have some support classes that we use that we haven't had a chance to open sourced yet, which I think after reading this maybe the next step.
  11. Your view need to know name that was used on data base, it is bad, not!? Maybe .Net guys whant use it :P
  12. Your view need to know name that was used on data base, it is bad, not!?

    Maybe .Net guys whant use it :P
    Can you explain what you mean?
  13. Re: New open source library: VMC Injection[ Go to top ]

    A quick apology for the late replies as I didn't realise the server side had accepted this post. We are always looking to evolve the design and functionality of our projects so thanks for the input and let me know if you have any more ideas. Thanks, Mark :)
  14. Re: New open source library: VMC Injection[ Go to top ]

    Also not mentioned is that we have support for "paging" for long list of records/objects and automatically generating page numbers