当我打开http://localhost/cakephp/employees/add文件时,会打印一条错误消息 在C:\ xampplite \ htdocs \ cakephp \ app \ tmp \ logs / error.log文件
错误消息,如
2012-04-09 16:08:47 Error: [MissingControllerException] Controller class CssController could not be found.0
#C:\xampplite\htdocs\cakephp\app\webroot\index.php(96): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#1 {main}
我在这里做的错误是什么?如何解决这个问题?
我的add.ctp文件
<head>
<script type="text/javascript">
$(document).ready(function(){
$( "#datepicker" ).datepicker();
$("#EmployeeAddForm").validate();
$( "#auto_complete" ).autocomplete({
source: function( request, response ) {
alert("here man");
$.ajax({
url: "/employees/index",
dataType: "jsonp",
data: {
featureClass: "P",
style: "full",
maxRows: 12,
name_startsWith: request.term
},
success: function( data ) {
alert("success--"+data)
response( $.map( data.geonames, function( item ) {
return {
label: item.name,
value: item.id
}
}));
}
});
},
minLength: 2,
select: function( event, ui ) {
log( ui.item ?
"Selected: " + ui.item.label :
"Nothing selected, input was " + this.value);
},
open: function() {
$( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
},
close: function() {
$( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
}
});
});
$("#EmployeeAddForm").submit(function(){
return validate();
//var returnValue=validate();
//alert("return value::"+returnValue);
//return false;
});
</script>
</head>
<div class="employees form">
<?php echo $this->Form->create('Employee');?>
<fieldset>
<legend><?php echo __('Add Employee'); ?></legend>
<?php
echo $this->Form->input('first_name');
echo $this->Form->input('last_name', array('id' => 'tags'));
//echo $this->Form->input('age');
echo $this->Form->input('age', array('class' => 'required number'));
echo $this->Form->input('sex');
echo $this->Form->input('Adress.first_line');
echo $this->Form->input('Adress.second_line');
echo $this->Form->input('Adress.city');
echo $this->Form->input('Adress.state');
//echo $this->Form->input('Department.name');
//echo $this->Form->input('Department.name', array('label' => 'Department'));
echo $this->Form->input('Department.name', array('class' => 'auto_address', 'id'=>'auto_complete','label'=>'Department'));
//echo $ajax->autoComplete('Department.name', '/ajax/autoComplete');
?>
</fieldset>
<?php echo $this->Form->end(__('Submit'));?>
</div>
<div class="actions">
<h3><?php echo __('Actions'); ?></h3>
<ul>
<li><?php echo $this->Html->link(__('List Employees'), array('action' => 'index'));?></li>
<li><?php echo $this->Html->link(__('List Adresses'), array('controller' => 'adresses', 'action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(__('New Adress'), array('controller' => 'adresses', 'action' => 'add')); ?> </li>
</ul>
下面是我的 default.ctp 页面
<?php
/**
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc.
* @link http://cakephp.org CakePHP(tm) Project
* @package Cake.View.Layouts
* @since CakePHP(tm) v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
$cakeDescription = __d('cake_dev', 'Emplyees:');
?>
<!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>
<?php echo $this->Html->charset(); ?>
<?php echo $this->Html->script('jquery-1.7.1.min.js');?>
<?php echo $this->Html->script('jquery.validate.min.js');?>
<?php echo $this->Html->script('jquery-ui-1.8.18.custom.min.js');?>
<?php
echo $this->Html->meta('icon');
echo $this->Html->css('cake.generic');
echo $this->Html->css('jquery-ui-1.8.18.custom.css');
echo $this->fetch('meta');
echo $this->fetch('css');
echo $this->fetch('script');
?>
</head>
<body>
<div id="container">
<div id="header">
<h1><?php echo $this->Html->link($cakeDescription, 'http://cakephp.org'); ?></h1>
</div>
<div id="content">
<?php echo $this->Session->flash(); ?>
<?php echo $this->fetch('content'); ?>
</div>
<div id="footer">
<?php echo $this->Html->link(
$this->Html->image('cake.power.gif', array('alt' => $cakeDescription, 'border' => '0')),
'http://www.cakephp.org/',
array('target' => '_blank', 'escape' => false)
);
?>
</div>
</div>
<?php echo $this->element('sql_dump'); ?>