I'm writing a MVC portlet framework and I plan to use Rythm inside my views. I would like to pass various arguments to the view and was wondering if there is a way to declare these arguments for the view using Java at runtime? I know that I can declare arguments in the view using the @args tag and that I can add custom tags from Java, but I wanted to do something similar to how ASP.NET MVC passes helper classes (HtmlHelper @Html, UrlHelper @Url, Object @Model) to the view.
1
There are 1 best solutions below
Related Questions in RYTHM
- Do not escape URL or data URI
- How to properly implement an audio latency test with pygame
- Rendering/Displaying null values from java bean
- Using lambda expressions with Rythm Engine
- How can I force Rythm to parse and compile all templates in the home directory on init?
- Rythm can't @import a template if invoked by a parent template
- rythm engine in parallel processing Issue
- Is there any way to recursively invoke a Rythm template based on some condition?
- Rythm engine ClassFormatError: Incompatible magic value
- How do I escape the single quote in Rythm?
- Rythm template reload in prod
- Rythm Template Inheritance
- Template framework benchmark
- Implement multiple languages in IntelliJ plugin
- Add Arguments to Rythm template using Java
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
If all the arguments you planned to pass to the view are global (i.e. they applied to all render session and to all templates) then you should treated them as implicit variables, meaning template author don't need to declare them but they are free to use them. Examples of implicit variables are session, request, context etc.
For how to declare implicit variables, you can refer to:
For how to configure Rythm engine with your implicit variable, refer to
For how to inject implicity variables into rythm engine for each render session, you can also refer to:
For things like
HtmlHelpermy recommendation is to provide reusable rythm template as tags instead of Java object. Because you need to render html snippet, thus using rythm is a natural way to go instead of let the Java code to output the content.For things like
UrlHelperif it is all about String manipulation, you can go straight with Java code, but probably the public static method is more appropriate than helper instance