javajbossstruts2static-content

Static files movement from Application server- Configurations in JBoss


I tried to move the static contents of my application from the application server.

So I defined a path and put them into it.

My server.xml of jBoss has

<Host>
<Context docBase="D:\UI" path="/ui"/>
</Host>

I have the static contents in this path.

In my JSP's to define the JS path, I defined use static files movement

<script src="<s:url value="/UI/js/jquery-ui-1.10.4.js"/>"></script>

But I am not able to access the JS from the folder path defined in server.xml.

I get the following error:

INFO  [TransactionManagerService] Starting transaction recovery manager
19:00:54,142 ERROR [AbstractKernelController] 
Error installing to Start: name=WebServer state=Create
org.jboss.xb.binding.JBossXBException: Failed to parse source: Context cannot appear in this position. Expected content of Host is unordered_sequence: Listener* Valve* Alias* Realm? attributes?

Solution

  • In the url tag you should use absolute path

    <script src="<s:url value='/ui/js/jquery-ui-1.10.4.js' includeContext='false'/>"></script>
    

    You should not add context path to the url manually, the url tag will add it automatically.