Can jsp include Servlet?

can a jsp include a servlet inside in the code using the jsp include?
i am using tomcat 4.x

That depends on the type of include and the servlets function.
If you used the <% include file="relative URL" %> syntax, you can include a servlet that does a task (but does not output HTML) or a servlet that outputs HTML.
Now you can use the <% include file="relative URL" %> to <jsp:include page="relative URL" flush="true" /> but only if the servlet you are including OUTPUTS html. If this servlet DOES something other than outputting HTML then you are S.O.L. and and you cannot include the Servlet=P
Hope that helps

Similar Messages

  • With iPlanet6.0 how can I include servlets in the cgi directory?

    I have created a cgi directory ex. http://hostname/cgi-bin to refer to the cgi.exe's. However.. I have developed a new servlet that replaces one of the cgi programs. The servlet context must fit in with our existing architecture so the servlets context must map to the cgi URL we have in place. This works fine with every web app server under the sun .. even Sun One7... but not on iPlanet 6.0. This is because it seems that every resource mapped by a CGI directory must be a CGI program - the web server doesn't have the intelligence to know that a servlet with the same context is available and so when the CGI directory is enabled... the servlet is not found, yet when it is removed the servlet is referenced just fine.
    Has anyone any ideas? Unfortunately I can't change the context of the servlet as our existing systems depend on the original cgi structure.
    Many thanks,
    Mark

    Right /cgi must reference a cgi and /servlet is for legacy servlets that arent deployed as applications.
    I dont think you are going to make it work like that, maybe do a redirect from /cgi/cginame to /servlet/servletname . That's the only thing that may work.

  • Re: capturing screen resolution in JSP or servlet

    "Mike Tickle" <[email protected]> wrote ...
              > Is it possible to capture screen resolution in JSP or a Servlet? I can
              > currently do it in JavaScript and write the result in to a cookie that a
              > servlet can read, but is there a better solution.
              > Is it possible to get the time zone of a visitor using JSP or servlets?
              > Can JSP or servlets determine if a visitor has scrolled the page to view
              all
              > of it?
              You seem to be very confused about what servlets and JSPs are. These are
              things that run on the server and generate HTML. They can't possibly know
              if a user has scrolled the page, because the user hasn't seen the page yet
              when they are run. If they tried to read screen resolution, they'd get the
              screen resultion for the graphics subsystem on the server, or an exception
              if one isn't available (eg, there is no X display set).
              For these kinds of client interaction tasks, JavaScript is probably still
              your best option.
              Chris Smith
              

    Hey all you non-ASP programmers, here's the deal. Microsoft has a Browser
              Capabilities component and they have defined a special way for you to
              populate a specially named cookie on the client side that will then allow
              the component to pick up what you sent it. In the ASP script, you then use
              the component. Behind the scenes, it works exactly like what you guys
              imagine, but Microsoft provides the format for sending the information and
              the parsing.
              The client side script does need to be written to include the information
              you want, but it would typically be written once and hidden by the lead
              programmer in a common include file where most programmers never had to
              think about it and thus might think it happened automatically.
              If you're really curious, here's an MSDN link to the details:
              http://msdn.microsoft.com/library/psdk/iisref/comp1vol.htm.
              Rick Joi, former ASP developer
              [email protected]
              www.rickanddonna.com/ips
              "Chris Smith" <[email protected]> wrote in message
              news:[email protected]...
              > "Mike Tickle" <[email protected]> wrote ...
              > > > You seem to be very confused about what servlets and JSPs are.
              > >
              > > I am quite familiar with servlets as I have been using them for 6 months
              > as
              > > part of a uni project. I had the presentation yesterday and the
              moderator
              > > asked why I used JavaScript to determine time zone and screen res. I
              said
              > > JSP/Servlets can not do it as they are server side and he seemed
              confused.
              >
              > Okay. Apologies if I was condescending. Such things happen in newsgroups
              > where I have no idea what your background is.
              >
              > > Apparently ASP can do it. So against my better judgement I thought I
              > would
              > > ask in case I was wrong.
              >
              > I'm surprised if ASP can do it... I can't imagine how that occurs. I
              agree
              > with Jeff, especially after reading the URL he provided; it appears the
              > moderator was just plain wrong, or that there are only very non-portable
              > solutions for IE only.
              >
              > > I currently write the time zone and screen resolution in to a session
              > cookie
              > > so that it can be read every time the servlet is run. Is there a better
              > way
              > > than this?
              >
              > Seems to me like the best way to me.
              >
              > Chris Smith
              >
              >
              >
              

  • Capturing screen resolution in JSP or servlet

    Is it possible to capture screen resolution in JSP or a Servlet? I can
              currently do it in JavaScript and write the result in to a cookie that a
              servlet can read, but is there a better solution.
              Is it possible to get the time zone of a visitor using JSP or servlets?
              Can JSP or servlets determine if a visitor has scrolled the page to view all
              of it?
              Thanks for any help
              Mike
              

    You have to remember JSPs/Servlets run on the server. They can only
              manipulate information that you explicitely pass to them or information
              passed by HTTP. You could pass this information, gathered by JavaScript,
              through a POST or GET method.
              Jim
              "Mike Tickle" <[email protected]> wrote in message
              news:9d8rut$fr4$[email protected]..
              > Is it possible to capture screen resolution in JSP or a Servlet? I can
              > currently do it in JavaScript and write the result in to a cookie that a
              > servlet can read, but is there a better solution.
              > Is it possible to get the time zone of a visitor using JSP or servlets?
              > Can JSP or servlets determine if a visitor has scrolled the page to view
              all
              > of it?
              > Thanks for any help
              >
              >
              >
              >
              > Mike
              >
              >
              

  • Friends..how can i include a jsp page in a servlet

    like i want to use like
    if(conditionl)
    out.println(" welcome");
    //////// here i want to include some jsp page /////
    I tried with...
    <% @include %> but its not working
    Thanks in advance

    I tried with...
    <% @include %> but its not working
    Thanks in advanceThat only woks for JSP Pages.
    You have to call the include method of the RequestDispatcher
    if(conditionl)
      out.println(" welcome");
      getRequestDispachter("/myJSPDir/my.jsp").include(request, response);
    }

  • How can i include a file in my JSP

    hello i have one jst who need to use an instance of a class called Part I need to include that file in my JSP but How do i do that
    How do i import my Part.java class in my JSP ???

    At the top of your JSP:
    <%@ import="package.*, package.Class" %>or you could do this:
    <%jsp:useBean class="package.Class" id="CLASS" scope="page" />or you can use a servlet as an include and have it write HTML back to the JSP:
    <jsp:include page="MyServlet">
         <jsp:param name="PARAM1" value="data1"/>
         <jsp:param name="PARAM2" value="data2"/>
    </jsp:include>

  • How can I include a portal component look and feel in a java servlet

    Does any body know how can i include a portal component look and feel (tables, buttons, etc) in a java servlet?

    Hi José,
    I don't think that is possible. But you can import the css files that ep uses for its look and feel and try to give your web pages similar look and feel. The tables and other controls used in EP are totally different and are done through complex JavaScript coding instead of simple HTML tags. If you want exact lok and feel then i thin you must go for a Webdynpro based application rather then a J2EE application with JSPs.
    Regards,
    Guru.
    PS: Give points for helpful replies.

  • Servlet not found (jsp include)

    Trying to include a servlet from a jsp. Put the servlet under the default_web_app\web-inf\classes\<package dir structure>\<servlet class name>, and included it with "<jsp:include page="servlet.package.hierarchy.ServletName" flush="true"/>
    That I could think of. OC4J is serving jsps fine through Apache, but OC4J can't find the servlet. Ideas?

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Robert Cote ([email protected]):
    Added "/servlet/" to the start of the include name -- that fixed it. Now, however, I can't seem to get oc4j to find my beans (located in the same hierarchy). Using <jsp:usebean...> syntax, the usebean statment seems to get processed, but accessing the bean through it's id yields:
    Syntax error in source
    /mapsis/contacts4_mockup.jsp.java:30: Undefined variable or class name: <bean id>
    I'll try messing w/ the syntax, but thanks in advance for any ideas.<HR></BLOCKQUOTE>
    Is your bean part of a package ?
    Here is an example
    <%@ page import="java.sql.* , oracle.jsp.dbutil.*" %>
    <jsp:useBean id="cbean" class="oracle.jsp.dbutil.ConnBean" scope="session">
    <jsp:setProperty name="cbean" property="User" value="scott"/>
    <jsp:setProperty name="cbean" property="Password" value="tiger"/>
    <jsp:setProperty name="cbean" property="URL" value="jdbc:oracle:thin:@dlsun:1521:P817"/>
    <jsp:setProperty name="cbean" property="PreFetch" value="5"/>
    <jsp:setProperty name="cbean" property="StmtCacheSize" value="2"/>
    </jsp:useBean>
    Hope this helps.. sorry for the delay in replying..

  • How to include servlet in JSP using Include Directive?

    Hi experts,
    am a beginner to JSP.. I want to know,
    is it possible to include a servlet in jsp using include directive? could any one explain me...

    No it is not possible.
    Include directive is like copying and pasting some text into a JSP file, and then translating/compiling it.
    So the only thing you can include with the <%@ include %> directive is a jsp fragment
    It is a static translation/compile time include and thus will always be the same
    By contrast <jsp:include> is a runtime include, and includes the result of running the imported url.
    That URL has to be a complete/standalone jsp/servlet/whatever. However as it is runtime, it can take parameters where the include directive can not.
    Does that answer your homework question?
    Cheers,
    evnafets

  • In a jsp page how can i include another page from differenct web context

    Hi,
    i want to include a page from another web content to my page. How is it possible. For example in a jsp page i want to include "http://www.google.com". How is it possible. can i use <jsp:include tage for this purpose? any idea?
    Edited by: JavaHeroPrince on Apr 2, 2009 12:05 AM

    I'm afraid you cannot do that using <jsp:include/> tag.
    However, you can achive this using <c:import/> tag which comes with JSTL core tags.
    Please find the below example of how to go about.
    <%@ taglib uri = "http://java.sun.com/jstl/core" prefix = "c"%>
    <c:import url = "http://www.google.com/search">
      <c:param name="q" value="c%3Aimport+jstl"/>
      <c:param name="rls" value="com.microsoft:en-us"/>
      <c:param name="ie" value="UTF-8"/>
      <c:param name="oe" value="UTF-8"/>
      <c:param name="startIndex" value=""/>
      <c:param name="startPage" value="1"/>
    </c:import>
    -------------------------------------------------------------------------for more info
    [http://java.sun.com/developer/technicalArticles/javaserverpages/faster/]
    Hope that helps :)
    REGARDS,
    RaHuL

  • How can i upload a image file to server by using jsp or servlet.

    Hi,
    I m gurumoorthy. how can i upload a image file to server by using jsp or servlet without using third party API. pls anyone send me atleast outline of the source code.
    Pls send me anyone.
    Regards,
    Gurumoorthy.

    I'm not an applet programmer so I can't give you much advice there.
    If you want to stream the file from the server before it's entirely uploaded, then I don't believe you can treat it like a normal file. If you're just wanting to throw it up there and then listen to it, then you can treat it like a normal file.
    But again, I'm not entirely certain. You might be able to stream the start of the file from the server while you're still uploading the end of it, but it probably depends on what method you're using to do the transfer.

  • How can I include a JSP, Maximized, and retain look and feel(WSRP)

    I have created a page group and defined a root page with a certain look and feel. There are two portlets on the page. Once the user clicks on a submit button, the portlet performs some action and includes a jsp included in the EAR file. The portlet needs to maximize the UI to display the jsp correctly.
    Once control returns back to the screen, the look and feel is lost and uses Oracle's default style. I have two questions:
    1. From the portlet, how can I retain the look and feel of the page group when referencing "external" jsp (i.e JSPs in the deployed portal EAR file).
    2. How can I "redirect" the user to the home page in a standard way? If there is not a standard way, how do I use the Oracle specific utilities to do it?
    All of my JSPs are developed externally out of the scope of the Oracle Portal.
    Environment - Oracle Portal 10.1.4 on Release 2 using WSRP to contact Oracle Release 3, hosted EAR file (WSRP Producer).
    Thanks in advance.

    Hi José,
    I don't think that is possible. But you can import the css files that ep uses for its look and feel and try to give your web pages similar look and feel. The tables and other controls used in EP are totally different and are done through complex JavaScript coding instead of simple HTML tags. If you want exact lok and feel then i thin you must go for a Webdynpro based application rather then a J2EE application with JSPs.
    Regards,
    Guru.
    PS: Give points for helpful replies.

  • How can I includ a web site in a jsp file?

    Hi all,
    I want to includ a web site, for example www.yahoo.com, in my jsp file. when the jsp file is called, it can return the web page to my own page. How shoud I do for that?
    I placed the code:
    <jsp:include page="http://www.yahoo.com"/> in my jsp page, but it does not work. Please help!
    Thanks.

    try checking out the include tag from the jakarta utility-taglibs.
    it can do this.
    http://jakarta.apache.org/taglibs/doc/utility-doc/index.html (include)
    this one can to
    http://jakarta.apache.org/taglibs/doc/io-doc/intro.html
    (check out "request" tag).
    hope it helps

  • How can I include a jsp file in other jsp from different applications?

              Hi,
              I'd like know if it´s possible to include jsp or servlet from different applications.
              

              Thanks Deepak but I think you don´t understand me.
              I would like the include works like a normal include. I have a jsp in my application
              and , when the client requests this jsp, in the jsp should be added the result
              of the other jsp ejecution that belong to other application in the same domain.
              Is this possible?
              Thank you very much.
              Deepak Vohra <[email protected]> wrote:
              > A Jsp from a different application is included with a relative url to
              >th=
              >e Jsp.
              ><%@ include file=3D"relative url" %>
              >
              >A Jsp could be included with request parameter.
              > <jsp:include page=3D'<%=3D request.getParameter("incFile") %>' />
              >
              >javilla wrote:
              >
              >> Hi,
              >>
              >> I'd like know if it=B4s possible to include jsp or servlet from differe=
              >nt applications.
              >
              

  • Flush parameter of jsp:include has no effect on servlet code

    I am running 9.0.3 and my jsp code looks like:
    &lt;jsp:include page =".." flush="false"/&gt;
    but the resulting servlet code is:
    pageContext.include( __url);
    Which defaults to flushing the buffer!
    Does anyone know a work around or if Oracle is going to fix this?
    Thanks,
    Mike

    Try:
    public class ...  extends ...
        private static final boolean antialias = Boolean.getBoolean ("swing.aatext");
        private static Map hintsMap = null;
        @SuppressWarnings("unchecked")
        static final Map getHints() {
           if (hintsMap == null) {
                hintsMap = (Map)(Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints")); //NOI18N
                 if (hintsMap == null) {
                    hintsMap = new HashMap();
                     if (antialias) {
                          hintsMap.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
           return hintsMap;
    ... later in class ...
        @Override
        protected void paintComponent(Graphics g) {
            Graphics2D g2d = (Graphics2D) g;
            g2d.addRenderingHints(getHints());
            super.paintComponent(g);
            ...needed this so custom paint would use AA. In my app I wrote text in my component and it was not AA, this turned it on.
    I don't think I had the same problem you, as my jlabels were always aa.
    Edited by: 805835 on Oct 27, 2010 5:06 PM
    Edited by: 805835 on Oct 27, 2010 5:07 PM

Maybe you are looking for

  • Re: Equium A60-199 shuts down intermittently

    Hi, hope you could help me with a problem iv been having with my laptop recently, it seems to turn itself off at different stages. prechecks - 1.taken battery out and run off mains AC adaptor (problem persists) 2.changed AC adaptor to a known working

  • URGENT! Please help - package use

    Question about the use of packages: I have a third party package set up at /location1/mypackage I have a file at /location2/myfile.java In myfile.java I need to "import mypackage". Is this possible to import a package stored in a different location t

  • Premiere Pro CS5.5 Encoding takes a while to start and freezes a little at 49%?

    Hi all, I have noticed when I click the export button on the export settings and the encoding  box starts up it sits on 0% for around 3-5 min then kicks in and starts encoding. Plus once I get to 49% it sits again for 3-5min then starts up again. Any

  • Wlappc error

    Hi Gurus, when i am running my ant for build.xml, i am getting into the following wlappc, even though everything is in classpath. I'll appreciate if anyone could help me out. thanks, kuru error: BUILD FAILED D:\build.xml:75: Could not create task or

  • My IPad screen is not responsive to unlock.

    My Ipad screen allows me to put in the passcode but will not allow me to swipe to unlock. Itunes is unable to fix as it says the IPad is locked with a passcode. It goes to the apple logo every few seconds.