Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mixing Spring MVC with inline PHP

I was wondering if it's possible to write PHP code inline within Spring MVC pages.

Something like

<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);
                        ...

I have a massive piece of legacy PHP code that I want to integrate into an even bigger system I'm building, the new system is written with Spring and Spring MVC.

like image 323
Jan Vladimir Mostert Avatar asked Jan 28 '26 13:01

Jan Vladimir Mostert


1 Answers

Yes, you can. For instance by running php from within the JVM using Quercus and you probably need to write some sort of custom tag.

like image 56
M Platvoet Avatar answered Jan 30 '26 02:01

M Platvoet