GeeCON Prague 2014*
The moose likes Struts and the fly likes Where does /struts/ in the url come from? and where does it resolve to? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Where does /struts/ in the url come from? and where does it resolve to?" Watch "Where does /struts/ in the url come from? and where does it resolve to?" New topic
Author

Where does /struts/ in the url come from? and where does it resolve to?

Nathan Russell
Ranch Hand

Joined: Aug 18, 2004
Posts: 75
Hi,
I wonder if anyone can help. I am in the process of creating a new struts2 theme, along with a load of new/updated tags. What I've done is copy the existing template folder and its contents, and have renamed the sub folders to represent my new theme names. So, my starting point is that I have a set of ftl's that are exactly the same as the original ones, and I'm changing the ones I need to.
I now need to change the head template in template/<my new theme>/head.ftl and it has this line within it:

I understand what its doing, and that the resultant uri to the css is /<my web app>/struts/<my new theme>/styles.css - and I understand that it relates to the physical file template/<my new theme>/styles.css - but what I dont get is the /struts/ part of the url and how it maps to the template folder.

I guess its not the end of the world, but I dont really want /struts/ in my url (ideally I'd like it to be the name of my extension); but I would really like to understand how and where this is defined and mapped.

Cheers
Nathan
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

It's part of the S2 "serve static" process, see the struts.properties file for comments regarding its use. I don't know if it's trivially changeable or not.

In the templates you can change it to whatever you want--it's just a URL. You can also change the "templates" directory--you could even try making the value absolute to see if that works. I haven't looked in to modifying any of that, since it doesn't seem like an important issue to me.
 
GeeCON Prague 2014
 
subject: Where does /struts/ in the url come from? and where does it resolve to?