将Spring MVC与内联PHP混合使用

3
我想知道是否可以在Spring MVC页面内联编写PHP代码。
类似以下方式:
<html xmlns:jsp="http://java.sun.com/JSP/Page" 
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:tiles="http://tiles.apache.org/tags-tiles"
      xmlns:spring="http://www.springframework.org/tags"
      xmlns:util="urn:jsptagdir:/WEB-INF/tags/util" >

    <jsp:output doctype-root-element="HTML" doctype-system="about:legacy-compat" />

    <jsp:directive.page contentType="text/html;charset=UTF-8" />  
    <jsp:directive.page pageEncoding="UTF-8" /> 

    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=8" />    
        <title><tiles:insertAttribute name="title"/></title>
        <util:load-scripts />
        <spring:message code="application_name" var="app_name" />

    </head>

    <body style="background-image: url(${resources}/images/Main_bg.jpg);">
        <div id="wrapper">
                    <lang:PHP>
                        require_once(somephpfile.php);
                        ...

我有一段庞大的PHP遗留代码,我想将其集成到我正在构建的更大系统中,这个新系统是用Spring和Spring MVC编写的。

2个回答

3

是的,您可以。例如使用Quercus从JVM内部运行php,你可能需要编写一些自定义标签。


1

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接