Angular 2 + Codeigniter - Linked CSS and JS not loading on WAMP? - codeigniter

I followed the latest Angular 2.0 quickstart guide and everything is up to date. My application runs fine locally using lite-server, but all of my CSS and JS resources get 404 errors when I run it on WAMP. The index.html application page is the only thing that loads.
My folder structure is:
my-project/
application/
views/
pages/
app/
assets/
css/
reset.css
node-modules/
index.html head:
<head>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="assets/css/reset.css" />
<link rel="stylesheet" type="text/css" href="assets/css/main.css" />
<link rel="stylesheet" type="text/css" href="assets/css/menu.css" />
<!-- 1. Load libraries -->
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/reflect-metadata/Reflect.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<!-- 2. Configure SystemJS -->
<script src="systemjs.config.js"></script>
<script>
System.import('app').catch(function(err){ console.error(err); });
</script>
</head>
Thanks.

Related

SpringMVC - cann't able to acces JS and CSS file in index.jsp

I have added
<mvc:resources mapping="/webapp/**" location="/webapp/" />
<mvc:default-servlet-handler />
in my dispatch-servlet.xml
my folder hierarchy is
enter image description here
and in index.jsp i declared
<spring:url value="/webapp/resources/js/bootstrap.min.js" var="bootstrapJS" />
<script src ="${bootstrapJS}" type="text/javascript"></script>
can any one tell the actuall issue is with code or folder hierarchy
Hi have you included the tag at the top of index.jsp it will look something like this. <%# taglib prefix="spring" uri="http://www.springframework.org/tags"%>

Cannot load primefaces default theme when I have additional folder in the URL

Here is the POM file
<dependency>
<groupId>org.primefaces.extensions</groupId>
<artifactId>all-themes</artifactId>
Web.xml
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>aristo</param-value>
On the main page http://localhost/helloworld/search.faces primefacs theme loads fine
Generated Page with primefaces style sheet is
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml"><head><link type="text/css" rel="stylesheet" href="/helloworld/javax.faces.resource/theme.css.faces?ln=primefaces-aristo" /><link rel="stylesheet" media="screen" type="text/css" href="/helloworld/javax.faces.resource/primefaces.css.faces?ln=primefaces&v=5.0" /><script type="text/javascript" src="/helloworld/javax.faces.resource/jquery/jquery.js.faces?ln=primefaces&v=5.0"><!--
//--></script><script type="text/javascript" src="/helloworld/javax.faces.resource/primefaces.js.faces?ln=primefaces&v=5.0"><!--
//--></script><script type="text/javascript" src="/helloworld/javax.faces.resource/jquery/jquery-plugins.js.faces?ln=primefaces&v=5.0"><!--
//--></script>
but when I access subsequent pages which is one folder down
http://localhost/helloworld/app/welcome.faces, theme is not applied. Url generated for the theme file is adding the extra folder which is in the url and thus not able to find the theme file resulting in theme not getting loaded. What should I do for the extra folder to not get added to the for the primefaces theme url...
generated page is
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml"><head><link type="text/css" rel="stylesheet" href="/helloworld/app/javax.faces.resource/theme.css?ln=primefaces-aristo" /><link rel="stylesheet" media="screen" type="text/css" href="/helloworld/app/javax.faces.resource/primefaces.css?ln=primefaces&v=5.0" /><script type="text/javascript" src="/helloworld/app/javax.faces.resource/jquery/jquery.js?ln=primefaces&v=5.0"><!--
//--></script><script type="text/javascript" src="/helloworld/app/javax.faces.resource/jquery/jquery-plugins.js?ln=primefaces&v=5.0"><!--
//--></script><script type="text/javascript" src="/helloworld/app/javax.faces.resource/primefaces.js?ln=primefaces&v=5.0"><!--
//--></script>
code
There is no theme related code in xhtml... mentioned in web.xml and all- themes in POM file.
welcome.xhtml and search.xhtml are the same and here is the snippet
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
template="/WEB-INF/layouts/standard.xhtml">
<ui:define name="title">
</ui:define>
standard.xhtml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<f:view contentType="text/html">....
Summary of the problem
If the url is /helloworld/search.faces generated in the page is /helloworld/javax.faces.resource/primefaces.js.faces?ln=primefaces&v=5.0" ... and theme loads fine.
When the url is ( is one folder deep) theme does not load /helloworld/app/welcome.faces path generated is in the page is href="/helloworld/app/javax.faces.resource/theme.css?ln=primefaces-aristo ... see the app directory that is added.... This is causing 404 erros for this resouce as it is not able to find it.
Is there a way to control the generated primefaces theme path ?
Upon further digging thro the rest of the config files. Added the following line to servlet context.
<!-- Enable processing of JSF 2 resource requests. For example: /webflow-primefaces-showcase/app/javax.faces.resource/jsf.js?ln=javax.faces -->
<faces:resources />
and now the theme is getting applied without any issues. Thanks for all those who chimed in.

CSS <link> mod_rewrite

My mod_rewrite will not work and can not solve the problem. Any ideas what am I doing wrong?
My mod_rewrite
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/([^/.]+)/?$ index.php?g=$1 [L]
My CSS File is linked like below
<head>
<link type="text/css" href="/includes/libs/minify/index.php?g=responsive.css&319" rel="stylesheet" media="screen" />
</head>
I want to change it with mod_rewrite to
<head>
<link type="text/css" href="responsive.css" rel="stylesheet" media="screen" />
</head>

Joomla template folder not showing in template manager

I am trying to create a template.I have created a folder for template in templates folder and also created two files index.php and templateDetails.xml
My index.php has following code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >
<head>
<jdoc:include type="head" />
</head>
<body>
<jdoc:include type="component" />
</body>
</html>
and templateDetails.xml has following code which yes I copied because beginner.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE install PUBLIC "-//Joomla! 1.5//DTD template 1.0//EN"
"http://dev.joomla.org/xml/1.5/template-install.dtd">
<install version="3.1.5" type="template">
<name>template _tut</name>
<creationDate>31-01-2009</creationDate>
<author>Nettut Fan</author>
<authorEmail>your#email.com</authorEmail>
<authorUrl>http://www.siteurl.com</authorUrl>
<copyright>You 2009</copyright>
<license>GNU/GPL</license>
<version>1.0.0</version>
<description>Template Tut</description>
<files>
<filename>index.php</filename>
<filename>templateDetails.xml</filename>
<filename>css/template.css</filename>
</files>
<positions>
<position>breadcrumb</position>
<position>left</position>
<position>right</position>
<position>top</position>
<position>user1</position>
<position>user2</position>
<position>user3</position>
<position>user4</position>
<position>footer</position>
</positions>
</install>
My joomla version is 3.1.5 and despite doing above mentioned steps my template folder is not showing in template manager.
You need to install the template to register it completely.
There are 2 ways of doing this:
Download your files, zip them up and install it as you would any other extension.
In the Joomla backend, go to "Extension Manager", then "Discover". This will detect uninstalled extensions and should bring your template up in the list. check it and install it
Hope this helps

Tiles 2.2 put-list-attribute + Spring 3.1.4

I am migrating our application from struts 1.3 to spring 3.1.4 mvc. In the process i am also upgrading from tiles 1.1 to tiles 2.2. Jstl version is 1.1. With Tiles 2.2, i am having an issue about using put-list-attribute. I am trying to show a simple jsp page which should does following:
a) Header : include bunch of css (i commented it out as it doesn't work. Using firebug i see error "NetworkError: 404 Not Found - http://localhost:8080/appname/%BeachStyle%7d" --- {eachStyle}
No idea where %BeachStyle% came from.
b) Header : include title -- Works fine
c) body : show static text
tiles.xml
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.1//EN"
"http://tiles.apache.org/dtds/tiles-config_2_1.dtd">
<tiles-definitions>
<definition name=".login" preparer="com.tiles.LoginController"
template="/tiles/layouts/layoutmain.jsp">
<put-attribute name="pageTitle" value="vivi test" />
<put-list-attribute name="baseStylesTest">
<add-attribute value="/styles/css/grids.css"/>
<add-attribute value="/styles/css/superfish.css"/>
<add-attribute value="/styles/css/styles.css"/>
</put-list-attribute>
</definition>
</tiles-definitions>
layoutmain.jsp
<%# taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<%# taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%# taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<tiles:useAttribute id="stylesList" name="baseStylesTest" classname="java.util.List"/>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%-- <c:forEach var="eachStyle" items="${baseStylesTest}">
<link type="text/css" rel="stylesheet" href="<c:out value='${eachStyle}'/>" /> --%>
<title><tiles:insertAttribute name="pageTitle" /> </title>
</head>
<body>
Login page body
</body>
</html>
I tried the following:
i) Checked the tiles2.2 dtd and example to use it - found similar usage
ii) Checked examples over internet and how it's being used - found similar usage
iii) Checked how its used with struts -- found they use #attr.xxx as it is in pagescope
I don't see anything wrong in my implementation. The title attribute is rendered properly but on the attribute belonging to put-list-attribute.
Any help is much appreciated.
Found the solution. JSTL wasn't working as i declared my web-app version to be 2.5. This is not compatible with tomcat5.5 which i was using. Changed the web-app version to be 2.4 and all is good.
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
---
</web-app>

Resources