contextpath

jsf context creation

谁都会走 提交于 2019-12-08 08:39:17
问题 I'm here facing a problem with a Java web project. The project I'm working on has been made with standard jsp mixed up with jsf pages. The main page of the application, called main.jsp is a standard jsp page that needs to access a managed bean with session scope created within a servlet filter used to check the authentication of the user. In my web.xml I have set up that faces engine must respond to .jsf and /faces/* request <filter-mapping> <filter-name>extensionsFilter</filter-name> <url

${pageContext.request.contextPath} works fine local, but shows blank live

戏子无情 提交于 2019-12-07 22:12:19
问题 Currently I am using ${pageContext.servletContext.contextPath} or ${pageContext.request.contextPath} to print the context path on the JSP page. It is working fine for the local server, but when I go live it prints blank instead of the actual path. I am able to print the request port number as well as request method, but not the context path. How is this caused and how can I solve it? 回答1: That will happen when it's deployed to root. E.g. as ROOT.war in Tomcat, or having a context path of / .

Struts2 anchor tag doesn't include contextPath

孤街醉人 提交于 2019-12-07 15:20:07
问题 %{#request.contextPath} doesn't work inside an s:a tag in Struts2. (Struts 2.2.1 to be specific.) Is there a way to make it work? It works in other Struts2 tags. Here are two lines in a JSP file in a Struts 2 project whose context path is "/websites": <s:a href="%{#request.contextPath}/clickme" theme="simple">Click here.</s:a> <s:form method="post" action="%{#request.contextPath}/submitme" theme="simple"></s:form> And here is the output: <a href="/clickme">Click here.</a> <form id="submitme"

Run with Netbeans (and Maven) the right context root

时光总嘲笑我的痴心妄想 提交于 2019-12-07 08:24:08
问题 I've got a little problem when I run a project from my Netbeans 7.2 (I also use a Glassfish 3.1.2 Server) ... In fact I'm migrating existing projects from Ant to Maven, my pom.xml are finished and I've used the customisation of the context root as it's described here : http://maven.apache.org/plugins/maven-ear-plugin/examples/customizing-context-root.html but when I run the project from netbeans, it's deployed with the name of my .ear : localhost:8080/MyApplicationEAR-0.1-SNAPSHOT instead of

${pageContext.request.contextPath} works fine local, but shows blank live

試著忘記壹切 提交于 2019-12-06 13:19:06
Currently I am using ${pageContext.servletContext.contextPath} or ${pageContext.request.contextPath} to print the context path on the JSP page. It is working fine for the local server, but when I go live it prints blank instead of the actual path. I am able to print the request port number as well as request method, but not the context path. How is this caused and how can I solve it? That will happen when it's deployed to root. E.g. as ROOT.war in Tomcat, or having a context path of / . The ${pageContext.request.contextPath} will then resolve to an empty string. If you're actually seeing a

Rails 3 routing based on context

强颜欢笑 提交于 2019-12-05 10:27:29
I am trying to implement a "context" system similar to the one used by GitHub. For example, a Post may be created belonging either to the User or one of the Companies the User belongs to depending on whether to User is in the "User" context or a context that refers to one of the Companies. As a part of this, I'd like to be able to do routing based on the user's current context. For example, if the User is in their own context, /dashboard should route to users/show , but if they are in the context for Company with ID 35, then /dashboard should route to companies/35/dashboard . I could route

How to get ContextPath in init() method of Servlet version 2.4

独自空忆成欢 提交于 2019-12-05 05:28:16
I'm using version 2.4 of Servlet and I need to get the ContextPath through the init() method which is called on server start, so I don't have any Request object that could call getContextPath() and because the Servlet version I do not have getContextPath() method in the ServletContext either. Is there a way to get this ContextPath() somehow ? One web application can be published at several different context paths, so the context path (singular) is only meaningful in the context of a particular request. Servlet 2.5 added getContextPath() to ServletContext , specified to return the "primary"

Output Context Node (full path) in XSLT 1.0?

自古美人都是妖i 提交于 2019-12-05 04:22:40
问题 For debugging purposes it would be handy to output the full path of the context node from within a template, is there unabbreviated xpath or function to report this ? Example Template: <xsl:template match="@first"> <tr> <td> <xsl:value-of select="??WHAT TO PUT IN HERE??"/> </td> </tr> </xsl:template> Example (Abridged) input document: <people> <person> <name first="alan"> ... The output from the template would be something like: people / person / name / @first Or something similar. 回答1: This

How to set my webapp to appear as ROOTfor localhost:8080

ぐ巨炮叔叔 提交于 2019-12-04 09:08:26
I've got a webapp in my Tomcat/webapps directory. My app's directory is "site" and is showing as http:localhost:8080/site I'd like to have the site show as http://localhost:8080/ I've read the docs and tried creating a ROOT.xml file in my Tomcat/conf/Catalina/localhost directory to create a ROOT context path but the connection isn't being made. Can someone nudge me in the right direction? Here's the content of that ROOT.xml file. <Context docBase="site" path="/"> </Context> The easiest approach to getting root context would be to simply rename your app's directory from webapps/site to webapps

Exposing Symbols to $ContextPath

江枫思渺然 提交于 2019-12-04 08:10:28
问题 There are a variety of Internal` context functions that are useful, such as InheritedBlock, Bag and StuffBag, etc., as well as many useful Developer` functions. I wish to expose a selection of these symbols such that they may be addressed plainly without the context name, but I do not want to expose all of them by adding Internal` and Developer` to $ContextPath . I could use a proxy symbol such as Bag = Internal`Bag but this is neither clean nor fully correct, since it is a reference, and e.g