Question

I am building a webflow app that comprises about 10 screens. My flow definition file defines the flows between all of the view-states, where each view-state is represented by a .jsp view file.

I would now like to introduce the concept of white-labeling the application - being able to present the same flow, but with a different 'skin' or view file, depending on a model property - ${brand}.

I don't think I can do this with css alone. The html markup between brands will be very different, and some of the fields will be presented with different text etc (ie. Brand X might say 'What is your first name', Brand Y might say 'Please enter your forename').

I could put a load of logic in each jsp file to present different markup and text where appropriate, but this feels messy, and I think I'd end up with one massive if/else, with the markup for each brand being in the relevant if/else body.

I could use a view jsp to 'decide' which jsp to show. Something like this:

<view-state id="AboutYou" view="common/AboutYou" />

Then in common/AboutYou.jsp, do this:

<c:chooose>
    <c:when test="${brand == 'X'}>
        <jsp:include page="brandX/AboutYou.jsp" />
    </c:when>
    <c:when test="${brand == 'Y'}>
        <jsp:include page="brandY/AboutYou.jsp" />
    </c:when>
</c:choose>

I can see this working, but I'm not sure how efficient it is - I would have 10 extra .jsp files, where the sole job of the 'common' .jsp files is to decide which branded .jsp to show.

Another way would be to duplicate all my view-states, then put a load of decision-states in my flow defintion file. But this seems really messy and will make for a massively bloated flow def file.

So I was wondering if there is another/better/smarter way of doing this. Perhaps being able to use EL in the flow definition file. Something like this:

<view-state id="AboutYou" view="brand${brand}/AboutYou" />

Would this work? Or is this another way to approach this?

Cheers,

Nathan

Was it helpful?

Solution

I've found the answer to this - you can access the model with # rather than $ Not sure what the difference is, but this works:

<view-state id="AboutYou" view="brand#{brand}/AboutYou" />

This results in it using a view file called brandX/AboutYou.jsp

Happy days :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top