Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone.
i have a java web application with struts2 framework. in my index.jsp file, i link the CSS file, but it doesn't show in my page and Error 404: not found display in Firebug. i tested one appllication without Struts and everything is fine. but when i add struts2 library and config struts.xml and web.xml file, CSS doesn't display :(
here is my index.jsp:
HTML
<head>
       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

       <link href="styles/main.css" rel="stylesheet" type="text/css"/>

   </head>

Of course, i add <%@ taglib prefix="s" uri="/struts-tags" %> and tried <s:url> in href, but dont see any effect.
here is web.xml file:
XML
<?xml version="1.0" encoding="UTF-8"?>
	 
	<web-app xmlns="http://java.sun.com/xml/ns/javaee"
	         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
	         version="3.0">
	    <session-config>
	        <session-timeout>
	            30
	        </session-timeout>
	    </session-config>
	     
	    <display-name>HotelSystem</display-name>
            <welcome-file-list>
                <welcome-file>index.jsp</welcome-file>
            </welcome-file-list>
	    <filter>
	        <filter-name>struts2</filter-name>
	        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
	    </filter>
	 
	    <filter-mapping>
	        <filter-name>struts2</filter-name>
	        <url-pattern>/*</url-pattern>
	    </filter-mapping>
	</web-app>


and here is part of my struts.xml:
HTML
<package name="default" namespace="/" extends="struts-default">
        <action name="index.jsp" class="Actions.Test">
            <result name="success">/index.jsp</result>
        </action>
    </package>


note that, Action.Test just is a test action and always return SUCCESS.
i really need to solve this problem as soon as possible. Please anyone help me :(
Thanks in advance.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900