Q: Forwarding from servlets within webapp

Suppose I have a servlet mapping so that /guarded/* is mapped to servlet
          s1. If from within s1 I obtain a request dispatcher for
          "/guarded/page1.html" and call forward() (or include()) on it, I get
          into an infinite loop because that request is mapped back into s1.
          Any thoughts on how to escape this kind of loop?
          

It sounds like what you want is a chance to interrupt the processing, not
          handle it completely yourself.
          One possibility is to forward to another path (/noaccess/page1.html) when
          someone requests something from your servlet-handled path
          (/guarded/page1.html).
          Cameron Purdy, LiveWater
          "Eugene Gross" <[email protected]> wrote in message
          news:[email protected]..
          > Suppose I have a servlet mapping so that /guarded/* is mapped to servlet
          > s1. If from within s1 I obtain a request dispatcher for
          > "/guarded/page1.html" and call forward() (or include()) on it, I get
          > into an infinite loop because that request is mapped back into s1.
          >
          > Any thoughts on how to escape this kind of loop?
          >
          >
          

Similar Messages

  • Forwarding from servlet in web app...

              I'm having a problem forwarding to a page within a web application. Basically if I do:
              getServletContext().getRequestDispatcher("/login.htm").forward(request,response);
              then the page isn't found as the forward doesn't put the web application context into the URL. I can work round this by using:
              request.getContextPath()
              and then building up the path with the web application in it.
              This becomes a real pain too with static HTML pages. If the pages have links in them which are absolute, again the web application context is not prefixed.
              Am I missing something here? I was under the impression that the deployment of web applications was supposed to be transparant to the components within them.
              Any help would be appreciated. I'm running on WLS 6 on W2K.
              Cheers,
              Andy
              

    Andy,
              I'm haivng the same problem! I'm working with getting Jive (the open-source
              discussion board product) to work with WLS. This software is full of
              response.sendRedirect calls that are relative. These all fail with WLS 6.
              Jeff Mathers
              "Andy Winskill" <[email protected]> wrote in message
              news:[email protected]...
              >
              > I should follow the flow of my servlet better.....
              >
              > The main problem is with request.sendRedirect not working with a relative
              URL. Forwarding to an absolute URL in a web app works fine. However,
              absolute links in a HTML page are absolute with respect to the server and
              not the web application.
              >
              > Cheers,
              > Andy
              >
              > "Andy Winskill" <[email protected]> wrote:
              > >
              > >I'm having a problem forwarding to a page within a web application.
              Basically if I do:
              > >
              >
              >getServletContext().getRequestDispatcher("/login.htm").forward(request,resp
              onse);
              > >
              > >then the page isn't found as the forward doesn't put the web application
              context into the URL. I can work round this by using:
              > >
              > >request.getContextPath()
              > >
              > >and then building up the path with the web application in it.
              > >
              > >This becomes a real pain too with static HTML pages. If the pages have
              links in them which are absolute, again the web application context is not
              prefixed.
              > >
              > >Am I missing something here? I was under the impression that the
              deployment of web applications was supposed to be transparant to the
              components within them.
              > >
              > >Any help would be appreciated. I'm running on WLS 6 on W2K.
              > >
              > >Cheers,
              > >Andy
              >
              

  • Javascript not working after forward from servlet

    Hi,
    I have a jsp page which uses a html and a javascript file to generate a javascript calendar for date entry. The html doc is in the same directory as the jsp page and the javascript is in another directory.
    The calendar works fine when the jsp loads first.
    On submitting the form, the page calls a servlet which does some processing and then forwards to the same jsp using a requestdispatcher. Now the calendar script doesnt work anymore. How to solve this prob.
    Thanx.
    gopal

    Most likely the browser is looking for the javascript files in the wrong location. When you do a requestdispatcher the browser is not aware of it and it continues to keep the url of the servlet in the browser. If the JSP calls any images, javascript files or other resources using a relative path then the browser looks for these items rleative to the path that it has in the address bar.
    You can solve this by using absolute paths for all resources (ie start with a "/") or you can use the HTML BASE tag in the JSP which the browser will use to resolve paths instead of the url in the address bar.

  • Forms applet does not load when request forwarded from custom servlet

    I have an existing forms app that I wish to call from a newly-developed servlet. The servlet determines which form to call and then forwards the request to the forms servlet using RequestDispatcher.forward().
    The request is forwarded correctly but when it is done all I see is a blank browser (IE7) window. When I View Source I see all the correct HTML code (from basejpi.htm) but it seems my browser does not attempt to load the forms applet. No messages are displayed in the Java Console. This is the same HTML that comes back if I run the forms app directly, e.g. click a link that goes straight to the forms servlet URL, only in that case the forms app starts up fine.
    Anyone know why this does not work?

    Figured out what is going on:
    In basejpi.htm there is "<SCRIPT LANGUAGE=JavaScript SRC=java/forms_ie.js>" that creates an OBJECT tag to load the forms applet. I believe since the context of my custom servlet is different than that of the forms servlet, forms_ie.js is not found when the request is forwarded from my servlet.
    One question answered raises another. There is also an OBJECT tag inside a NOSCRIPT tag for machines where scripting has been disabled:
    <!-- Forms applet definition (start) -->
    <NOSCRIPT>
    <OBJECT name=FormsApplet
    type="application/x-java-applet"
    ...>
    </NOSCRIPT>
    <SCRIPT LANGUAGE="JavaScript" SRC="java/forms_ie.js"></SCRIPT>
    My thinking is to remove the NOSCRIPT tag, and also the SCRIPT tag mentioned above, so all machines will simply see the OBJECT tag, like so:
    <!-- Forms applet definition (start) -->
    <OBJECT name=FormsApplet
    type="application/x-java-applet"
    ...>
    This makes me wonder why the SCRIPT option is there to begin with. Anyone see a downside to this approach?
    Kevin

  • Very Urgent !!! Exception in looking up Local EJB from Servlet in WSAD 5.1

    Hi,
    I have a servlet and a local EJB. The servlet and EJB are deployed on same application server but in different J2EE applications i.e. different EAR files.
    When I lookup an EJB with remote interfaces from servlet everything works fine. But when I try to lookup EJB with local interfaces from
    Servlet I get following Exception.
    Exception Stack: -
    ========================================================
    avax.naming.NameNotFoundException: Context: localhost/nodes/localhost/servers/server1, name: TestLocalHome: First component in name TestLocalHome not found. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.naming.ipcos.WsnOptimizedNamingImpl.do_resolve_complete_info(WsnOptimizedNamingImpl.java:968)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBase.resolve_complete_info(WsnOptimizedNamingImplBase.java:1399)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.WsnOptimizedNaming._NamingContextStub.resolve_complete_info(Unknown Source)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java:3491)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1519)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1480)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1187)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1067)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:132)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at javax.naming.InitialContext.lookup(InitialContext.java:360)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at org.apache.jsp._DomainClient._jspService(_DomainClient.java:95)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:344)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:669)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:767)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:983)
    [12/8/05 14:14:05:047 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:564)
    [12/8/05 14:14:05:062 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
    [12/8/05 14:14:05:062 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
    [12/8/05 14:14:05:062 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
    [12/8/05 14:14:05:062 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
    [12/8/05 14:14:05:062 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
    [12/8/05 14:14:05:062 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
    [12/8/05 14:14:05:062 IST] 7debf35b SystemErr R      at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
    [12/8/05 14:14:05:062 IST] 7debf35b SystemErr R      at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
    [12/8/05 14:14:05:062 IST] 7debf35b SystemErr R      at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
    [12/8/05 14:14:05:062 IST] 7debf35b SystemErr R      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:672)
    ========================================================
    Please help asap.
    Regds
    VJ.

    The ejb spec only defines local ejb access within the same application. It's possible some app servers support access from a different application but it wouldn't be portable, nor would it work within the J2EE SDK or Sun Java System App Servers. To access a local ejb from a web component or ejb , define an ejb-local-ref in the client component's standard .xml file (web.xml or ejb-jar.xml) and use the ejb-link element to specify the ejb-name of the target ejb.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Forward from an included page

    When we try to <jsp:forward> from an included (<jsp:include>) page, the
    rest of the page that includes gets rendered after the forwarded page.
    Let's say "main.jsp" includes "subpage.jsp". If there is an error in
    "subpage.jsp", we want to forward in to an eror page called "error.jsp"
    However, after the "error.jsp" is rendered, the remaining section of the
    main.jsp (after where the include is made) is rendered as well. So we
    see the contents of "error.jsp" and remaining-sections of "main.jsp" in
    a single page.
    Is there a way to stop this?
    Thanks

    It is very odd to fw: from an included page. Very odd. Forward basically
    means "go somewhere else to render the page" and include basically means
    "while rendering this page, include something from somewhere else". It is
    handy to code a servlet, for example, without any presentation logic, and so
    at the end of its processing, it just forwards to a JSP or HTML page or XSL
    processor. It is handy from within a JSP to include a standard page heading
    and a standard left navigation pane and a standard right navigation pane and
    a standard footing so your JSP has includes to suck those things in.
    Cameron Purdy
    "Muhtar Akbulut" <[email protected]> wrote in message
    news:[email protected]..
    When we try to <jsp:forward> from an included (<jsp:include>) page, the
    rest of the page that includes gets rendered after the forwarded page.
    Let's say "main.jsp" includes "subpage.jsp". If there is an error in
    "subpage.jsp", we want to forward in to an eror page called "error.jsp"
    However, after the "error.jsp" is rendered, the remaining section of the
    main.jsp (after where the include is made) is rendered as well. So we
    see the contents of "error.jsp" and remaining-sections of "main.jsp" in
    a single page.
    Is there a way to stop this?
    Thanks

  • Invoke binding layer from servlet

    hi every body,
    how can i invoke binding layer from servlet .
    thanks
    maher

    hi john
    execuseme how to make sure that ADFBindingFilter servlet filter is applied to my getImage servlet??
    the following is my web.xml file :
    <?xml version = '1.0' encoding = 'windows-1256'?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
    <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
    </context-param>
    <context-param>
    <description>If this parameter is true, there will be an automatic check of the modification date of your JSPs, and saved state will be discarded when JSP's change. It will also automatically check if your skinning css files have changed without you having to restart the server. This makes development easier, but adds overhead. For this reason this parameter should be set to false when your application is deployed.</description>
    <param-name>org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION</param-name>
    <param-value>false</param-value>
    </context-param>
    <context-param>
    <description>Whether the 'Generated by...' comment at the bottom of ADF Faces HTML pages should contain version number information.</description>
    <param-name>oracle.adf.view.rich.versionString.HIDDEN</param-name>
    <param-value>false</param-value>
    </context-param>
    <context-param>
    <param-name>RedirectToLogin</param-name>
    <param-value>login</param-value>
    </context-param>
    <filter>
    <filter-name>JpsFilter</filter-name>
    <filter-class>oracle.security.jps.ee.http.JpsFilter</filter-class>
    <init-param>
    <param-name>enable.anonymous</param-name>
    <param-value>true</param-value>
    </init-param>
    </filter>
    <filter>
    <filter-name>trinidad</filter-name>
    <filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter</filter-class>
    </filter>
    <filter>
    <filter-name>adfBindings</filter-name>
    <filter-class>test.DynamicJDBCBindingFilter</filter-class>
    </filter>
    <filter>
    <filter-name>ServletADFFilter</filter-name>
    <filter-class>oracle.adf.share.http.ServletADFFilter</filter-class>
    </filter>
    <filter>
    <filter-name>ADFLibraryFilter</filter-name>
    <filter-class>oracle.adf.library.webapp.LibraryFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>JpsFilter</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>INCLUDE</dispatcher>
    </filter-mapping>
    <filter-mapping>
    <filter-name>trinidad</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    <filter-mapping>
    <filter-name>adfBindings</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    <filter-mapping>
    <filter-name>ServletADFFilter</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    <filter-mapping>
    <filter-name>ADFLibraryFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    <listener>
    <listener-class>oracle.adf.mbean.share.connection.ADFConnectionLifeCycleCallBack</listener-class>
    </listener>
    <listener>
    <listener-class>oracle.adf.mbean.share.config.ADFConfigLifeCycleCallBack</listener-class>
    </listener>
    <listener>
    <listener-class>oracle.bc4j.mbean.BC4JConfigLifeCycleCallBack</listener-class>
    </listener>
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
    <servlet-name>resources</servlet-name>
    <servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>BIGRAPHSERVLET</servlet-name>
    <servlet-class>oracle.adfinternal.view.faces.bi.renderkit.graph.GraphServlet</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>BIGAUGESERVLET</servlet-name>
    <servlet-class>oracle.adfinternal.view.faces.bi.renderkit.gauge.GaugeServlet</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>MapProxyServlet</servlet-name>
    <servlet-class>oracle.adfinternal.view.faces.bi.renderkit.geoMap.servlet.MapProxyServlet</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>GatewayServlet</servlet-name>
    <servlet-class>oracle.adfinternal.view.faces.bi.renderkit.graph.FlashBridgeServlet</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>adflibResources</servlet-name>
    <servlet-class>oracle.adf.library.webapp.ResourceServlet</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>getImage</servlet-name>
    <servlet-class>Servlet.getImage</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>ordDeliverMedia</servlet-name>
    <servlet-class>oracle.ord.html.OrdPlayMediaServlet</servlet-class>
    <init-param>
    <param-name>releaseMode</param-name>
    <param-value>Stateful</param-value>
    </init-param>
    </servlet>
    <servlet-mapping>
    <servlet-name>ordDeliverMedia</servlet-name>
    <url-pattern>ordDeliverMedia</url-pattern>
    </servlet-mapping>
    <filter-mapping>
    <filter-name>adfBindings</filter-name>
    <servlet-name>ordDeliverMedia</servlet-name>
    </filter-mapping>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>resources</servlet-name>
    <url-pattern>/adf/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>resources</servlet-name>
    <url-pattern>/afr/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>BIGRAPHSERVLET</servlet-name>
    <url-pattern>/servlet/GraphServlet/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>BIGAUGESERVLET</servlet-name>
    <url-pattern>/servlet/GaugeServlet/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>MapProxyServlet</servlet-name>
    <url-pattern>/mapproxy/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>resources</servlet-name>
    <url-pattern>/bi/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>GatewayServlet</servlet-name>
    <url-pattern>/flashbridge/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>adflibResources</servlet-name>
    <url-pattern>/adflib/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>getImage</servlet-name>
    <url-pattern>/getimage</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>30</session-timeout>
    </session-config>
    <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>txt</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>swf</extension>
    <mime-type>application/x-shockwave-flash</mime-type>
    </mime-mapping>
    <jsp-config>
    <jsp-property-group>
    <url-pattern>*.jsff</url-pattern>
    <is-xml>true</is-xml>
    </jsp-property-group>
    </jsp-config>
    </web-app>
    thanks
    maher

  • Reply and forward icons not appearing in mail app when I respond/forward from Gmail

    When I reply or forward an email within the iphone mail app, the arrow icons showing I replied or forwarded appear beside the email in my iphone mail app inbox.
    When I reply or forward from gmail, these icons do not appear in my iphone mail app.  Does show that I have read and flagging/unflagging works.
    Any thoughts?

    Close out of the mail app, double tap the home button and completely close out of the app.
    Then do a reset, no data loss.  Hold down the home/sleep button together until you see the apple logo and then release, then wait for the phone to boot back up.
    Then check your mail again.

  • Database query ResultSet from servlet to JSP page

              Hi there,
              I have an Access 2000 database. I am running Apache and Tomcat on Windows Me.
              I would like to know if it is possible for me to use a Servlet to search the
              database (I know this bit is possible!), but then I would like the servlet to
              forward to a jsp page which will then display the ResultSet that the servlet has
              retrieved, i.e. when forwarding from a servlet to a jsp, is it possible for the
              jsp page to have access to the servlet's data? I know that it gets access to
              the response and request objects, but what about a ResultSet?
              Sorry it this sounds a little silly - i am a bit of a newbie.
              Thanks in advance for your help,
              SJ
              

    HttpServletRequest.setAttribute let's you share data for a particular
              request. When you call forward you can store the resultset in the request.
              Make sure your JSP does close the result set though, because what you are
              trying to do doesn't sound good :)
              If you want to share data across the session, take a look at the HttpSession
              object.
              read through the servlet specification, it is fairly easy to read and will
              give you all the info you need
              Filip
              ~
              Namaste - I bow to the divine in you
              ~
              Filip Hanik
              Software Architect
              [email protected]
              www.filip.net
              "SJ" <[email protected]> wrote in message
              news:[email protected]...
              >
              > Hi there,
              >
              > I have an Access 2000 database. I am running Apache and Tomcat on Windows
              Me.
              > I would like to know if it is possible for me to use a Servlet to search
              the
              > database (I know this bit is possible!), but then I would like the servlet
              to
              > forward to a jsp page which will then display the ResultSet that the
              servlet has
              > retrieved, i.e. when forwarding from a servlet to a jsp, is it possible
              for the
              > jsp page to have access to the servlet's data? I know that it gets access
              to
              > the response and request objects, but what about a ResultSet?
              >
              > Sorry it this sounds a little silly - i am a bit of a newbie.
              >
              > Thanks in advance for your help,
              >
              > SJ
              

  • How to call JSp from Servlet??

    Hello,
    I want to call JSP page from servlet.I am using Visual Age For java 3.4. What is wrong in my code??
    if (userExists) {
    f.setErrors("userName","Duplicate User: Try a different username");
    getServletConfig().getServletContext().
    getRequestDispatcher("/jsp/forms/retry.jsp").
    forward(request, response);
    I am not able to get the o/p. Pls help.

    I can't see anything obvious, but did you take any steps towards doing output before this code (like openning an output stream)?
    Not clear what f.setErrors does - presumably stuffs the error message in an attribute of the request.

  • Bean value forward to servlet

    Hi all,
    i have bean package cedars;
    import java.util.Hashtable;
    import java.util.*;
    public class FormBean {
          private String name = null;
          private String stuNumber = null;
          private String facultyName= null;
          private String quesOne = null;
          private String quesTwo = null;
          private String quesThree = null;
          private String quesFour= null;
          private String quesFive= null;
          private String quesSix= null;
          private String quesSeven= null;
          private String quesEight= null;
          private String quesNine= null;
          private String quesTen= null;
          private String quesEleven= null;
          private String quesTwelve= null;
          private String quesThirteen= null;
          private String quesFourteen= null;
          private String quesFifteen= null;
          private String quesSixteen= null;
          private String quesSeventeen = null;     
          private String quesEighteen=null;
          private String quesNineteen=null;
          private String quesTwenty=null;
          private String quesTwentyOne=null;
          private Hashtable errors = new Hashtable();
          public boolean validate() {
                  boolean allOk=true;
                  if (stuNumber.equals("")|| stuNumber.length() !=10) {
                      errors.put("stuNumber","Please enter a valid student Number");
                      stuNumber="";
                      allOk=false;
                    } else {
                        try {
                            int x = Integer.parseInt(stuNumber);
                          } catch (NumberFormatException e) {
                            errors.put("stuNumber","Please enter a valid student Number");
                            stuNumber="";
                            allOk=false;
                    }//else
                  return allOk;        
          public String getErrorMsg(String s) {
                  String errorMsg =(String)errors.get(s.trim());
                  return (errorMsg == null) ? "":errorMsg;
         public FormBean () {
              again(); 
         /* Name */
           public String getName() {
             return (this.name);
           public void setName(String name) {
             this.name = name;
           /* Student number */
           public String getStuNumber(){
             return (this.stuNumber);
           public void setStuNumber(String stuNumber){
             this.stuNumber = stuNumber;
           /* gender */
           private String gender= null;
           public String getGender(){
             return (this.gender);
           public void setGender(String gender) {
             this.gender = gender;
           /*college*/
           public String getFacultyName(){
             return (this. facultyName);
           public void setFacultyName(String  facultyName){
             this. facultyName=facultyName;
           /*degree*/
           String degree=null;
           public String getDegree() {
                  return (this.degree);
           public void setDegree(String degree){
             this.degree =degree;
           /* year */
           private String year = null;
           public String getYear() {
             return (this.year);
           public void setYear(String year){
             this.year = year;
           /*question one */
           public String getQuesOne() {
             return (this.quesOne);
           public void setQuesOne(String quesOne){
             this.quesOne = quesOne;
           /*question two */
           public String getQuesTwo() {
             return (this.quesTwo);
           public void setQuesTwo(String quesTwo){
             this.quesTwo = quesTwo;
           /*question Three */
           public void setQuesThree(String quesThree){
             this.quesThree = quesThree;
           /*question four */
           public String getQuesFour() {
             return (this.quesFour);
           public void setQuesFour(String quesFour){
             this.quesFour = quesFour;
           /*question five */
           public String getQuesFive() {
             return (this.quesFive);
           public void setQuesFive(String quesFive){
             this.quesFive = quesFive;
           /*question six */
           public String getQuesSix() {
             return (this.quesSix);
           public void setQuesSix(String quesSix){
             this.quesSix =quesSix;
           /*question seven */
           public String getQuesSeven(){
             return (this.quesSeven);
           public void setQuesSeven(String quesSeven){
             this.quesSeven =quesSeven;
           /*question Eight */
           public String getQuesEight() {
             return (this.quesEight);
           public void setQuesEight(String quesEight){
             this.quesEight =quesEight;
           /*question Nine */
           public String getQuesNine() {
             return (this.quesNine);
           public void setQuesNine(String quesNine) {
             this.quesNine =quesNine;
           /*question Ten */
           public String getQuesTen(){
             return (this.quesTen);
           public void setQuesTen(String quesTen){
             this.quesNine =quesTen;
           /*question Eleven*/
           public String getQuesEleven(){
             return (this.quesEleven);
           public void setQuesEleven(String quesEleven) {
             this.quesEleven =quesEleven;
           /* question Twelve*/
           public String getQuesTwelve(){
             return (this.quesTwelve);
           public void setQuesTwelve(String quesTwelve) {
             this.quesTwelve =quesTwelve;
           /* question Thirteen**/
           public String getQuesThirteen() {
             return (this.quesThirteen);
           public void setQuesThirteen(String quesThirteen) {
             this.quesThirteen =quesThirteen;
           /*question Fourteen*/
           public String getQuesFourteen() {
             return (this.quesFourteen);
           public void setQuesFourteen(String quesFourteen) {
             this.quesFourteen =quesFourteen;
           /* question Fifteen*/
           public String getQuesFifteen(){
             return (this.quesFifteen);
           public void setQuesFifteen(String quesFifteen) {
             this.quesFifteen =quesFifteen;
          /* question Sisteen*/
           public String getQuesSixteen(){
             return (this.quesSixteen);
           public void setQuesSixteen(String quesSixteen) {
             this.quesSixteen =quesSixteen;
          /* question Seventeen */
           public String getQuesSeventeen (){
             return (this.quesSeventeen );
           public void setQuesSeventeen (String quesSeventeen ) {
             this.quesSeventeen=quesSeventeen ;
           /* question Eighteen*/
           public String getQuesThree(){
             return (this.quesThree);
         public String getQuesEighteen (){
                  return (this.quesEighteen );
         public void setQuesEighteen(String quesEighteen ){
                  this.quesEighteen =quesEighteen ;
           /*question Nineteen*/
         public String getQuesNineteen(){
             return (this.quesNineteen );
          public void setQuesNineteen(String quesNineteen ){
               this.quesNineteen =quesNineteen ;
         /*Twenty*/
      public String getQuesTwenty(){
         return (this.quesTwenty );
      public void setQuesTwenty(String quesTwenty ){
         this.quesTwenty =quesTwenty ;
         /*Twenty-One*/
    public String getQuesTwentyOne(){
    return (this.quesTwentyOne );
    public void setQuesTwentyOne(String quesTwentyOne ) {
          this.quesTwentyOne =quesTwentyOne ;     }
    public void setErrors(String key, String msg) {
             errors.put(key,msg);
           public void again(){                               
                  setName("");
                  setStuNumber("");
                  setGender("");
                  setFacultyName("");
                  setDegree("");            
                  setYear("");           
                  setQuesOne("");
                  setQuesTwo("");
                  setQuesThree("");
                  setQuesFour("");
                  setQuesFive("");
                  setQuesSix("");
                  setQuesSeven("");
                  setQuesEight("");
                  setQuesNine("");
                  setQuesTen("");
                  setQuesEleven("");
                  setQuesTwelve("");
                  setQuesThirteen("");
                  setQuesFourteen("");
                  setQuesFifteen("");     
                  setQuesSixteen("");
                  setQuesSeventeen("");
                  setQuesEighteen("");
                  setQuesNineteen("");
                  setQuesTwenty("");
                  setQuesTwentyOne("");
    }and process.jsp
    %@ page import="java.util.*" %>
    <html>
      <head>
    <jsp:useBean id="formHandler" class="cedars.FormBean" scope="request">
    <jsp:setProperty name="formHandler" property="*"/>
    </jsp:useBean>
    <%
       if (formHandler.validate()) {%>
    <jsp:forward page="/servlet/Insert"/>
    <% } else { %>
    <jsp:forward page="/resubmit.jsp"/>
    <% } %>
    </body>
    </html>row now the forward to resubmit.jsp is work , but forward to <jsp:forward page="/servlet/Insert"/>
    is not work , why?
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import javax.sql.*;
    import pool.ConnectionPool;
    public class Insert extends HttpServlet {   
        Connection conn = null;
        Statement stmt = null;
         ResultSet rs = null;
         PreparedStatement ps = null;
         ConnectionPool connectionPool = null;
       * We want to initialized the JDBC connections here
        public void init()
                 String jdbcDriver = "com.mysql.jdbc.Driver";
                 String dbURL ="jdbc:mysql://localhost/survey?";
                 try
                 //instantiate the connection pool object by passing the
                 //jdbc driver, database URL, username, and password
                 connectionPool = new ConnectionPool(jdbcDriver, dbURL,
                 "root","mysql");
                 //specify the initial number of connections to establish
                 connectionPool.setInitialConnections(5);
                 //specify number of incremental connections to create if
                 //pool is exhausted of available connections
                 connectionPool.setIncrementalConnections(5);
                 //specify absolute maximum number of connections to create
                 connectionPool.setMaxConnections(20);
                 connectionPool.createPool(); //create the connection pool
                 catch(Exception e)
                 System.out.println("Error: " + e);
    /** Destroys the servlet.
        public void destroy() {
        public void doGet(
        HttpServletRequest request,
        HttpServletResponse response)
        throws IOException, ServletException {  
           }// end of DoGet
    public void doPost(HttpServletRequest req, HttpServletResponse res)
        throws ServletException, IOException {    
         res.setContentType("text/html");
         PrintWriter out = res.getWriter(); 
       try {        
        //Get the incoming data parameters from the client         
               String  name=req.getParameter("name");
               String  stuNumber=req.getParameter("stuNumber");
               String  gender=req.getParameter("gender");
               String  facultName=req.getParameter("facultyName");
               String  degree=req.getParameter("degree");          
               String  year=req.getParameter("year");        
               String  quesOne=req.getParameter("quesOne");
               String  quesTwo=req.getParameter("quesTwo");
               String  quesThree=req.getParameter("quesThree");
               String  quesFour=req.getParameter("quesFour");
               String  quesFive=req.getParameter("quesFive");
               String  quesSix=req.getParameter("quesSix");
               String  quesSeven=req.getParameter("quesSeven");
               String  quesEight=req.getParameter("quesEight");
               String  quesNine=req.getParameter("quesNine");
               String  quesTen=req.getParameter("quesTen");
               String  quesEleven=req.getParameter("quesEleven");
               String  quesTwelve=req.getParameter("quesTwelve");
               String  quesThirteen=req.getParameter("quesThirteen");
               String  quesFourteen=req.getParameter("quesFourteen");
               String  quesFifteen=req.getParameter("quesFifteen");
               String  quesSixteen=req.getParameter("quesSixteen");
               String  quesSeventeen=req.getParameter("quesSeventeen");
               String  quesEighteen=req.getParameter("quesNineteen");
               String  quesNineteen=req.getParameter("quesNineteen");
               String  quesTwenty=req.getParameter("quesTwenty");
               String  quesTwentyOne=req.getParameter("quesTwentyOne");
               String ErrMsg="";
               String found="";
               HttpSession userSession = req.getSession(true);   
               HttpSession session=req.getSession();
               for (int i=0; i<stuNumber.length(); i++){              
                    char ch=stuNumber.charAt(i);
                   if (Character.isLetter(ch)){
                     found =found +ch;}
                * check the empty fields
                       if (stuNumber.equals("") ||                    
                                ((found.length()>=1 ))||                         
                                (stuNumber.length()!=10))
                           out.println("<html>");                        
                           out.println("<body bgcolor=\"#FFFFFF\">");
                            out.println("<center>");
                           out.println("<strong> Valid Studend number is require!<strong>");
                           out.println("</center>");
                           out.println("</body>");                        
                           out.println("</html>");
                           out.close();
                       Integer q1=0, q2=0, q3=0, q4=0, q5=0, q6=0, q7=0, q8=0,q9=0,q10=0;
                       Integer q11=0, q12=0, q13=0, q14=0, q15=0, q16=0, q17=0, q18=0, q19=0, q20=0,q21=0;
                         q1 = Integer.valueOf(quesOne);
                         q2 = Integer.valueOf(quesTwo);
                         q3 = Integer.valueOf(quesThree);
                         q4 = Integer.valueOf(quesFour);
                         q5 = Integer.valueOf(quesFive);
                         q6 = Integer.valueOf(quesSix);
                         q7 = Integer.valueOf(quesSeven);
                         q8 = Integer.valueOf(quesEight);
                         q9 = Integer.valueOf(quesNine);
                          q10 = Integer.valueOf(quesTen);
                          q11 = Integer.valueOf(quesEleven);
                          q12 = Integer.valueOf(quesTwelve);
                          q13 = Integer.valueOf(quesThirteen);
                          q14 = Integer.valueOf(quesFourteen);
                           q15 = Integer.valueOf(quesFifteen);
                           q16 = Integer.valueOf(quesSixteen);
                            q17 = Integer.valueOf(quesSeventeen);
                             q18 = Integer.valueOf(quesEighteen);
                             q19 = Integer.valueOf(quesNineteen);
                             q20 = Integer.valueOf(quesTwenty);
                              q21 = Integer.valueOf(quesTwentyOne);
                       Integer total=0;
                       total=q1+q2+q3+q4+q5+q6+q7+q8+q9+q10+q11+q12+q13+q14+q15+q16+q17+q18+q19+q20+q21;
                       /*if form is valid, catch the session*/
                         userSession.setAttribute("stuNumber",stuNumber );
                           userSession.setAttribute("quesOne",quesOne); 
                           userSession.setAttribute("quesTwo",quesTwo); 
                           userSession.setAttribute("quesThree",quesThree); 
                           userSession.setAttribute("quesFour",quesFour); 
                           userSession.setAttribute("quesFive",quesFive); 
                           userSession.setAttribute("quesSix", quesSix); 
                           userSession.setAttribute("quesSeven",quesSeven); 
                           userSession.setAttribute("quesEight",quesEight); 
                           userSession.setAttribute("quesNine",quesNine); 
                           userSession.setAttribute("quesTen",quesTen); 
                           userSession.setAttribute("quesTwelve", quesTwelve);
                           userSession.setAttribute("quesEleven",  quesEleven);
                           userSession.setAttribute("quesThirteen", quesThirteen);
                           userSession.setAttribute("quesFourteen", quesFourteen);
                           userSession.setAttribute("quesFifteen",   quesFifteen);              
                          userSession.setAttribute("quesSixteen",  quesSixteen);             
                          userSession.setAttribute("quesSeventeen",quesSeventeen);
                          userSession.setAttribute("quesEighteen", quesEighteen);
                          userSession.setAttribute("quesNineteen",quesNineteen);
                          userSession.setAttribute("quesTwenty",quesTwenty);
                           userSession.setAttribute("quesTwentyOne",quesTwentyOne);
                           userSession.setAttribute("total",total);
                            RequestDispatcher disp;
                            disp = getServletContext().getRequestDispatcher("/confirmation.jsp");
                            disp.forward(req, res);      
                          //get free connection from pool
                            conn =connectionPool.getConnection();      
                //select a database
               // conn.setCatalog("survey");
                /* add this part*/
                stmt = conn.createStatement();
                rs = stmt.executeQuery("SELECT*  FROM survey where stuNumber='"+stuNumber+"'");
                    int count =0;//how many rows we can find.
                    while (rs.next()){
                        count++;
                    connectionPool.returnConnection(conn);
                 if(count<1){                       
                          conn.setAutoCommit(false);
                        String  sql="insert into survey(name, stuNumber, gender,facultyName,degree, year, quesOne, quesTwo, quesThree, quesFour, quesFive, quesSix,quesSeven, quesEight, quesNine,quesTen,quesEleven, quesTwelve, quesThirteen, quesFourteen,quesFifteen, quesSixteen, quesSeventeen, quesEighteen, quesNineteen, quesTwenty, quesTwentyOne)";
                                             sql+="value(?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
                              ps = conn.prepareStatement(sql);
                              stmt = conn.createStatement();
                               ps.setString(1, name);
                              ps.setString(2, stuNumber);
                              ps.setString(3, gender);
                              ps.setString(4, facultName);
                              ps.setString(5, degree);
                              ps.setString(6, year);
                              ps.setString(7, quesOne);
                              ps.setString(8, quesTwo);
                              ps.setString(9, quesThree);
                              ps.setString(10, quesFour);
                              ps.setString(11, quesFive);
                              ps.setString(12, quesSix);
                              ps.setString(13, quesSeven);
                              ps.setString(14, quesEight);
                              ps.setString(15, quesNine);
                              ps.setString(16, quesTen);
                              ps.setString(17, quesEleven);
                              ps.setString(18, quesTwelve);
                              ps.setString(19, quesThirteen);
                              ps.setString(20, quesFourteen);
                              ps.setString(21, quesFifteen);
                              ps.setString(22, quesSixteen);
                              ps.setString(23, quesSeventeen);
                              ps.setString(24, quesEighteen);
                              ps.setString(25, quesNineteen);
                              ps.setString(26, quesTwenty);
                              ps.setString(27, quesTwentyOne);
                              ps.executeUpdate();                   
                         conn.commit();
                      conn.setAutoCommit(true);   
                      connectionPool.returnConnection(conn);
                 /* doing the update*/
                 else{
                      conn.setAutoCommit(false);
                      String sql2 = "UPDATE survey set name=?";
                        sql2+= ", gender=?,facultyName=?,degree=?, year=?, quesOne=?, questwo=?, quesThree=?, quesFour=?, quesFive=?, quesSix=?,";
                        sql2+= "quesSeven=?,quesEight=?, quesNine=?, quesTen=?,quesEleven=?, quesTwelve=?, quesThirteen=?, quesFourteen=?";
                        sql2+=",quesFifteen=?, quesSixteen=?, quesSeventeen=?, quesEighteen=?, quesNineteen=?, quesTwenty=?, quesTwentyOne=?";
                        sql2+="WHERE stuNumber=?";
                        ps = conn.prepareStatement(sql2);
                        stmt = conn.createStatement();
                         ps.setString(1, name);                    
                          ps.setString(2, gender);
                          ps.setString(3, facultName);
                          ps.setString(4, degree);
                          ps.setString(5, year);
                          ps.setString(6, quesOne);
                          ps.setString(7, quesTwo);
                          ps.setString(8, quesThree);
                          ps.setString(9, quesFour);
                          ps.setString(10, quesFive);
                          ps.setString(11, quesSix);
                          ps.setString(12, quesSeven);
                          ps.setString(13, quesEight);
                          ps.setString(14, quesNine);
                          ps.setString(15, quesTen);
                          ps.setString(16, quesEleven);
                          ps.setString(17, quesTwelve);
                          ps.setString(18, quesThirteen);
                          ps.setString(19, quesFourteen);
                          ps.setString(20, quesFifteen);
                          ps.setString(21, quesSixteen);
                          ps.setString(22, quesSeventeen);
                          ps.setString(23, quesEighteen);
                          ps.setString(24, quesNineteen);
                          ps.setString(25, quesTwenty);
                          ps.setString(26, quesTwentyOne);
                          ps.setString(27,  stuNumber);
                          ps.executeUpdate();                   
                   conn.commit();
                 conn.setAutoCommit(true);   
                 connectionPool.returnConnection(conn);
        }catch (SQLException e) {
              throw new ServletException(e);
         finally {
              try {
                   if(rs != null)
                        rs.close();
                   if(stmt != null)
                        stmt.close();
                   if(ps != null)
                        ps.close();
                   if(conn != null)
                        conn.close();
                   connectionPool.returnConnection(conn);
              } catch (SQLException e) {}
    } // end doPost
    public String getServletInfo()
        return "A Simple Servlet";
    }// end of ContrInsert

    The way to do this with a JSP is use an HTML Form tag to pass all the information on to a new page, and save the new info while creating this new page

  • Sending Response to xsl from servlet

    Hi,
    I am submitting request from xsl file to servlet through form,this action is taking place properly,but i want o return some rsult from servlet to xsl file. can any body tell me how to do this.
    Thanks in advance

    Put the results into the request scope, then forward the page to the JSP, which takes the results from the request scope and displays it.

  • Applet in jsp from servlet, but error: ClassNotFoundExcep

    The problem that I'm having is already mentioned a couple of times in this forum, but unfortunately I haven't found a solution, in thread http://forum.java.sun.com/thread.jspa?forumID=33&threadID=239405 is proposed solution but it's not working for me.
    I'm developing a project in IBM's Websphere Developer Studio 5.1.1. and JRE that I'm using for this project is 1.4.2. I have created servlet "CompanyDocument.java" and applet "SimpleApplet.java". Applet was created as single project and then imported into this one, that means that it's contained in current project as "SimpleAppletPackage.jar". I have placed jar in folder "Applets", Websphere automatically creates folder "simpleAppletPackage" and in it's root complied "SimpleApplet.class".
    When I put following code in the jsp page applet works correctly when application is runed.
    <APPLET code="simpleAppletPackage/SimpleApplet.class" codebase="Applets" archive="SimpleAppletPackage.jar" width="250" height="250"></APPLET>
    But I wanted to create jsp from servlet. So I used this code within servlet:
    out.print("<APPLET code=\"simpleAppletPackage/SimpleApplet.class\" codebase=\"Applets\"");
    out.print("archive=\"SimpleAppletPackage.jar\" width=\"250\" height=\"250\"></APPLET>");
    But I get an error (when running, no error when compiling). The error is copied from Java console:
    load: class simpleAppletPackage/SimpleApplet.class not found.
    java.lang.ClassNotFoundException: simpleAppletPackage.SimpleApplet.class
    at sun.applet.AppletClassLoader.findClass AppletClassLoader.java:162)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
    at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:123)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
    at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:566)
    at sun.applet.AppletPanel.createApplet(AppletPanel.java:619)
    at sun.plugin.AppletViewer.createApplet(Unknown Source)
    at sun.applet.AppletPanel.runLoader(AppletPanel.java:548)
    at sun.applet.AppletPanel.run(AppletPanel.java:299)
    at java.lang.Thread.run(Thread.java:534)
    Caused by: java.io.IOException: open HTTP connection failed.
    at sun.applet.AppletClassLoader.getBytes(AppletClassLoader.java:265)
    at sun.applet.AppletClassLoader.access$100(AppletClassLoader.java:43)
    at sun.applet.AppletClassLoader$1.run(AppletClassLoader.java:152)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:149)
    ... 9 more
    In the same time I'm creating some more code from servlet and it works with no errors and is shown in browser properly (it consists of connection to Oracle, formatting table, and presenting data within that table).
    Any idea? I'm totally stuck.

    In your browser, look at the HTML code that gets sent to the browser and see if there is something wrong with it.
    Specifically, I would look at the code near the <APPLET ..></APPLET> tags, both before and after and look for stray quotes, brackets, or what not.
    Finally, I would look inside the <APPLET ...> tag. It appears to me that the output will probably be:
    <APPLET code="simpleAppletPackage/SimpleApplet.class" codebase="Applets"archive="SimpleAppletPackage.jar" width="250" height="250"></APPLET>See, you may be missing a space between the "Applets" and the archive=. Try making the second out.print look like this:
    out.print(" archive=\"SimpleAppletPackage.jar\" width=\"250\" height=\"250\"></APPLET>"); See the extra space at the start of the output?

  • Hot deploy Servlet in webapp

    Can I hot deploy a servlet within a web application ?How should I do it?
              (When I compile my servlet into MyApp/web-inf/classes,user this URI -
              http://localhost:7001/MyApp/mypackage.myclass to invocate it ,It does not
              work correctly(error 404))
              

    Hi,
              If I use weblogic.servlet.ServletServlet to try just the servlet , It
              works correctly.But When I develop it in a web application , there is a lot
              of hypelink to this servlet,thus I can't use the relative path reference to
              that servlet.I try to set the name of weblogic.servlet.ServletServlet same
              as the webapp,It doesn't work,how do I solve this problem?
              Thank you
              Pan
              Subject: Re: Hot deploy Servlet in webapp
              > http://www.weblogic.com/docs51/classdocs/API_servlet.html#134798
              >
              > It even explains why you shouldn't use it in production environment.
              >
              > Dimitri
              

  • Pass data from servlet to jsp using sendRedirect

    Hi,
    I am passing data from servlet to jsp using forward method of request dispatcher but as it doesn't change the url it is creating problems. When ever user refreshes the screen(browser refresh) it's re-loading both servlet and jsp, which i don't want to happen. I want only the jsp to be reloaded.
    Can I pass data from servlet to jsp using sendRedirect in this case. I also want to pass some values from servlet to jsp but without using query string. I want to set some attributes and send to jsp just like we do for forward method of request dispatcher.
    Is there any way i can send data using attributes(without using query string) using sendRedirect? Please let me know

    sendRedirect is meant as a true redirect. meaning
    you can use it to redirect to urls not in your
    context....with forward you couldn't pass information
    to jsps/servlets outside your own context.Actually, you can:
    getServletContext().getContext("/other").getRequestDispatcher("/path/to/servlet").forward(request, response)I think the issue here is that the OP would like to have RequestDispatcher.forward() also update the address in the client's browser. That's not possible, AFAIK. By the time the request is forwarded, the browser has already determined the URL of the servlet, and the only I know of way to have the browser change the URL to the forwarded Servlet/JSP is to send a Location: header (i.e. sendRedirect()). Remember that server-side dispatching is transparent to the client. Maybe there's some tricky stuff you can do with JavaScript to change the address in the address bar without reloading the page?
    Brian

Maybe you are looking for

  • Itunes only shows error report when starting up

    Ok so I've downloaded some songs and every time that i double click Itunes to start it up this is exactly what pops up: iTunes has encountered a problem and needs to close. We are sorry for the inconvenience.      If you were in the middle of somethi

  • Moving SAP ERP Servers to a different domain.

    Hello Experts I currently have 3 SAP ERP 6.0 servers (central installs) a solution manager 7.0 EHP1 and netweaver CE machine all located in one windows domain (currenlty windows 2003 domain controllers) all running Oracle databases.  I have been aske

  • Seperating numbers according to digits

    Hello All, I have a long report and it includes a lot of numbers. I am asked to change number format. In my report, i see the numbers like this :                 12345678 What i am asked is to make numbers like this :       12.345.678 I know i can do

  • DMIS on 7.3 - Note 12312003 - Release of TDMS 4.0?

    According to Note 1231203 - TDMS release strategy (Add-on: DMIS, DMIS_CNT, DMIS_EXT...) II.4 Support for SAP NetWeaver 7.3 SAP NetWeaver 7.3 is first supported as of SAP TDMS 4.0. An upgrade to SAP NetWeaver 7.3 with SAP TDMS 3.0 is not supported. Is

  • IDVD is closing after a certain time.

    Hi, i made a movie with a sony Z1-HDV camera and made the montage in FCP. Than i export it with Quicktime 7.5. Than dropped it in iDVD. After a certain time iDVD just quits. With the below report. Also when i just open iDVD and open an other iDVD pro