Questions tagged [contextpath]

Context path refers to the portion of the web request URI that indicates the context of the request. The context path always comes first in a request URI.

Context path refers to the portion of the web request URI that indicates the context of the request. The context path always comes first in a request URI.

For example - in the http://www.example.com/myContextPath/hello.jsp, the context path is myContextPath.

206 questions
471
votes
17 answers

What are the recommendations for html tag?

I've never seen HTML tag actually used anywhere before. Are there pitfalls to its use that means I should avoid it? The fact that I have never noticed it in use on a modern production site (or any site) makes me leery of it, though it seems…
Kzqai
  • 21,270
  • 21
  • 97
  • 131
78
votes
6 answers

How to use relative paths without including the context root name?

To working my static file (CSS, JS) I have to write absolute path like /AppName/templates/style/main.css. Is there any solution, that I could write relative path like style/main.css?
kspacja
  • 3,960
  • 11
  • 34
  • 40
70
votes
2 answers

How get the base URL via context path in JSF?

I have this structure: WebContent resources components top.xhtml company about_us.xhtml index.xhtml top.xhtml is a component, that is used in index.xthml and about_us.xhtml too. top.xhtml
39
votes
13 answers

Any clever ways of handling the context in a web app?

In Java, web apps are bundled in to WARs. By default, many servlet containers will use the WAR name as the context name for the application. Thus myapp.war gets deployed to http://example.com/myapp. The problem is that the webapp considers its…
Will Hartung
  • 107,347
  • 19
  • 121
  • 195
37
votes
5 answers

Retrieving the servlet context path from a Spring web application

I would like to be able to dynamically retrieve the "servlet context path" (e.g. http://localhost/myapp or http://www.mysite.com) for my spring web application from a Service spring bean. The reason for this is that I want to use this value in email…
balteo
  • 20,469
  • 52
  • 196
  • 362
29
votes
1 answer

How is using "<%=request.getContextPath()%>" better than "../"

I have worked on number of J2EE projects where the view layer is JSP. In most projects, I have seen that we reference external resources i.e. images, javascript, jsp's, css etc. using the contextPath in the scriptlet. The code is as follows, <%@page…
Rahul Shivsharan
  • 2,347
  • 5
  • 33
  • 55
23
votes
7 answers

Spring MVC Request URLs in JSP

I am writing a web application using Spring MVC. I am using annotations for the controllers, etc. Everything is working fine, except when it comes to actual links in the application (form actions, tags, etc.) Current, I have this (obviously…
Snowy Coder Girl
  • 5,162
  • 10
  • 36
  • 65
22
votes
2 answers

Exposing Symbols to $ContextPath

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…
Mr.Wizard
  • 23,689
  • 5
  • 41
  • 116
17
votes
2 answers

How to auto direct to "my web application" from "root (/)" context in JBoss?

I am using JBoss 6.0 . I have deployed my web application: myApp.ear under the web-context: "/test". So in browser-url if I type "http://localhost:8080/test/", I do get my login page (myLogin.jsp). Since my WAR exists inside a EAR file, I have…
javauser71
  • 4,279
  • 10
  • 24
  • 29
14
votes
2 answers

symlinking tomcat 8 directory resources

I would like to symlink JSP directories under Tomcat 8. It worked as well in Tomcat 7 on this way: but seems the Tomcat 8 dropped this feature, and it started to use the Resources (…
user2948919
  • 171
  • 1
  • 1
  • 5
13
votes
1 answer

How can I map multiple contexts to the same war file in Tomcat?

I'm using tomcat to deploy my applications, I would like to deploy as one single war to should server multiple context paths. Currently I have app1.war and app2.war, but both has same contents only name is different to access via http:///app1 and…
Selvakumar Ponnusamy
  • 4,414
  • 7
  • 33
  • 65
12
votes
4 answers

Is there a built-in Spring environment variable for the web context root?

I'm using Spring Web Services to expose a service as a web service. In my spring configuration xml file, I have a bean which is an instance of DefaultWsdl11Definition. One of the properties that needs to be set is the locationUri. This needs to be…
Greg
  • 121
  • 1
  • 1
  • 3
12
votes
7 answers

Whats the better way to identify the context path in Angular JS

I have my web application deployed to tomcat with an applicatio context. For example my URL looks something like this. http://localhost:8080/myapp myapp - is the application context here. Now in an Angular service if i want to call a webservice…
darwinbaisa
  • 628
  • 2
  • 8
  • 11
9
votes
1 answer

Specifying a nested context path in Tomcat using autodeploy inside webapps/

I know that in a default Tomcat 8 configuration I can drop a file foo.war file into the webapps/ directory, and Tomcat will autodeploy my web app with a context path of /foo/. Bu what WAR filename would I use if I wanted the context path to be…
Garret Wilson
  • 14,167
  • 20
  • 115
  • 211
9
votes
2 answers

Context Path in Jboss

There is a war deployed in JBOSS currently. If I want to figure out the context path for the WAR in Jboss, where should I be looking at? Server.xml?
Priyank
  • 13,663
  • 17
  • 69
  • 105
1
2 3
13 14