Dynamic Tiles Template with Spring 3.0 - spring

I'm currently developping an application with Spring 3 and Tiles 2.
I have a question regarding Tiles and the dynamic contents.
I would like to have a "header" template, that contains a menu that is populated with database information.
As the menu is available through the application, i would like not to put the information in the request controller.
Do you have any information ?
Thanks

The solution was to use a ViewPreparer on the menu definition.

Check out this tutorial that can help you with
spring to tiles integration,
definitions with wildcards,
implementing a fallback pattern using the OptionsRenderer, and
definitions composition.
http://tech.finn.no/the-ultimate-view-tiles-3/

Related

View technologies for a spring mvc web application

I'm developping a web application with Spring MVC, and I'm totally new in web design I want to write my Views, but i don't really know how to design all of that, I need about two views, One form for an advanced search for items, and the other for viewing results.
is there any framework or facilities that i can begin with ?
I've skimed view Technologies part in the spring documentation, I found:
JSP/JSTL
Tiles
Velocity & Freemaker
XSLT
Is that all i can use ? which one you recommand.
The mostly used view implementation (which also has best tool support) is JSP/JSTL.
From the Velocity/Freemarker family (sort of) you can look at ThymeLeaf - it's clean and really easy to learn. It also gives you ability to use natural templating - HTML files which, without changes, work in web application (as SpringMVC views) and when opened directly in browser.

Meaning of tag of struts.xml file of a Java EE projects using struts 2 spring 3 and hibernate

I'm trying to make a project using struts 2, spring 3 and hibernate, but when I come to the step to write the struts.xml, I couldn't find a site which gave an explanation about the tag (and their attributes too) used in this file (tag such as package, action, result etc).
So is there any tutorial or refcard that gives an explanation about them?
What is the role that has in a Java EE project?
There are complete information about the various tags/attributes there layout in the xml DTD file. If you will use any IDE for the development it tend to give complete information about the elements and allowed attributes as well there positions.
Here are the links for some of documents for details
The Struts 2 Document Type Definition (DTD).
configuration-elements in struts.xml
Hope this will help you

AbstractWizardFormController OR Spring webflow

What is the difference in using AbstractWizardFormController OR Spring Webflow. How should one decide which one to use in a given scenario.
EDIT:
Is there any benefit of using one over the other?? Does Spring Web Flow provide additional advantages? I am a newbie in Spring and therefore am not very sure of what each of these provides.
Thanks!
AbstractWizardFormController is deprecated. For that reason alone, I suggest not using it, and either use standard annotated Spring MVC controllers, or using WebFlow. Which you use depends on the complexity of your flow.
The wizard form controller is Spring 1.0 vintage; web flow came afterwards. I'd say web flow should be preferred, unless your flow is so linear that the simplicity of the wizard is compelling.

Does Spring provide a clean way for building menus?

I'm building a menu with Spring and I'm trying to understand if there is a clean way of doing this. By clean way I mean some module that allows the following:
create a link on a menu entry only if the page shown is not the one to be linked;
apply some CSS class depending on the condition above.
I've just ran accross the spring:url tag: does it have anything to do with what I'm looking for?
No, this is a complexity of user interface way beyond that offered by Spring MVC. You need something higher-level such as JSF or maybe a javascript framework like jquery-ui.
Of course, you could build it yourself using the low-parts provided by Spring MVC, but it's going to be a lot of work.
I would recommend you to have a look at Tiles 2 in combination with SpringMVC. Sample app available on Spring By Example, search for Simple Tiles 2 Spring MVC Webapp.

DOJO with spring framework

I am new to Spring as well as Dojo. I need to use Dojo with one of my mvc project in Spring 3.0
I came accross below link which talks about using spring-js with Dojo.spring-js part of spring framework?
http://static.springsource.org/spring-webflow/docs/2.0.x/reference/html/ch11.html
I could not really follow that link, is there any step by step tutorial which will show me how to use dojo with spring framework 3.0 ?
I need to start with simple things with Dojo like client side validation of forms.
Thanks in advance!
This is a tough question to answer, because it turns out you don't really need to worry about how Dojo and Spring interact. Your client and your back end server are completely unrelated until you decide to send data back & forth.
So for dojo, you probably want to look at how to use some of the form validation. Take a look at this link for some help on that:
http://o.dojotoolkit.org/book/dojo-book-0-9/part-2-dijit/form-validation-specialized-input
Once you have some validation in place, your form can use the normal form post to post your data to the server, same as how you would do it without javascript.
On the other hand, if you want to add some nice Ajax to your application, take a look at this link which explains how to implement Jackson marshalling/unmarshalling to send JSON data to Spring & handle responses correctly.
http://blog.springsource.com/2010/01/25/ajax-simplifications-in-spring-3-0/
Spring Roo uses Dojo, so you can create a Roo Project and have a look like they did it.
For Spring, You can follow this tutorial (Its the most compact and covers all basics):
http://www.tutorialspoint.com/spring/index.htm
And for Dojo The best tutorial is at: http://dojotoolkit.org/features/desktop
(in Create Beautiful User Interfaces subheading youll find all the APIs and their examples)
Its the way I learnt it. :)
Cheers

Resources