java - Custom tag - get access to data in model? -


I am creating a custom JSP tag by enhancing SimpleTagSupport. Usually in the scene, I use jstl to draw data from the model using & lt; C: out value = "$ {key.attr}" /> & gt; Someone could do my question is how do I get access to data from a model when I create a custom tag (using SimpleTagSupport)? Thank you.

Just to clarify, I need a custom tag to model some formatting on a piece of data. If a custom tag is not the best way to do this, then I'm open to suggestions (but still would like the answer to my original question)

Update : Bozhos replies Based on this I can get data from the model using JSP reference. Is this usually done normally (i.e. when a custom tag is used to manipulate a Paes data in the first model of display)? Or is it okay to pass data as a parameter for custom tag arguments (such as through tag attributes)? I am just trying to understand the pros and cons of each method thanks.

All data using JSTL has been stored in jsp reference attributes. So you can get, for example, key variable, by calling:

  getJspContext (). GetAttribute ("key");  

These features - There are four scopes for pages, requests, sessions, and applications, so where they are set up.

Of course, you can define a tag attribute instead and pass it in such a way.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -