<p>Can I use <a href="http://struts.apache.org/" rel="nofollow noreferrer">Struts</a> as a backend and PHP as front end for a web application? If yes, what may be the implications.</p>

[{'answer_id': 38972, 'author': 'Doug Miller', 'author_id': 3431280, 'author_profile': 'https://Stackoverflow.com/users/3431280', 'pm_score': 0, 'selected': False, 'text': '<p>What do you mean by backend and and frontend?</p>\n\n<p>If you mean using Java for the admin side of your site and PHP for the part that the public will see then there is nothing stopping you.</p>\n\n<p>The implications are that you will have to maintain two applications in different languages.</p>\n'}, {'answer_id': 39049, 'author': 'SCdF', 'author_id': 1666, 'author_profile': 'https://Stackoverflow.com/users/1666', 'pm_score': 0, 'selected': False, 'text': "<p>I think what you mean is you want to use PHP as your templating language and structs as your middleware (actions etc).</p>\n\n<p>I would imaging the answer would be no, not without some kind of bridge between the structs session and the PHP.</p>\n\n<p>If you say change x to 3 in java in a structs action, you couldn't just go &lt;?php echo x ?&gt; or whatever to get the value out, you would need to transfer that information back and forth somehow.</p>\n\n<p>Submitting would be OK though, I would imagine.</p>\n\n<p>Not recommended though.</p>\n"}, {'answer_id': 40172, 'author': 'Jordi Bunster', 'author_id': 4272, 'author_profile': 'https://Stackoverflow.com/users/4272', 'pm_score': 1, 'selected': False, 'text': '<p>I don\'t know much about Java, but I remember running into <a href="http://www.caucho.com/resin-3.0/quercus/" rel="nofollow noreferrer">Quercus</a> a while ago. It\'s a 100% Java interpreter for PHP code.</p>\n\n<p>So yes, you could have PHP templates on your Java app. <strong>Update</strong>: see <a href="http://caucho.com/resin/doc/quercus.xtp" rel="nofollow noreferrer">Quercus: PHP in Java</a> for more info.</p>\n'}, {'answer_id': 43967, 'author': 'Sam McAfee', 'author_id': 577, 'author_profile': 'https://Stackoverflow.com/users/577', 'pm_score': 2, 'selected': False, 'text': '<p>The first thing to came to mind is <a href="http://www.caucho.com/resin-3.0/quercus/" rel="nofollow noreferrer">Quercus</a> (from the makers of the Resin servlet engine), as Jordi mentioned. It is a Java implementation of the PHP runtime and purportedly allows you to access Java objects directly from your PHP (part of me says "yay, at last").</p>\n\n<p>On the other hand, while I have been itching to try a project this way, I would probably keep the separation between Java EE and PHP unless there was a real reason to integrate on the code-level.</p>\n\n<p>Instead, why don\'t you try an <a href="http://en.wikipedia.org/wiki/Service-oriented_architecture" rel="nofollow noreferrer">SOA</a> approach, where your PHP "front-end" calls into the Struts application over a defined REST or SOAP API (strong vote for REST here) over HTTP. </p>\n\n<pre><code>http://mydomain.com/rest/this-is-a-method-call?parameter1=foo\n</code></pre>\n\n<p>You can use Struts to build your entire "backend" model, dealing only with business logic and data, and completely ignoring presentation. As you expose the API with these URLs, and you are basically building a REST API (which may come in handy later if you ever need to provide greater access to your backend, perhaps by other client apps).</p>\n\n<p>Your PHP application can be built separately (and rather thinly), calling into the REST API (perhaps using Curl) as if it would call into a database or some native PHP class library.</p>\n\n<p>Anyway, that\'s what I\'d do. But, if you do use Quercus, please post how it went.</p>\n'}]
['https://Stackoverflow.com/questions/38948', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']