JSP inside PHP?

Is it possible (with calculable effort) to integrate JSPs in a PHP driven web site? Or are Java experts kicked off that way?

Hmm, this is becoming a little tougher. You can't really mix PHP and JSP code in the exact same file, because your webserver would send it off to either the JVM or the PHP interpreter and both are going to fail when reading the 'alien' code.
I think you could use include tags in a JSP to place the PHP parts where you'd like to have them. I believe the PHP would be parsed before it is given to the JVM and then the result, which is common HTML, is inserted into the JSP page. That way you wouldn't need to rewrite any of the portions that are already available in PHP.
Check out http://java.sun.com/webservices/docs/1.0/tutorial/doc/JSPIntro8.html for detailed information on including stuff in JSP pages...

Similar Messages

  • In Dreamweaver MySites[New Site] menu option , if I had a hosting JSP/PHP what I must declare the hosting JSP or PHP ?

    In Dreamweaver MySites[New Site] menu option , if I had a hosting JSP/PHP what I must declare the hosting JSP or PHP ?

    The simplest answer is to choose the language you work best with, and that fits the clients specification the best.
    I have mixed server languages on a site before, (would not recommend) when a client has decided they wish to change from their old one to a new(er) /different one, the only thing you must watch if doing this, is that you do not mix languages on the same page (will not work correctly, if at all), and parameter passing.
    PZ

  • Want to add a jsp inside pager tag library

    Hi,
    I want to add pagination in my web center application, for This I am using pager tag lib
    But I am not able to add jsp page inside *<pg:index >* tag
    I tried it with different ways: e.g.
    A. <jsp:include page="/WEB-INF/jsp/altavista.jsp" flush="true"/>
    b> <f:subview id="subview1">
    <jsp:include page="inc.jsp" />
    </f:subview>
    When I add JSP  inside <pg:index > tag and run my jsp i am getting noting in my UI and also not seeing any error in console.
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
    xmlns:pe="http://xmlns.oracle.com/adf/pageeditor"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    xmlns:tr="http://myfaces.apache.org/trinidad"
    xmlns:pg="http://jsptags.com/tags/navigation/pager"
    xmlns:trh="http://myfaces.apache.org/trinidad/html"
    xmlns:cust="http://xmlns.oracle.com/adf/faces/customizable">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document id="d1">
    <af:form id="f1">
    <af:pageTemplate viewId="/oracle/webcenter/portalapp/pagetemplates/nowTemplate.jspx"
    id="pt1">
    <f:facet name="content">
    <af:group id="g1">
    <af:panelGroupLayout id="pgl1">
    <div class="line topMargin20">
    <div class="unit size1of4">
    <div class="mod mod-sectionTitle">
    <span>Search Results</span>
    </div>
    </div>
    <!-- /unit -->
    <div class="unit size3of4 lastUnit"></div>
    <!-- /unit -->
    </div>
    <!-- /line -->
    <div>
    <pg:pager items="${backingBeanScope.searchClient.searchResults.totalResults}"
    maxPageItems="${backingBeanScope.searchClient.searchResults.maxPageItems}"
    maxIndexPages="${backingBeanScope.searchClient.searchResults.maxIndexPages}"
    isOffset="${backingBeanScope.searchClient.searchResults.isOffset}"
    export="offset,currentPageNumber=pageNumber"
    scope="request">
    <pg:param name="maxPageItems"/>
    <pg:param name="maxIndexPages"/>
    <input type="hidden" name="pager.offset" value="${backingBeanScope.searchClient.searchResults.isOffset}"></input>
    *<pg:index >*
    *</pg:index>*
    <c:forEach items="${backingBeanScope.searchClient.searchResults.results}"
    var="result">
    </c:forEach>
    </pg:pager>
    </div>
    </af:panelGroupLayout>
    </af:group>
    </f:facet>
    </af:pageTemplate>
    </af:form>
    </af:document>
    </f:view>
    <!--oracle-jdev-comment:auto-binding-backing-bean-name:backing_oracle_webcenter_portalapp_pages_untitled1-->
    </jsp:root>

    PeterBreis0807 wrote:
    Are you having trouble with tabs in a list?
    You haven't said so.
    In lists you have to use option tab, otherwise it just changes the list level.
    Peter
    I guess what you were hoping but you missed the point.
    Yvan KOENIG (VALLAURIS, France) vendredi 20 janvier 2012
    iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My Box account  is : http://www.box.com/s/00qnssoyeq2xvc22ra4k
    My iDisk is : http://public.me.com/koenigyvan

  • Can I have a JSP  inside another JSP??

    if so,
    say, I have a JSP inside another JSP then,
    how many servlets r generated by the JSP engine??

    Yes U can have JSP inside another JSP, ofcourse using jsp:include and in that case two servlets will be generated. Thats what i feel that happens.

  • Jspc jsps inside WEB-INF?

              jspc skipped jsps inside web-inf folder (eg /webapp/WEB-INF/index.jsp) if -compileAll
              is specified. Is there any way to compile all jsps in a webapp without compiling
              one by one?
              thanks
              

    How about a look into the doc?
    1) http://www.oracle.com/pls/topic/lookup?ctx=fmw121200&id=ADFFD21876
    2) http://www.oracle.com/pls/topic/lookup?ctx=fmw121200&id=ADFFD22049
    3) http://www.oracle.com/pls/topic/lookup?ctx=fmw121200&id=ADFFD1815
    Timo

  • JSP ASP PHP (and others)

    Does anyone know how many projects are implementing JSPs in comparison to those using .asp (and others)? I was just curious.. There's an "unfair" (I think) comparison (March 2002) here http://php.weblogs.com/popularity

    .ASP being the widest used. I think .jsp and .php are somewhere close to each other in the amount of projects out there.
    Hope this helps

  • JSP v PHP

    What is the difference, if any, between the abilities of JSP and PHP.
    Too many different technologies competing in the same space makes my head spin..

    PHP is more for dynamic content
    in websites, while JSP's and servlets are used in
    webbased applications built on top of Java.I disagree. If you use JSP tags, it's quite dynamic.
    One difference I'd like to point out is that JSP is based on Java and HTML, which are existing technologies you may already know. PHP is something new and you'd have to learn a new language/syntax. To me that's a real turn-off and I probably won't be using PHP anytime soon. I already use several languages and dozens of API's.

  • JSP and PHP ?!

              is it possible to include a php file into a JSP with the include tag?
              infos:
              the php file is on another server as the jsp file.
              the php server doens'nt support jsp and vice versa.
              hope anyone can help!!!!
              bye
              Phil
              

    Am I being an idiot or is there ever a reason for
    using JSP over PHP?A very large number of people have chosen to write their websites (or at least the user interface part) in JSP. They can't all be idiots.

  • Does apex support any server side JSP or PHP?

    I have the folowing script that is used to save flash files as images. I am hoping there is some way to make these serverside calls from within apex.
    <%@ page import="java.io.OutputStream"%>
    <%@ page import="java.awt.Color"%>
    <%@ page import="java.awt.Graphics"%>
    <%@ page import="java.awt.image.BufferedImage"%>
    <%@ page import="javax.imageio.ImageIO"%>
    <%
         //Decoded data from charts.
         String data="";
         //Rows of color values.
         String[] rows;
         //Width and height of chart.
         int width=0;
         int height=0;
         //Default background color of the chart
         String bgcolor="";
         Color bgColor;
         //Get the width and height from form
         try{
              width = Integer.parseInt(request.getParameter("width"));
              height = Integer.parseInt(request.getParameter("height"));     
         catch(Exception e){
              //If the width and height have not been given, we cannot create the image.
              out.print("Image width/height not provided.");
              out.close();
         if(width==0 || height==0){
              //If the width and height are less than 1, we cannot create the image.
              out.print("Image width/height not provided.");
              out.close();
         //Get background color from request and set default
         bgcolor =request.getParameter("bgcolor");
         if (bgcolor==null || bgcolor=="" || bgcolor==null){
                   bgcolor = "FFFFFF";
         //Convert background color to color object     
         bgColor = new Color(Integer.parseInt(bgcolor,16));
         //Get image data  from request
         data = request.getParameter("data");
         if(data==null){
              //If image data not provided.
              out.print("Image Data not supplied.");
              out.close();
         try{
              //Parse data
              rows = new String[height+1];
              rows = data.split(";");
              //Bitmap to store the chart.
              //Reference to graphics object - gr
              BufferedImage chart = new BufferedImage(width,height,BufferedImage.TYPE_3BYTE_BGR);
              Graphics gr = chart.createGraphics();
              gr.setColor(bgColor);
              gr.fillRect(0,0,width,height);     
              String c;
              int r;
              int ri = 0;
              for (int i=0; i<rows.length; i++){
                   //Split individual pixels.               
                   String[] pixels = rows.split(",");               
                   //Set horizontal row index to 0
                   ri = 0;
                   for (int j=0; j<pixels.length; j++){                    
                        //Now, if it's not empty, we process it                    
                        //Split the color and repeat factor
                        String[] clrs = pixels[j].split("_");     
                        //Reference to color
                        c = clrs[0];
                        r = Integer.parseInt(clrs[1]);
                        //If color is not empty (i.e. not background pixel)
                        if (c!=null && c.length()>0 && c!=""){          
                             if (c.length()<6){
                                  //If the hexadecimal code is less than 6 characters, pad with 0
                                  StringBuffer str = new StringBuffer(c);
                                  int strLength = str.length();
                                  for ( int p = c.length()+1; p <= 6 ; p ++ ) {
                                            str.insert( 0, "0" );
                                  //Assing the new padded string
                                  c = str.toString();
                             for (int k=1; k<=r; k++){     
                                  //Draw each pixel
                                  gr.setColor(new Color(Integer.parseInt(c,16)));
                                  gr.fillRect(ri, i,1,1);
                                  //Increment horizontal row count
                                  ri++;                              
                        }else{
                             //Just increment horizontal index
                             ri = ri + r;
              //Returns the image
              response.setContentType("image/jpeg");
              response.addHeader("Content-Disposition", "attachment; filename=\"FusionCharts.jpg\"");
              OutputStream os = response.getOutputStream();
              ImageIO.write(chart, "jpeg", os);
              os.close();
         }catch(Exception e){
              //IF the image data is mal-formatted.
              out.print("Image data is not in proper format.");
              out.close();
    %>

    NO, APEX does NOT support running jsp or PHP scripts..
    Thank you,
    Tony Miller
    Webster, TX

  • Crystal Report Images Not Showing - JSP inside /WEB-INF folder

    Hi Experts,
    I am using Crystal report for Eclipse and also using Struts2 and tiles framework combination.
    The problem is when viewing the report all I've got is red X on all images and the graph image also not showing. This is when I use tiles and my jsp is inside the web-inf folder.
    This is my struts link: href="s:url value='/report/reportOpen.action?report=1'
    I've checked that the path to the viewer generated HTML is not correct. see code below.
    src="../../../crystalreportviewers/js/crviewerinclude.js"
    But when I test to access a simple jsp viewer that resides on the web root folder, this works fine but of course this is not what I want to have. I need to have my banner and menus on top of the report page (using tiles)
    This is my jsp link: href="s:url value='/ReportViewer.jsp?report=1'
    Viewer generated HTML below.
    src="crystalreportviewers/js/crviewerinclude.js"
    This might be a common problem and that you can share to me your solution.
    Note: I removed the script tags because I can't submit this entry.
    Thank you  in advance,
    Regards,
    Rulix Batistil
    Crystal Report Images Not Showing - JSP inside /WEB-INF folder

    Hi Saravana,
    After a few experimentation from your idea i was able to figure out the problem and now it is working.
    I don't have to copy the folder to where my jsp resides but still maintains it in the root location:  web/crystalreportviewers
    The changes should always be in web.xml.
    1st: change the crystal_image_uri value to ../crystalreportviewers
    2nd: change crystal_image_use_relative value to "web"
    Change to "web" instead of webapp because that is what I named my web root folder.
    <context-param>
              <param-name>crystal_image_uri</param-name>
              <param-value>../crystalreportviewers</param-value>
         </context-param>
         <context-param>
              <param-name>crystal_image_use_relative</param-name>
              <param-value>web</param-value>
         </context-param>
    Thank you. You showed me the way on how to solve the 3 day problem.
    BTW, my next problem is when clicking on any buttons prev/next/print/export, I got this error HTTP Status 404.
    Well, at least for now I can view my initial report.  I just need to figure out the next issue and with the help of the great people here in the forum.
    Thanks a lot.
    Regards,
    Rulix
    Edited by: Rulix Batistil on Nov 26, 2008 7:27 AM

  • Include a JSP inside another JSP

    Hi SDN,
    I am stuck with a problem. There is a JSP file available. In this JSP I have to add some more fields. But when I try to ad new fields I am getting a Portal Runtime Error stating that "Code Too Large". So now I thought of putting the new code in another JSP and include that JSP inside my main JSP. Here I cannot use <@include file="..."> because this finally compiles both the JSPs as one.
    So I tried to use <JSP:include>. Some one please help me with how to include a JSP inside another using <JSP:include>. Here both the JSPs are having HBJ content inside.
    I know that <jsp:include page="relPathOfChild.jsp"/> will include the child.jsp into my main jsp. Problem is both the JSPs are having HBJ content, so If I dont declare <hbj:content> tag inside the child jsp, it is throwing an error. But If I declare a <hbj:content> tag inside my child jsp, only child content is coming and main jsp content is not coming.
    Please help me..
    Regards,
    SrinivaS

    Hi,
    This Problem is solved. Now I am able to include a child JSP inside the parent JSP. But now the problem is,
    This Parent JSP will have 8 tabs. Now my chils JSP should come inside 7th tab.  but it is coming above the parent JSP.
    Below is how I am including my child JSP.
    <% try{ if(isCAR){
         %>
                   <tr>
    <jsp:include page="/pagelet/CAREligibility.txt" />
                   </tr>
                <%} } catch(Exception e) {}%>
    Please help.
    Regards,
    SrinivaS

  • Passing values between jsp and php

    hi there, is it possible to pass values between jsp and
    php? i really need to find out the way if there is
    any. thanks in advance
    -azali-

    Yes, there are a few ways to do this.
    1) Think about using Cookies.
    2) Maybe use a Redirect passing the values in the Query string.
    3) Retain the data in a repository in the back end.
    4) Using Hidden fields within your pages.
    I am sure you can use these Idea's for a base to develop other methods on how to pass values back and forth from JSP -> PHP and vice versa.
    -Richard Burton

  • JSP versus PHP

    Is there anything JSP does better than PHP?

    PHP is a good scripting language, probably the best one. It does the same job as ASP only much better. I would suggest that JSP can actually do a whole lot more than that because you have the full functionality of the programming language behind it rather than being purely designed for web scripting. This gives flexibility and the jsp/servlet/bean architecture also offers far greater options for re-use and extension than php offers.

  • JSP and PHP together?

    hi all,
    can we use an utility developed in php in our jsp web application.
    thanks
    yashvant

    Depends on the back end technology that u r using ...
    Read more and u will get it ...

  • JSP to PHP

    I have a content management system that is currently all JSP. At login time, session variables are set (username, password, authority level).
    Can and HOW do access JSP-set session varibles with PHP?
    Thanks

    Hi
    The only way, as far as know, is to pass jsp variables encoded via post to your php routine and the start a new php session and set java variables as php variables:
    <?
    start_session();
    if (isset($_POST['name']) && strlen($_POST['name'])) > 0) {
       $_SESSION['name'] = $_POST['name']);
    ?>Also, I know I've seen a java php section in php manuall, but I don't remember if there you will find the answer for your question...
    Nevertheless, I think that java could do anything that php does and the best way will be translate your php routine to java... :)
    Hope this helps
    <xl>

Maybe you are looking for