-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
I would like to be able to do conditional URI forwarding. Something like <?forward uri="some_uri" if="system_properties_is_set"?> in a zul file.
I intend to set System properties using JVM args.
How would I go about doing this?
Thanks in advance.
Hi yapith,
You can set the attribute of (JSP)application object, then get it by EL.
My suggestion is use ServletContextListener, like this:
import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; public class InitServer implements ServletContextListener { public void contextInitialized(ServletContextEvent sce) { //replace: read system property sce.getServletContext().setAttribute("foo", "foo"); } public void contextDestroyed(ServletContextEvent sce) {} }
in ZUL:
<?forward uri="browser.zul" if='${foo eq "foo"}' ?>
Remember set "listener" element in web.xml
Regards,
Monty Pan
Asked: 2012-09-14 23:37:58 +0800
Seen: 198 times
Last updated: Oct 09 '12