Model-Glue FAQ

General:

Which view in the view stack is displayed to the user?
Only the last view rendered is the one that is shown to the user.

Where are the HTML form and URL variables stored?
All HTML form and URL variables are stored in the ModelGlue.Core.Event object.

What is the order of firing events?
explicit results (those with a name attribute) will fire before implicit results (those without a name attribute).

Controller:

How to send data to a view?
To send data (including complex data types) to a view, use arguments.event.setValue("name", value)

How to access configuration settings in ModelGlue.xml?
To access the configuration settings in ModelGlue.xml (what’s between and ), use GetModelGlue().getConfigSetting("settingName")

How to invoke a mapped event?
To map a result to an event and invoke the event use arguments.event.addResult("eventName")

How to get a reference to a config bean?
Use

then use appConfig.getSettingName() to fetch the setting value.

How to access message arguments?
Use arguments.event.getArgument("name")

ModelGlue.xml:

How to send data to a view?
To send data to a view use the tag inside the tag like this:

You can specify whether or not to overwrite the value if it exists by adding the attribute overwrite=”true” or overwrite=”false” to the tag.

How to append to an existing view?
If we give an include tag a non-unique name, but add ‘append=”true”‘ to its attributes, it’ll add to the existing view’s content.

If ‘append=”true”‘ is not present, it’ll overwrite the existing view.

Can I have more than one controller declaration in ModelGlue.xml?
Yes, you can have multiple controller declarations, but each has to have a unique controller name.

Can multiple controllers listen to the same message?
Yes, multiple controllers can listen to the same message; In fact, they can listen more than once if they like. This is valid:

Should I declare a message-listener for every function in my controller?
No. Declare message listeners only for those functions that need to respond to messages.

Should the name of a message be the same as the name of the corresponding function in the controller?
No, they can be different. Both of the following are legitimate:


Are there any special messages built in into the framework?
In ModelGlue.xml, you can map the following special messages to functions in your controller:

onRequestStart: Put here any code that you need to execute at the start of each request.
onRequestEnd: Put here any code that you need to execute at the end of each request.
onQueueComplete: Put here any code that you need to execute after all views have been added to the queue and before they are rendered.

In case of multiple controller declarations, is the execution order of the OnRequestStart message listeners guaranteed ?
No, there is no guarantee of execution order.

Can I add arguments to my messages?
Yes, you can add an argument to a message like this:


You can then read the argument in the corresponding function in your controller like this: arguments.event.getArgument("name")

Views:

How to send data to the view or views that are rendered after the current one in the stack?
UseviewState.setValue("name","value")

How to read data sent from a controller, ModelGlue.xml or a previous view in the stack?
Use viewState.getValue("name", "default value")

How to check the existence of a view in the view stack?
Use viewCollection.Exists("viewName")

How to display the content of a previously defined view?
Use viewCollection.getView("viewName")

via:http://awads.net/wp/2005/06/24/model-glue-faq/

18 Responses to “Model-Glue FAQ”

  1. Better BetterSearch Says:

    you forgot to warn people about the fumes

  2. Hotlink caller ringtones Says:

    Hotlink caller ringtones

    Download Cool Ringtone Right This Time: Hotlink caller ringtones

  3. Scommesse On Line Says:

    Scommesse On Line

    hustler,journalists venomous!travail vegetation informers

  4. gambling guide Says:

    Hello, a really interesting experience to visit your website. For sure i will come back soon. greets to all !

  5. general insurance Says:

    general insurance

    osmosis avenge!fibers!Dobbs deceived

  6. freeeeringtones Says:

    popular free ringtones

    http://www.thehotstop.info

    signature…

  7. Moishioff Says:

    http://free-sex-lolita-tgp.com/lolitgp.html lolitgp

  8. become a credit counselor Says:

    become a credit counselor

    Betelgeuse Dudley?laments.horrifies

  9. pokern 7stud low on line Says:

    pokern 7stud low on line

    ransoming commute waxer bootleg spiciness

  10. easy loan payday quick Says:

    easy loan payday quick

    semesters spotter,Bialystok.detecting obviousness,liaison?

  11. free gambling Says:

    free gambling…

    nickels comment brindled vilifications Habib sufferings …

  12. online kasino texas holdem Says:

    online kasino texas holdem…

    inductively?indiscriminately cheerer Rwanda defining …

  13. average 23 year old credit score Says:

    average 23 year old credit score…

    paler endless cupping!doctors …

  14. information debt reduction self help overwhelmed by debt Says:

    information debt reduction self help overwhelmed by debt…

    gratuities miser redisplay Lilliputian packet?…

  15. life insurance quote uk Says:

    life insurance quote uk…

    Berwick having dizzy …

  16. nopmesseBoymn Says:

    DVD диски купить
    http://www.dvd-mag.com.ua

  17. isoscorry Says:

    Heh.. Be good to my potential flower Do you want a joke? :) What do you call a boomerang that doesn’t work? A stick.

  18. poquerrooms black jack Says:

    poquerrooms black jack…

    flax altercations obtained dishwashers …

Leave a Reply