[jboss-user] [JBoss Seam] - Tip worthy of inclusion in the documentation...
tony.herstell@gmail.com
do-not-reply at jboss.com
Thu Feb 15 15:40:18 EST 2007
Can this be added to the doco.. it's a great tip.
perhaps close to pg 67
anonymous wrote :
| The declaration lets you specify a value or method binding expression that will be evaluated to initialize
| the value of a context variable when it is first referenced.
|
|
|
|
anonymous wrote :
|
| I also use the following in components.xml
|
| |
| | <factory name="basePath"
| | value="#{facesContext.externalContext.request.scheme}://#{facesContext.externalContext.request.serverName}:
| | #{facesContext.externalContext.request.serverPort}#{facesContext.externalContext.request.contextPath
| | }/"/>
| |
|
|
|
| Note this is all one line the forum wrapped
|
| and
|
|
| |
| | <base href="#{basePath}" />
| |
| |
|
| So i can have the view files in different directories, but still resolve the images and css to the root of the webapp with out having to do ../../images/myimage.jpg
|
| I used to use something like this
|
|
| |
| | @Create
| | public void setup() {
| | request = (HttpServletRequest) facesContext.getExternalContext().getRequest();
| | }
| |
| |
| | @Factory("basePath")
| | public void loadBasePath()
| | {
| | basePath = request.getScheme() + "://" +
| | request.getServerName() + ":" +
| | request.getServerPort() + request.getContextPath() + "/";
| | }
| |
| |
|
|
| _________________
| Thank you for your time,
|
| Jason Long
| CEO and Chief Software Engineer
| BS Physics, MS Chemical Engineering
| http://www.supernovasoftware.com
| HJBUG Founder and President
| http://www.hjbug.com
|
|
led to me re-organising my code a lot:
| <link rel="stylesheet" type="text/css" ref="#{basePath}/xmlhttp/css/xp/xp.css" />
| <link rel="stylesheet" type="text/css" href="#{basePath}/css/risingstars.css" />
|
Allowing me to move a lot of pages that users should not access under WEB-INF
| template="/WEB-INF/pages/template.xhtml">
|
Perhaps it obvious to you lot, but saved me a whole heap of headache.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4017207#4017207
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4017207
More information about the jboss-user
mailing list