Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JBoss/WildFly and the fly likes context root change Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "context root change" Watch "context root change" New topic
Author

context root change

ravikumar dan
Greenhorn

Joined: May 02, 2012
Posts: 2
Hello all
I am new to JBOSS. I have a requirement to add the context root of our url like http://localhost:8080/myapp/Test previously it used to like http://localhost:8080/Test. For this requirement I added the jboss-web.xml file in the WEBINF folder . in that I added the context root like <contextroot>/myapp</contextroot> for my war file. After deploying In my application images and CSS and java script files are not loading . the images and java script files are referencing old path like (files/images/spacer.gif) how can i redirect to new path (/myapp/files/images/spacer.gif) with out changing all references . can you please suggest me a solution

Thanks in advance,
Ravi
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Ravikummar, welcome to Java Ranch!

1) Which version of JBoss AS?

2) Where are your image, CSS and JavaScript files located? Within your WAR file or elsewhere?

3) I assume that your JSPs and servlets are working fine with the new URL, especially as you move from page to page, but could you confirm that...

4) Are you using any particular web application framework, such as Struts 2, Spring MVC, Stripes, JSF, etc?


JBoss In Action
ravikumar dan
Greenhorn

Joined: May 02, 2012
Posts: 2
Hi Johnson,


My Version of Jboss AS is 5.1 . We are using Spring frame work(MVC,WEB flow). The images, CSS and Java script folders are included in the WAR file. You are very correct. MY JSP's and servlets are working fine.Can you please tell me where i did mistake. Thanks for you response.

Thanks,
Ravi
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

What URLs are used by the references within your generated HTML pages? For example, pick an image that is not showing up, what is the contents of the tag? Same question for the links for CSS and .js files.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: context root change
 
Similar Threads
configuring jboss
How to setup the same application (multiple instances) running on different ports under Tomcat 6.0.x
Tomcat6 context path error
Problem with the Contextpath in the url
Creating own servlet application