Sign in

E-mail *, (xx@domain.com)
Password *

Register | Forgot password

Question regarding tag

The "WCB: JSP front-end design" forum contains threads on issues that are related to JSP front-end design while programming a WCB (WebManager Component Bundle). The Presentation & Element component contain JSPs that will be used for front-end rendering. Ask your questions related to these JSPs here. Some example topics: integration of AJAX, use of the taglibs, how to handle multiple websites, and so forth.

Answered
Not marked as answered yet

Forums  >  WCB: JSP Front-end design  >  Question regarding <wm:render> tag


Author Question regarding <wm:render> tag
gerben.spil


Posts: 5

Posted: 01-07-2009 15:25

Hello everybody,

I was wondering what the sentence

The <wm:render > tag renders the object ${element} using whatever presentation is associated with the object in GX WebManager.

means. I was looking for a way to render my new custom mediaitem without changing too much code and stumbled upon the taglib reference and the wm:render tag.

Can one associate a presentation with an object? Or are the associations something you can't configure and should you use an instanceof statement to test for my custom mediaitem? In other words, can I use

<wm:render object=${element} />

for my custom mediaitem or should it be

<wm:render object=${element} presentationName="renderMyMediaItem"/>

?

Thanks in advance,

Gerben

williamb



Posts: 199

Posted: 01-07-2009 16:24 Helpful

Hi Gerben,

You might want to use a combination of both ;)

Just an example:
1. Create an new MediaItem (e.g. FAQ).

2. In `WM mediaItemContent` mediaItemContent.jspf add a
<c:when test="${wmfn:instanceOf(current, 'nl.your.FAQArticle')}">
<wm:render presentationName="content FAQ" object="${current}" />
</c:when>

3. Create the 'content FAQ' just like you want it.

gerben.spil


Posts: 5

Posted: 01-07-2009 16:35

Hi William,

Your example is very helpful, thanks for the quick answer.

But my assumption is correct, that I can not associate a presentation with an object? As soon as I create a custom mediaitem I have to insert a switch/test statement to render the correct presentation?

patricka



Posts: 247

Posted: 02-07-2009 10:41 Solved

Hi Gerben,

You asked:

Can one associate a presentation with an object?



Depending on the type of object, Yes We Can! In the edit environment you often assign specific presentations to objects (pages, elements, form parts etc.). If you get hold of such object you can <wm:render> it without naming a specific presentation.

But my assumption is correct, that I can not associate a presentation with an object? As soon as I create a custom mediaitem I have to insert a switch/test statement to render the correct presentation?



In general your assumption is wrong as I explained above, but in this particular case it is correct.

You cannot select a particular presentation in the Media Repository, therefore there is no default. So in this case, you will have to define the presentation with which you want to render the object.

Greetings,

Patrick

Paxlie



Posts: 64

Posted: 02-07-2009 15:03

There is something to consider though. You can not use any Presentation Variants with the wm:render.

You can only use presentation names in the way they are declared in the .xml descripter file.

williamb



Posts: 199

Posted: 02-07-2009 22:45

You can not use any Presentation Variants with the wm:render.



Are you quite sure about this? If you have the namings consistent my best guess is that this should work (maybe bug if it doesn't?).

For 'Page parts' I'm quite sure you can just select the correct presentation variant as long as you match it in the 'page part' tab.

Although I would not recommend it at all, since in an OTAP-street it's not really nice to work with presentation variants. Better is to have 2 jsp's where 1 just calls the other one with variables set (hey, here we can use wm:render again ;D).

Paxlie



Posts: 64

Posted: 03-07-2009 10:36

I tried it 2 days ago and it wouldn't work. We are using separators in mediaitems so I tried to call "wm content 0-1"

I got an error that it couldn't be found. I didn't think of the fact that you could also send variables with the render call so I fixed it in a different way, but I'm sure that wm:render didn't work for a presentation variant.

patricka



Posts: 247

Posted: 06-07-2009 10:10

williamb wrote:

For 'Page parts' I'm quite sure you can just select the correct presentation variant as long as you match it in the 'page part' tab.

Although I would not recommend it at all, since in an OTAP-street it's not really nice to work with presentation variants.



Which is why I made this change request a year ago.
Gief OTAP-enabled descriptor files plx!

Greetings,

Patrick

pimk



Posts: 11

Posted: 10-07-2009 10:21 Helpful

I voted for this issue in Jira: the xml solution looks great.

A few questions though I'd like to discuss, before adding comments to the issue:

- What would be the best way to set the value for Page type presentation properties? By name? By id...?
Maybe this should be editable in the interface (regarding the comment from PatrickA in the issue that the interface should become readonly)?

- Are there any other property types that need 'non-textual' values and are still used (framework, color, image, font or button are valid options as far as I know, but does anybody use these anymore)?
How should these values be set?

- Shouldn't the xml format PatrickA suggests in the issue also support the addition of the preview image? This 'hidden feature' should be supported through the xml as well (also for the default presentation, which is currently not possible either)

- while we are at it: it should be possible to set the Ranking through the xml.

williamb



Posts: 199

Posted: 10-07-2009 22:45


What would be the best way to set the value for Page type presentation properties? By name? By id...?



I wonder what you mean with this. Page is just like any other presentation? Only pageparts are a bit different.


'non-textual' values and are still used (framework, color, image, font or button are valid options as far as I know, but does anybody use these anymore)?



Image is used sometimes on sites I've seen, though the way to configure it (via styles) is a bit 200x. Image should still be able to set via an URL or via the style properties of the page in my opinion (just like it's done now, but maybe in a more 2010 way with the object manager etc.).


Preview image/ranking



Absolutely! Preview image can help editors a lot to visualize, though it's hardly used now (I've never seen it in production environments yet!).

patricka



Posts: 247

Posted: 11-07-2009 08:54

pimk wrote:

I voted for this issue in Jira: the xml solution looks great.



Why, thank you!

A few questions though I'd like to discuss, before adding comments to the issue:

- What would be the best way to set the value for Page type presentation properties? By name? By id...?
Maybe this should be editable in the interface (regarding the comment from PatrickA in the issue that the interface should become readonly)?



Since pages do not have unique identifiers (think multiple machines in DTAP; pages might have different ids), the only way to safely point at them is through the use of labelled special pages. So adding an XML parameter that holds the page label would do the trick.

- Are there any other property types that need 'non-textual' values and are still used (framework, color, image, font or button are valid options as far as I know, but does anybody use these anymore)?
How should these values be set?



I'd say evaluate the actual usage of e.g. "framework" or "button". For the others text there already is a way to set the default that works. So setting the value of a variant will work just as well, just mimic that.

- Shouldn't the xml format PatrickA suggests in the issue also support the addition of the preview image? This 'hidden feature' should be supported through the xml as well (also for the default presentation, which is currently not possible either)



Sure, that could be included in the format.
But like williamb says: I have never ever in my whole life seen it in use, nor do the manuals explain how to use the feature, or how it helps in the edit environment, nor do any elements make use of it (where's that screenshot when I select a presentation from a pulldown?).

- while we are at it: it should be possible to set the Ranking through the xml.



Yes, that is a good one. Actually, all your points above are good ones and indicate that the GUI should be mimiced closely in XML.

I'm in favor of supporting the good and useful ones and dropping the ones that seemed nice at the time but are not used at all (e.g. previews, frameworks). Extending the XML is a new feature, so we do not really have to worry about backwards compatibility or feature completeness. I would put the focus on supporting DTAP as much as possible.

Greetings,

Patrick

P.S. Now go vote for issue GXWM-5116 if you haven't already!

Back to top

New message: "Question regarding tag"
Message:
bold boitalicd underline url quote code smile cool eek grin mad razz sad wink
 
© 2010 GX creative online development B.V.

Disclaimer

This website (GXdeveloperweb.com) may discuss or contain opinions, (sample) coding, software or other information that does not include GX official interfaces, instructions or guidelines and therefore is not supported by GX. Changes made based on this information are not supported.  GX will not be held liable for any damages caused by using or misusing the information, software, instructions, code or methods suggested on this website, and anyone using these methods does so at his/her own risk. GX offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this website, including any liability resulting from incompatibility between the content of this website and the materials and services offered by GX. By using this website you will not hold, or seek to hold, GX responsible or liable with respect to the content of this website.