0

System properties access in .zul

asked 2012-09-14 23:37:58 +0800

yapith gravatar image yapith
9

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.

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2012-10-09 08:18:06 +0800

MontyPan gravatar image MontyPan
435 3
http://xitop.blogspot.com...

updated 2012-10-09 08:18:44 +0800

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

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-09-14 23:37:58 +0800

Seen: 198 times

Last updated: Oct 09 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More