jsf - Dynamic bean properties for EL by implenting java.util.Map#get -
I have a @session squid bean which I would like to use as a map so that I can use my properties EL Can I do this by implementing java.util.Map to implement the view object (object o) with my application logic. Throwing an unsupported exception to all other accelerated map methods.
@ session: SCOXED @ Nominated Public Segment MyBean Apply Map & lt; String, string & gt; {@ Override Public String (object's) {// Application logic here} @ Override Public Boolean (object's) included (new unsupported operation expansion); } / / All other map methods are included as overrides. Key}
Properties are read only and I only need to use the method obtained from my code, Is not it safe to implement?
Is there a better way of defining dynamic properties for EL in the bean? It would be better to store this map as a session attribute, so you should get a You can enter EL directly: From the comments: The issue is that my bean is not actually a It looks like you will need to implement the @ sessioncached
Public Zero Dictathed Cutet () {// To declare the variable as myBean for compatibility with your current code map & lt; String, Object & gt; MyBean = new Hashmop & lt; String, Object & gt; (); // fill my bean ... // ... in my Bean session FacesContext.getCurrentInstance () .getExternalContext () .getSession (wrong) .setAttribute ("myBean", myBean); }
$ {myBean ['key']}
map
in the method of receiving logic based on the key I get Required I (...) In my case the business logic is not expensive in the recipient. Map
interface in any way. Instead, modify the wheel to throw expanded unsupported operation exposure
from the class implementing all methods like hashmap
or LinkedHashMap
, or To mark the methods or a class that implements the map
but it does not apply at all, like, and leaves other methods blank: < Code> @named @ session-scripts public category MyBean AbstractMap & lt; String, Object & gt; {@Override Get Public Objects (String Key) {// Add Your Logic Here ...} @ Override Public Zero Set (String Key, Object Values) {// Nothing ...} // Other Unnecessary Methods same. ..}
Comments
Post a Comment