小编Luc*_*ure的帖子

Spring v3没有为元素'mvc:resources'找到声明

目前正在运行

Tomcat:v6

Spring Tools Suite:v2.7.2

Spring框架:spring-webmvc-3.0.5

Servlet XML

 <?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:mvc="http://www.springframework.org/schema/mvc"
        xmlns:context="http://www.springframework.org/schema/context"
        xsi:schemaLocation="
          http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
          http://www.springframework.org/schema/mvc/spring-mvc
          http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
          http://www.springframework.org/schema/context
          http://www.springframework.org/schema/context/spring-context-3.0.xsd">

      <mvc:annotation-driven />

      <mvc:resources mapping="/resources/**" location="/resources" />

      <context:component-scan base-package="com.app.mvc" />

 </beans>
Run Code Online (Sandbox Code Playgroud)

web.xml部分代码

<servlet-mapping>
    <servlet-name>duckapp</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>
Run Code Online (Sandbox Code Playgroud)

Servlet目的

web.xml将所有URL映射到servlet,但mvc:resources映射静态文件除外.

错误

  • cvc-complex-type.2.4.c:匹配的通配符是strict,但是没有找到元素'mvc:annotation-driven'的声明.app-servlet.xml/app/www/WEB-INF

  • cvc-complex-type.2.4.c:匹配的通配符是strict,但是没有为元素'mvc:resources'找到声明.app-servlet.xml/app/www/WEB-INF

已知的问题

如何修复编译错误以使mvc:资源正常工作?

我一直在挖掘大约2个小时,还没有可靠的答案......

java xml schema spring servlets

26
推荐指数
2
解决办法
5万
查看次数

在共享主机(1and1)上安装PhantomJS

使用1and1 linux共享主机,

我安装了:

PHP版本7.0.27 PHP PhantomJS 2.1.1

PHP PhantomJS的所有值都为null

每当我提出请求时:

$client = Client::getInstance();

$client->getEngine()->setPath($main_path.'core/composer/bin/phantomjs');
$client->getEngine()->addOption('--ssl-protocol=any');
$client->getEngine()->addOption('--ignore-ssl-errors=true');
$client->getEngine()->addOption('--web-security=false');
$client->getEngine()->addOption('--debug=true');
$client->getEngine()->addOption('--local-to-remote-url-access=true');

$request = $client->getMessageFactory()->createRequest("http://luclaverdure.com");
$response = $client->getMessageFactory()->createResponse();

$client->send($request, $response);
var_dump($request);
var_dump($response);

if($response->getStatus() === 200) {
    $resp = $response->getContent();
    var_dump($resp);
}
Run Code Online (Sandbox Code Playgroud)

我有一堆空值,并且phantomJS无法处理URL ...

请求:

object(JonnyW\PhantomJs\Http\Request)#113 (12) {
    ["type":protected]=> NULL
    ["headers":protected]=> array(0) {}
    ["settings":protected]=>
      array(1) {
        ["resourceTimeout"]=>
        int(5000)
      }
    ["cookies":protected]=>
      array(2) {
        ["add"]=>
        array(0) {
        }
        ["delete"]=>
        array(0) {
        }
      }
    ["data":protected]=>
      array(0) {
      }
    ["url":protected]=>
      string(59) "http://luclaverdure.com"
    ["method":protected]=>
      string(3) "GET"
    ["timeout":protected]=>
      NULL
    ["delay":protected]=> …
Run Code Online (Sandbox Code Playgroud)

php shared-hosting phantomjs composer-php php-phantomjs

8
推荐指数
1
解决办法
473
查看次数

正则表达式 - 获取元素以呈现if语句

我正在设计一个脚本并试图在php中没有eval的if构造.

仍然不完整但爆破,它是做一个模板引擎,引擎的"if"部分.不允许赋值运算符,但我需要测试值而不允许PHP代码注入,正好不使用eval它需要在变量之间进行单独操作以防止注入攻击.

正则表达式必须捕获

[if:(a+b-c/d*e)|(x-y)&!(z%3=0)]
    output
[elseif:('b'+'atman'='batman')]
    output2
[elseif:('b'+'atman'='batman')]
    output3
[elseif:('b'+'atman'='batman')]
    output4
[else]
    output5
[endif]

[if:(a+b-c/d*e)|(x-y)&!(z%3=0)]
    output6
[else]
    output7
[endif]
Run Code Online (Sandbox Code Playgroud)

以下工作来获取if,elseif,else和endif块以及条件语句:

$regex = '^\h*\[if:(.*)\]\R(?<if>(?:(?!\[elseif)[\s\S])+)\R^\h*\[elseif:(.*)\]\R(?<elseif>(?:(?!\[else)[\s\S])+)\R^\h*\[else.*\]\R(?<else>(?:(?!\[endif)[\s\S])+)\R^\[endif\]~xm';
Run Code Online (Sandbox Code Playgroud)

请帮助选择elseif和其他.

然后使用条件语句,我可以得到以下操作:

$regex = '~([^\^=<>+\-%/!&|()*]+)([\^+\-%/!|&*])([^\^=<>+\-%/!&|()*]*)~';
Run Code Online (Sandbox Code Playgroud)

然而,它只会配对它们,错过每个第三个操作员......

谢谢你的帮助.

php regex preg-match-all

7
推荐指数
2
解决办法
440
查看次数

STS(Spring Tools Suite)2.7.2 @RequestMappings视图不显示

目前使用:

Spring Tools Suite v2.7.2

Spring Framework v3.0.5

控制器中的示例代码:

@RequestMapping( value={ "/en/page", "/fr/page" }, method = { RequestMethod.POST })
Run Code Online (Sandbox Code Playgroud)

在STS中重现问题的步骤:

  • [Menu] Window - > Show View - > @RequestMappings

  • [项目]右键单击 - >弹簧工具 - >显示RequestMappings

返回:

Javadoc内容缺失或为空

题:

如何填充所有@RequestMappings以查看在我的Web应用程序中映射的所有网址?

user-interface controller spring-mvc

5
推荐指数
1
解决办法
2648
查看次数

1and1 mod_rewrite问题

我正在尝试让我的1and1主机启用mod_rewrite的.htaccess文件,它可以在我的本地wamp上运行,但它不在服务器上,

任何帮助将不胜感激!

我已经尝试删除除了mod_rewrite块之外的所有内容,问题仍然存在......

我已经要求1和1获得支持,他们在没有回答的情况下关闭了我的机票...... o_O,

请帮忙!

.htaccess文件:

#
# Dream Forgery Settings:
#
AddType x-mapp-php5 .php

RewriteEngine on
RewriteBase /

# Rewrite current-style URLs of the form 'strap.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /strap.php?q=$1 [L,QSA]
Run Code Online (Sandbox Code Playgroud)

编辑:

我无法访问apache日志,因为这是一个共享主机,但预期的功能是重定向URL,例如:

http://example.com/arg1/arg2/arg3

http://example.com/strap.php?q=arg1/arg2/arg3

(它目前正在提供404错误,只显示1和1中的404页面)

.htaccess mod-rewrite

0
推荐指数
1
解决办法
1万
查看次数