Request dispatcher and jsp pages called from servlets

          Given the following webapp directory structure:
          root/
          jsp/
          ..all jsp files
          web-inf/
          classes/
          /servlets
               ..all servlet files
          /com
          ..all other java class files
          I have the jsp directory coded as: jspdir = "/jsp/" (and have tried variations
          on this theme)
          I try to open a new jsp page with the following code in a servlet in the above
          servlet directory:
               RequestDispatcher rd;
               rd = getServletContext().getRequestDispatcher(jspdir + myjsp.jsp);
               rd.forward(req, res);
          rd continues to return null.
          The jsp pages are not registered in the web.xml file for this webapp, if that
          makes any difference.
          Does anyone have any suggestions?     
          [problem.txt]
          

I create a small sample and put these files into /jsp in my war context
          it works fine, please send me the example code you are using and the
          environment description of the deployed application
          I attached my samples, that work
          Filip
          ~
          Namaste - I bow to the divine in you
          ~
          Filip Hanik
          Software Architect
          [email protected]
          www.filip.net
          "Bill Blackmon" <[email protected]> wrote in message
          news:[email protected]...
          >
          > Yes, I am able to access the jsp pages with the url listed.
          >
          > "Filip Hanik" <[email protected]> wrote:
          > >The weblogic servlet engine, is by default mapping anything that ends
          with
          > >*.jsp to be a JSP.
          > >so there shouldn't be a problem. You didn't answer my first question,
          > >are you able to access your JSP through the browser?
          > >http://localhost:7001/root/jsp/myjsp.jsp
          > >
          > >Filip
          > >
          > >--
          > >~
          > >Namaste - I bow to the divine in you
          > >~
          > >Filip Hanik
          > >Software Architect
          > >[email protected]
          > >www.filip.net
          > >"Bill Blackmon" <[email protected]> wrote in message
          > >news:[email protected]...
          > >>
          > >> The code you are reading in the message here was pasted in and
          > >> looks bad, so maybe that's what you are referring to? The dispatcher
          code
          > >is called
          > >> in the service() method of the servlet.
          > >> I have a suspicion that the jsp directory needs to be defined someplace
          > >-
          > >weblogic.properties
          > >> or web.xml?, though I don't see this in any of the examples that come
          > >with
          > >the product.
          > >>
          > >>
          > >>
          > >> "Simon Ng" <[email protected]> wrote:
          > >> >
          > >> >Hello Bill,
          > >> > Did you put a <BR>
          > >> >return;
          > >> ><BR>
          > >> >statement right after the dispatcher.forward() statement? Well, I am
          > >assuming
          > >> >your
          > >> >code is in the doPost() or doGet() methods.
          > >> >
          > >> >Simon
          > >> >
          > >> >
          > >> >"Filip Hanik" <[email protected]> wrote:
          > >> >>if you do http://localhost:7001/root/jsp/myjsp.jsp
          > >> >>
          > >> >>do you get a result?
          > >> >>
          > >> >>make sure you have the right character case on the filename.
          > >> >>
          > >> >>Filip
          > >> >>
          > >> >>--
          > >> >>~
          > >> >>Namaste - I bow to the divine in you
          > >> >>~
          > >> >>Filip Hanik
          > >> >>Software Architect
          > >> >>[email protected]
          > >> >>www.filip.net
          > >> >>"Bill Blackmon" <[email protected]> wrote in message
          > >> >>news:[email protected]...
          > >> >>>
          > >> >>> Given the following webapp directory structure:
          > >> >>> root/
          > >> >>> jsp/
          > >> >>> ..all jsp files
          > >> >>> web-inf/
          > >> >>> classes/
          > >> >>> /servlets
          > >> >>> ..all servlet files
          > >> >>> /com
          > >> >>> ..all other java class files
          > >> >>>
          > >> >>>
          > >> >>> I have the jsp directory coded as: jspdir = "/jsp/" (and have tried
          > >> >>variations
          > >> >>> on this theme)
          > >> >>> I try to open a new jsp page with the following code in a servlet
          > >in
          > >> >the
          > >> >>above
          > >> >>> servlet directory:
          > >> >>> RequestDispatcher rd;
          > >> >>> rd = getServletContext().getRequestDispatcher(jspdir + myjsp.jsp);
          > >> >>> rd.forward(req, res);
          > >> >>>
          > >> >>> rd continues to return null.
          > >> >>>
          > >> >>> The jsp pages are not registered in the web.xml file for this
          webapp,
          > >> >>if
          > >> >>that
          > >> >>> makes any difference.
          > >> >>>
          > >> >>> Does anyone have any suggestions?
          > >> >>>
          > >> >>
          > >> >>
          > >> >
          > >>
          > >
          > >
          >
          [filipInclude.jsp]
          [filipForward.jsp]
          [filip.jsp]
          

Similar Messages

  • JSP Redirection fails, from Servlet

    Hi I have simple web application, where im doing some java operation in servlet and Req dispatching to JSP page
    Most of the the times, on first request i see JSP null pointer exception and in the next request service runs fine.
    Below is the error msg
    <Apr 23, 2014 2:35:12 PM EDT> <Warning> <HTTP Session> <BEA-100094> <The session id: y107TYHGnQTzJjJqndgvXDjky7bv1Q9LpHBNbBDyT4tJfyLl1RMF has been accessed from 7205002717985624119S:3.239.16.221:3.239.16.221:15001,3.239.16.221:15002:dev:soa_server1, a server that is not the primary (2944952919000475971S:3.239.16.221:[15002,15002,-1,-1,-1,-1,-1]:3.239.16.221:15001,3.239.16.221:15002:dev:soa_server2). The request URL was: NONE>
    <Apr 23, 2014 2:35:12 PM EDT> <Warning> <HTTP Session> <BEA-100094> <The session id: y107TYHGnQTzJjJqndgvXDjky7bv1Q9LpHBNbBDyT4tJfyLl1RMF has been accessed from 7205002717985624119S:3.239.16.221:3.239.16.221:15001,3.239.16.221:15002:dev:soa_server1, a server that is not the primary (2944952919000475971S:3.239.16.221:[15002,15002,-1,-1,-1,-1,-1]:3.239.16.221:15001,3.239.16.221:15002:dev:soa_server2). The request URL was: NONE>
    <Apr 23, 2014 2:35:12 PM EDT> <Warning> <HTTP Session> <BEA-100094> <The session id: y107TYHGnQTzJjJqndgvXDjky7bv1Q9LpHBNbBDyT4tJfyLl1RMF has been accessed from 7205002717985624119S:3.239.16.221:3.239.16.221:15001,3.239.16.221:15002:dev:soa_server1, a server that is not the primary (2944952919000475971S:3.239.16.221:[15002,15002,-1,-1,-1,-1,-1]:3.239.16.221:15001,3.239.16.221:15002:dev:soa_server2). The request URL was: NONE>
    <Apr 23, 2014 2:35:12 PM EDT> <Warning> <HTTP Session> <BEA-100094> <The session id: y107TYHGnQTzJjJqndgvXDjky7bv1Q9LpHBNbBDyT4tJfyLl1RMF has been accessed from 7205002717985624119S:3.239.16.221:3.239.16.221:15001,3.239.16.221:15002:dev:soa_server1, a server that is not the primary (2944952919000475971S:3.239.16.221:[15002,15002,-1,-1,-1,-1,-1]:3.239.16.221:15001,3.239.16.221:15002:dev:soa_server2). The request URL was: NONE>
    <Apr 23, 2014 2:35:12 PM EDT> <Warning> <HTTP Session> <BEA-100094> <The session id: y107TYHGnQTzJjJqndgvXDjky7bv1Q9LpHBNbBDyT4tJfyLl1RMF has been accessed from 7205002717985624119S:3.239.16.221:3.239.16.221:15001,3.239.16.221:15002:dev:soa_server1, a server that is not the primary (2944952919000475971S:3.239.16.221:[15002,15002,-1,-1,-1,-1,-1]:3.239.16.221:15001,3.239.16.221:15002:dev:soa_server2). The request URL was: NONE>
    map size is :1
    java.lang.NullPointerException
            at jsp_servlet.__downloaddocument._jspService(__downloaddocument.java:140)
            at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
            at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
            at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
            at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
            at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:184)
            at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:526)
            at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:253)
            at com.ge.render.servlets.GenerateReportServlet.doPost(GenerateReportServlet.java:81)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
            at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
            at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
            at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
            at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
            at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
            at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
            at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
            at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
            at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
            at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
            at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
            at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
            at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
            at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
            at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)
            at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
            at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
            at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
            at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
            at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
            at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
            at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
            at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
    Please let me know, if you need source code of the files.
    Please help.
    _____________________________My JSP Page:_________________________________________
    <%@ page contentType="text/html; charset=US-ASCII" pageEncoding="US-ASCII"%>
    <%@ page import="java.util.Iterator"%>
    <%@ page import="java.util.HashMap"%>
    <%@ page import="java.util.Properties"%>
    <%@ page import="java.net.HttpURLConnection"%>
    <%@ page import="java.net.URL"%>
    <html>
        <head>
            <script type="text/javascript">
              function preloader() {
                  document.getElementById("loading").style.display = "none";
                  document.getElementById("content").style.display = "block";
              //preloader
            window.onload = setTimeout(preloader, 60000);
            </script>
            <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"></meta>
            <meta http-equiv="Connection" content="keep-alive"></meta>
            <link type="text/css" rel="stylesheet" href="CSS/GridTable.css"/>
        </head>
        <body>
            <table width="100%" height="100%" class="gridtable">
                <tr height="80">
                    <th colspan="2">
                        <jsp:include page="/common/header.jsp"/>
                    </th>
                </tr>
                <tr>
                    <td>
                        <div id="loading" align="center" style="display:block">
                            <img src="images/loader.gif" alt="Loading..."></img><br></br>
                            <p>
                                Please wait. Report generation is in progress. <br>
                                 Report generation time depends on number of reports being submitted.
                            </p>
                        </div>
                        <div id="content" align="center" style="display:none">
                            Report Generation Results.<br></br><br></br>
                              <table>
                            <%
                       Properties props = new Properties();
      props=(Properties)session.getAttribute("props");
                           Properties eProps = new Properties();
      eProps=(Properties)session.getAttribute("exeProps");
                            String name = null;
                    HashMap<String, String> map= (HashMap<String, String>)request.getAttribute("url");
    //                 HashMap<String, String> Names= (HashMap<String, String>)request.getAttribute("names");
                     String key=null ;
                 System.out.println("map size is :"+map.size());
                 String Customer=null;
              if(!(map.isEmpty())){
              Iterator keySetIterator =map.keySet().iterator();
               while(keySetIterator.hasNext()){
                  key = keySetIterator.next().toString();
                   Customer=props.getProperty(key);
               if(Customer == null){
               Customer=eProps.getProperty(key);
               if(map.get(key).toString().equals("ErrorMessage.jsp")){
                                   %>
                    <tr>        <td><b>
                                <%=Customer%></b>
                             Report Generation Failed
                            <a href="<%=map.get(key)%>">click here</a>
                             to see error. </td></tr>
                            <%
               }else{
               %>
                                <tr>
                                    <td width="55%">
                                        <b>
                                            <%=Customer%></b>
                                    </td>
                                    <td width="25%">Ready</td>
                                    <td width="50%">
                                        <a href="<%=map.get(key)%>" target="_blank">click here</a>
                                    </td>
                                </tr>
                            </table>
                            <%}
          }}%>
                        </div>
                        <br></br>
                        <div id="backbutton" align="center">
                            <a href="LoginSuccess.jsp">Back</a>
                        </div>
                    </td>
                </tr>
                <tr height="40">
                    <td colspan="2">
                        <jsp:include page="/common/footer.jsp"/>
                    </td>
                </tr>
            </table>
        </body>
    </html>
    ________________________Servlet code_______________________________________________
    public class GenerateReportServlet extends HttpServlet {
      private static final String CONTENT_TYPE = "text/html; charset=windows-1252";
        Properties FusionProps=null;
        @Override
        public void init(ServletConfig config) throws ServletException {
           super.init(config);
           try{
               FusionProps=new Properties();
            FusionProps.load(getServletContext().getResourceAsStream("/WEB-INF/Properties/Fusion.properties"));
           }catch(Exception e){
               e.printStackTrace();
      public void doPost(HttpServletRequest request,
                         HttpServletResponse response) throws ServletException,
                                                              IOException {
          String[] list1= request.getParameterValues("custs");
         if(list1 == null){
          request.setAttribute("msg", "<b><font color=\"red\">Select atleast one ReportID for custome report generation</font><b>");
          RequestDispatcher rd =
            request.getRequestDispatcher("/LoginSuccess.jsp");
          rd.forward(request, response);
        else{
             try{
             GenerateReportDAO gr=new GenerateReportDAO();
            HashMap<String, String> cust_urls = new HashMap<String, String>();
            HashMap<String, String> url_stats = new HashMap<String, String>();
             int count=list1.length;
            long starttime=System.nanoTime();
                String proxy=FusionProps.getProperty("ProxyHost");
                String port=FusionProps.getProperty("ProxyPort");
                String RUrl=FusionProps.getProperty("Url");
                String RToken=FusionProps.getProperty("xyz");
                String Furl=FusionProps.getProperty("SOACReqReceiver");
            for(int i = 0; i < count; i++)
                String URL = gr.generateReport(list1[i],proxy,port,RUrl,RToken,Furl);
                 cust_urls.put(list1[i], URL);
                if(URL=="ErrorMessage.jsp"){
                        cust_urls.put(list1[i], URL);
            long completeTime=System.nanoTime();  
             System.out.println("Total Elapsed time "+ (completeTime-starttime) + "NanoSeconds");
            request.setAttribute("url", cust_urls);
           // request.setAttribute("stats", url_stats);
         //   request.setAttribute("names", cust_names);
        RequestDispatcher rd =
          request.getRequestDispatcher("/DownloadDocument.jsp");
        rd.forward(request, response);
             catch(Exception e){
                 e.printStackTrace();
                 request.setAttribute("msg", "Server encountered internal error, Please try again. If error persists contact corporate oracle soa team.");
                 RequestDispatcher rd =
                   request.getRequestDispatcher("/ErrorMessage.jsp");
                 rd.forward(request, response);

    i have found the class and decompiled it. Pasting the contents below.
    I have tried to find something from it. didnt help.
    // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
    // Jad home page: http://www.kpdus.com/jad.html
    // Decompiler options: packimports(3)
    // Source File Name:   __downloaddocument.java
    package jsp_servlet;
    import java.io.*;
    import java.util.*;
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletException;
    import javax.servlet.http.*;
    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;
    import weblogic.jsp.internal.jsp.JspFunctionMapper;
    import weblogic.servlet.jsp.*;
    import weblogic.utils.http.HttpParsing;
    public final class __downloaddocument extends JspBase
        implements StaleIndicator
        public __downloaddocument()
        private static void _releaseTags(PageContext pageContext, JspTag t)
            while(t != null)
                DependencyInjectionHelper.preDestroy(pageContext, t);
                if(t instanceof Tag)
                    Tag tmp = (Tag)t;
                    t = ((Tag)t).getParent();
                    try
                        tmp.release();
                    catch(Exception exception) { }
                } else
                    t = ((SimpleTag)t).getParent();
        public boolean _isStale()
            boolean _stale = _staticIsStale((StaleChecker)getServletConfig().getServletContext());
            return _stale;
        public static boolean _staticIsStale(StaleChecker sci)
            return sci.isResourceStale("/DownloadDocument.jsp", 0x1459066fe00L, "10.3.6.0", "US/Eastern");
        private static byte[] _getBytes(String block)
            try
                return block.getBytes(_WL_ORIGINAL_ENCODING);
            catch(UnsupportedEncodingException u)
                _WL_ENCODED_BYTES_OK = false;
            return null;
        public void _jspService(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException
            ServletConfig config = getServletConfig();
            javax.servlet.ServletContext application = config.getServletContext();
            JspTag _activeTag = null;
            Object page = this;
            PageContext pageContext = JspFactory.getDefaultFactory().getPageContext(this, request, response, null, true, 8192, true);
            response.setHeader("Content-Type", "text/html; charset=US-ASCII");
            JspWriter out = pageContext.getOut();
            ByteWriter _bw = (ByteWriter)out;
            _bw.setInitCharacterEncoding(_WL_ORIGINAL_ENCODING, _WL_ENCODED_BYTES_OK);
            JspWriter _originalOut = out;
            HttpSession session = request.getSession(true);
            try
                response.setContentType("text/html; charset=US-ASCII");
                _bw.write(_wl_block0Bytes, "\r\n");
                _bw.write(_wl_block0Bytes, "\r\n");
                _bw.write(_wl_block0Bytes, "\r\n");
                _bw.write(_wl_block1Bytes, "\r\n\r\n");
                _bw.write(_wl_block0Bytes, "\r\n");
                _bw.write(_wl_block2Bytes, "\r\n<html>\r\n    <head>\r\n        <script type=\"text/javascript\">\r\n          function preloader() {\r\n              document.getElementById(\"loading\").style.display = \"none\";\r\n              document.getElementById(\"content\").style.display = \"block\";\r\n          }\r\n          //preloader\r\n         // window.onload = setTimeout(preloader, 10000);\r\n        </script>\r\n        <meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\"></meta>\r\n        <meta http-equiv=\"Connection\" content=\"keep-alive\"></meta>\r\n        <link type=\"text/css\" rel=\"stylesheet\" href=\"CSS/GridTable.css\"/>\r\n    </head>\r\n    <body>\r\n        <table width=\"100%\" height=\"100%\" class=\"gridtable\">\r\n            <tr height=\"80\">\r\n                <th colspan=\"2\">\r\n                    ");
                String __page = "/common/header.jsp";
                String __queryParams[][] = new String[0][];
                String __encoding = request.getCharacterEncoding();
                if(__encoding == null)
                    __encoding = "ISO-8859-1";
                if(__queryParams.length == 0)
                    pageContext.include(__page);
                else
                    pageContext.include(HttpParsing.makeURI(__page, __queryParams, __encoding));
                _bw.write(_wl_block3Bytes, "\r\n                </th>\r\n            </tr>\r\n             \r\n            <tr>\r\n                <td>\r\n                   <div id=\"loading\" align=\"center\" style=\"display:block\">\r\n                        <img src=\"images/loader.gif\" alt=\"Loading...\" ></img><br>\r\n                        <p> Please wait. Report generation is in progress. <br>\r\n                           Report generation time depends on number of reports submitted.</p>\r\n                    </div>\r\n                    <div id=\"content\" align=\"center\" style=\"display:none\" >\r\n                        Report Generation Results.<br><br>\r\n                       \r\n                         \r\n                        ");
                Properties props = new Properties();
                props = (Properties)session.getAttribute("props");
                Properties eProps = new Properties();
                eProps = (Properties)session.getAttribute("exeProps");
                String name = null;
                HashMap map = (HashMap)request.getAttribute("url");
                String key = null;
                System.out.println((new StringBuilder("map size is :")).append(map.size()).toString());
                if(map.size() < 5)
                    _bw.write(_wl_block4Bytes, "\r\n             <script type=\"text/javascript\">\r\n              window.onload = setTimeout(preloader, 60000);\r\n              </script>\r\n             ");
                else
                if(map.size() > 5 && map.size() < 10)
                    _bw.write(_wl_block5Bytes, "\r\n             <script type=\"text/javascript\">\r\n              window.onload = setTimeout(preloader, 80000);\r\n              </script>\r\n             ");
                else
                if(map.size() > 10)
                    _bw.write(_wl_block6Bytes, "\r\n             <script type=\"text/javascript\">\r\n              window.onload = setTimeout(preloader, 100000);\r\n              </script> \r\n             ");
                String Customer = null;
                if(!map.isEmpty())
                    for(Iterator keySetIterator = map.keySet().iterator(); keySetIterator.hasNext();)
                        key = keySetIterator.next().toString();
                        Customer = props.getProperty(key);
                        if(Customer == null)
                            Customer = eProps.getProperty(key);
                        if(((String)map.get(key)).toString().equals("ErrorMessage.jsp"))
                            _bw.write(_wl_block7Bytes, "\r\n                         \r\n                      <b>\r\n                            ");
                            out.print(String.valueOf(Customer));
                            _bw.write(_wl_block8Bytes, "</b>\r\n                         Report Generation Failed\r\n                        <a href=\"");
                            out.print(String.valueOf(map.get(key)));
                            _bw.write(_wl_block9Bytes, "\">click here</a>\r\n                         to see error.\r\n                         \r\n                        ");
                        } else
                            _bw.write(_wl_block10Bytes, "\r\n          <table>\r\n          <tr> <td width=\"55%\">\r\n           <b> ");
                            out.print(String.valueOf(Customer));
                            _bw.write(_wl_block11Bytes, "</b> </td><td width=\"25%\">Ready</td>\r\n          <td width=\"50%\"><a href=\"");
                            out.print(String.valueOf(map.get(key)));
                            _bw.write(_wl_block12Bytes, "\" target=\"_blank\">click here</a></td></tr></table>\r\n            ");
                _bw.write(_wl_block13Bytes, "\r\n                    </div>\r\n                    <br></br>\r\n                    <div id=\"backbutton\" align=\"center\">\r\n                        <a href=\"LoginSuccess.jsp\">Back</a>\r\n                    </div>\r\n                </td>\r\n            </tr>\r\n             \r\n            <tr height=\"40\">\r\n                <td colspan=\"2\">\r\n                    ");
                String __page = "/common/footer.jsp";
                String __queryParams[][] = new String[0][];
                String __encoding = request.getCharacterEncoding();
                if(__encoding == null)
                    __encoding = "ISO-8859-1";
                if(__queryParams.length == 0)
                    pageContext.include(__page);
                else
                    pageContext.include(HttpParsing.makeURI(__page, __queryParams, __encoding));
                _bw.write(_wl_block14Bytes, "\r\n                </td>\r\n            </tr>\r\n        </table>\r\n    </body>\r\n</html>");
            catch(Throwable __ee)
                if(!(__ee instanceof SkipPageException))
                    for(; out != null && out != _originalOut; out = pageContext.popBody());
                    _releaseTags(pageContext, _activeTag);
                    pageContext.handlePageException(__ee);
        private static boolean _WL_ENCODED_BYTES_OK = true;
        private static final String _WL_ORIGINAL_ENCODING = "US-ASCII".intern();
        private static final String _wl_block0 = "\r\n";
        private static final byte _wl_block0Bytes[] = _getBytes("\r\n");
        private static final String _wl_block1 = "\r\n\r\n";
        private static final byte _wl_block1Bytes[] = _getBytes("\r\n\r\n");
        private static final String _wl_block2 = "\r\n<html>\r\n    <head>\r\n        <script type=\"text/javascript\">\r\n          function preloader() {\r\n              document.getElementById(\"loading\").style.display = \"none\";\r\n              document.getElementById(\"content\").style.display = \"block\";\r\n          }\r\n          //preloader\r\n         // window.onload = setTimeout(preloader, 10000);\r\n        </script>\r\n        <meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\"></meta>\r\n        <meta http-equiv=\"Connection\" content=\"keep-alive\"></meta>\r\n        <link type=\"text/css\" rel=\"stylesheet\" href=\"CSS/GridTable.css\"/>\r\n    </head>\r\n    <body>\r\n        <table width=\"100%\" height=\"100%\" class=\"gridtable\">\r\n            <tr height=\"80\">\r\n                <th colspan=\"2\">\r\n                    ";
        private static final byte _wl_block2Bytes[] = _getBytes("\r\n<html>\r\n    <head>\r\n        <script type=\"text/javascript\">\r\n          function preloader() {\r\n              document.getElementById(\"loading\").style.display = \"none\";\r\n              document.getElementById(\"content\").style.display = \"block\";\r\n          }\r\n          //preloader\r\n         // window.onload = setTimeout(preloader, 10000);\r\n        </script>\r\n        <meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\"></meta>\r\n        <meta http-equiv=\"Connection\" content=\"keep-alive\"></meta>\r\n        <link type=\"text/css\" rel=\"stylesheet\" href=\"CSS/GridTable.css\"/>\r\n    </head>\r\n    <body>\r\n        <table width=\"100%\" height=\"100%\" class=\"gridtable\">\r\n            <tr height=\"80\">\r\n                <th colspan=\"2\">\r\n                    ");
        private static final String _wl_block3 = "\r\n                </th>\r\n            </tr>\r\n             \r\n            <tr>\r\n                <td>\r\n                   <div id=\"loading\" align=\"center\" style=\"display:block\">\r\n                        <img src=\"images/loader.gif\" alt=\"Loading...\" ></img><br>\r\n                        <p> Please wait. Report generation is in progress. <br>\r\n                           Report generation time depends on number of reports submitted.</p>\r\n                    </div>\r\n                    <div id=\"content\" align=\"center\" style=\"display:none\" >\r\n                        Report Generation Results.<br><br>\r\n                       \r\n                         \r\n                        ";
        private static final byte _wl_block3Bytes[] = _getBytes("\r\n                </th>\r\n            </tr>\r\n             \r\n            <tr>\r\n                <td>\r\n                   <div id=\"loading\" align=\"center\" style=\"display:block\">\r\n                        <img src=\"images/loader.gif\" alt=\"Loading...\" ></img><br>\r\n                        <p> Please wait. Report generation is in progress. <br>\r\n                           Report generation time depends on number of reports submitted.</p>\r\n                    </div>\r\n                    <div id=\"content\" align=\"center\" style=\"display:none\" >\r\n                        Report Generation Results.<br><br>\r\n                       \r\n                         \r\n                        ");
        private static final String _wl_block4 = "\r\n             <script type=\"text/javascript\">\r\n              window.onload = setTimeout(preloader, 60000);\r\n              </script>\r\n             ";
        private static final byte _wl_block4Bytes[] = _getBytes("\r\n             <script type=\"text/javascript\">\r\n              window.onload = setTimeout(preloader, 60000);\r\n              </script>\r\n             ");
        private static final String _wl_block5 = "\r\n             <script type=\"text/javascript\">\r\n              window.onload = setTimeout(preloader, 80000);\r\n              </script>\r\n             ";
        private static final byte _wl_block5Bytes[] = _getBytes("\r\n             <script type=\"text/javascript\">\r\n              window.onload = setTimeout(preloader, 80000);\r\n              </script>\r\n             ");
        private static final String _wl_block6 = "\r\n             <script type=\"text/javascript\">\r\n              window.onload = setTimeout(preloader, 100000);\r\n              </script> \r\n             ";
        private static final byte _wl_block6Bytes[] = _getBytes("\r\n             <script type=\"text/javascript\">\r\n              window.onload = setTimeout(preloader, 100000);\r\n              </script> \r\n             ");
        private static final String _wl_block7 = "\r\n                         \r\n                      <b>\r\n                            ";
        private static final byte _wl_block7Bytes[] = _getBytes("\r\n                         \r\n                      <b>\r\n                            ");
        private static final String _wl_block8 = "</b>\r\n                         Report Generation Failed\r\n                        <a href=\"";
        private static final byte _wl_block8Bytes[] = _getBytes("</b>\r\n                         Report Generation Failed\r\n                        <a href=\"");
        private static final String _wl_block9 = "\">click here</a>\r\n                         to see error.\r\n                         \r\n                        ";
        private static final byte _wl_block9Bytes[] = _getBytes("\">click here</a>\r\n                         to see error.\r\n                         \r\n                        ");
        private static final String _wl_block10 = "\r\n          <table>\r\n          <tr> <td width=\"55%\">\r\n           <b> ";
        private static final byte _wl_block10Bytes[] = _getBytes("\r\n          <table>\r\n          <tr> <td width=\"55%\">\r\n           <b> ");
        private static final String _wl_block11 = "</b> </td><td width=\"25%\">Ready</td>\r\n          <td width=\"50%\"><a href=\"";
        private static final byte _wl_block11Bytes[] = _getBytes("</b> </td><td width=\"25%\">Ready</td>\r\n          <td width=\"50%\"><a href=\"");
        private static final String _wl_block12 = "\" target=\"_blank\">click here</a></td></tr></table>\r\n            ";
        private static final byte _wl_block12Bytes[] = _getBytes("\" target=\"_blank\">click here</a></td></tr></table>\r\n            ");
        private static final String _wl_block13 = "\r\n                    </div>\r\n                    <br></br>\r\n                    <div id=\"backbutton\" align=\"center\">\r\n                        <a href=\"LoginSuccess.jsp\">Back</a>\r\n                    </div>\r\n                </td>\r\n            </tr>\r\n             \r\n            <tr height=\"40\">\r\n                <td colspan=\"2\">\r\n                    ";
        private static final byte _wl_block13Bytes[] = _getBytes("\r\n                    </div>\r\n                    <br></br>\r\n                    <div id=\"backbutton\" align=\"center\">\r\n                        <a href=\"LoginSuccess.jsp\">Back</a>\r\n                    </div>\r\n                </td>\r\n            </tr>\r\n             \r\n            <tr height=\"40\">\r\n                <td colspan=\"2\">\r\n                    ");
        private static final String _wl_block14 = "\r\n                </td>\r\n            </tr>\r\n        </table>\r\n    </body>\r\n</html>";
        private static final byte _wl_block14Bytes[] = _getBytes("\r\n                </td>\r\n            </tr>\r\n        </table>\r\n    </body>\r\n</html>");
        private static JspFunctionMapper _jspx_fnmap = JspFunctionMapper.getInstance();

  • Cannot a get JSP page instance from a page being destroyed

    We have a J2EE app, using Struts + Tiles (build 1.1-b3), running on Win2KPro, Ora9ias v9.0.3. The application is roles-based, and different users see different versions of the same page based on their role authorizations. Occasionally, when multiple users in different roles are requesting the same page, the app returns the following exception:
    OracleJSP:
    JSP Error:
    Request URI:/fast/WEB-INF/jsp/tiles/layouts/baseLayout.jsp
    Exception:
    javax.servlet.ServletException: Cannot a get JSP page instance from a page being destroyed
         at oracle.jsp.runtimev2.JspPageInstFacade.getInstance(JspPageInstFacade.java:147)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:303)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
         at com.gal.fast.portal.web.SessionInitializedFilter.doFilter(SessionInitializedFilter.java:105)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:556)
         at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:119)
         at org.apache.struts.tiles.TilesUtilStrutsModulesImpl.doInclude(TilesUtilStrutsModulesImpl.java:124)
         at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:161)
         at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:703)
         at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:818)
         at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:467)
         at web2d_inf._jsp._tiles._layouts._baseLayout._jspService(_baseLayout.java:445)
         [SRC:/WEB-INF/jsp/tiles/layouts/baseLayout.jsp:149]
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
         at com.gal.fast.portal.web.SessionInitializedFilter.doFilter(SessionInitializedFilter.java:105)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:556)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:209)
         at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1033)
         at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:269)
         at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:249)
         at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:303)
         at org.apache.struts.action.RequestProcessor.processActionForward(RequestProcessor.java:401)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
         at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:505)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at com.gal.fast.portal.web.FastActionServlet.service(FastActionServlet.java:110)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
         at com.gal.fast.portal.web.SessionInitializedFilter.doFilter(SessionInitializedFilter.java:105)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:556)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:148)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:72)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:536)
    All the code in the two custom classes above ( com.gal.fast.portal.web.SessionInitializedFilter and com.gal.fast.portal.web.FastActionServlet ) has been commented out to the point that they are NOOP stubs.
    We only see this with multiple near-simultaneous requests for the same page with differet roles. It smells like a threading issue to me, but I'm no expert (hence this post). Any thoughts?
    --matt

    We have a J2EE app, using Struts + Tiles (build 1.1-b3), running on Win2KPro, Ora9ias v9.0.3. The application is roles-based, and different users see different versions of the same page based on their role authorizations. Occasionally, when multiple users in different roles are requesting the same page, the app returns the following exception:
    OracleJSP:
    JSP Error:
    Request URI:/fast/WEB-INF/jsp/tiles/layouts/baseLayout.jsp
    Exception:
    javax.servlet.ServletException: Cannot a get JSP page instance from a page being destroyed
         at oracle.jsp.runtimev2.JspPageInstFacade.getInstance(JspPageInstFacade.java:147)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:303)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
         at com.gal.fast.portal.web.SessionInitializedFilter.doFilter(SessionInitializedFilter.java:105)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:556)
         at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:119)
         at org.apache.struts.tiles.TilesUtilStrutsModulesImpl.doInclude(TilesUtilStrutsModulesImpl.java:124)
         at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:161)
         at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:703)
         at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:818)
         at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:467)
         at web2d_inf._jsp._tiles._layouts._baseLayout._jspService(_baseLayout.java:445)
         [SRC:/WEB-INF/jsp/tiles/layouts/baseLayout.jsp:149]
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
         at com.gal.fast.portal.web.SessionInitializedFilter.doFilter(SessionInitializedFilter.java:105)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:556)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:209)
         at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1033)
         at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:269)
         at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:249)
         at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:303)
         at org.apache.struts.action.RequestProcessor.processActionForward(RequestProcessor.java:401)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
         at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:505)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at com.gal.fast.portal.web.FastActionServlet.service(FastActionServlet.java:110)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
         at com.gal.fast.portal.web.SessionInitializedFilter.doFilter(SessionInitializedFilter.java:105)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:556)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:148)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:72)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:536)
    All the code in the two custom classes above ( com.gal.fast.portal.web.SessionInitializedFilter and com.gal.fast.portal.web.FastActionServlet ) has been commented out to the point that they are NOOP stubs.
    We only see this with multiple near-simultaneous requests for the same page with differet roles. It smells like a threading issue to me, but I'm no expert (hence this post). Any thoughts?
    --matt

  • SAP connector and Jsp page

    hi Experts,
    Can anyone please send me a working example project for SAP connector and Jsp page at [email protected]
    Regards,
    Sanjyoti.

    Hi, 
    Use this example
    import com.sapportals.connector.ConnectorException;
    import com.sapportals.connector.connection.IConnection;
    import com.sapportals.connector.execution.objects.INativeQuery;
    import com.sapportals.connector.execution.objects.InvalidQueryStringException;
    import com.sapportals.connector.execution.objects.QueryExecutionException;
    import com.sapportals.connector.metadata.CapabilityNotSupportedException;
    import com.sapportals.portal.ivs.cg.ConnectionProperties;
    import com.sapportals.portal.ivs.cg.IConnectorGatewayService;
    import com.sapportals.portal.ivs.cg.IConnectorService;
    import com.sapportals.portal.prt.component.*;
    import com.sapportals.portal.prt.resource.ResourceException;
    import com.sapportals.portal.prt.runtime.PortalRuntime;
    public class TestJDBC extends AbstractPortalComponent
    public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
    throws ResourceException
    // Open a connection
    IConnectorGatewayService cgService = (IConnectorGatewayService)
    PortalRuntime.getRuntimeResources().getService(IConnectorService.KEY);
    ConnectionProperties prop = new ConnectionProperties(request.getLocale(),
    request.getUser());
    IConnection client = null;
    try {
    client = cgService.getConnection("System1", prop);
    } catch (Exception e) {
    response.write(e.toString());
    return;
    try {
    // Issue SQL Query statement
    INativeQuery query = client.newNativeQuery();
    String queryStr = "SELECT [CategoryID], [CategoryName], [Description] FROM
    [Categories]";
    //IQuery query = client.newQuery();
    //query.execute(queryStr);
    Object result = query.execute(queryStr);
    //ResultSet singleResult = ((ResultSet) result).getRow();
    //IRecordSet result = query.retrieveRecordSet();
    // Iterate returned result
    ResultSetMetaData recordMetaData = ((ResultSet)result).getMetaData();
    int colNum = recordMetaData.getColumnCount();
    //result.beforeFirst();
    while (((ResultSet)result).next()) {
    for (int i = 1; i <= colNum; i++) {
    response.write(((ResultSet)result).getString(i) + "<br>");
    // Close the connection
    client.close();
    } catch (QueryExecutionException e) {
    response.write(e.toString());
    } catch (CapabilityNotSupportedException e) {
    response.write(e.toString());
    } catch (ConnectorException e) {
    response.write(e.toString());
    } catch (InvalidQueryStringException e) {
    response.write(e.toString());
    } catch (ResourceException e) {
    response.write(e.toString());
    } catch (SQLException e){
    response.write(e.toString());
    }catch(Exception e){
    response.write(e.toString());

  • How to get multiple selections from jsp page in my servlet

    Hello Everyone,
    I've a list that allows users to make multiple selections.
    <select name=location multiple="multiple">
        <option>
             All
        </option>
        <option>
             Hyd
        </option>
        <option>
             Dub
        </option>
        <option>
             Mtv
        </option>
      </select>I want to get the selections made by user in jsp page from my servlet, selections can be multiple too.
    ArrayList locList = new ArrayList();
    locList = request.getParameter("location");when I do so, I get compilation error as the request returns string type. How do I then get multiple selections made by the user.
    Please let me know.

    For those kind of basic questions it would help a lot if you just gently consult the javadocs and tutorials.
    HttpServletRequest API: [http://java.sun.com/javaee/5/docs/api/javax/servlet/http/HttpServletRequest.html]
    Java EE tutorial part II: [http://java.sun.com/javaee/5/docs/tutorial/doc/]
    Coreservlet tutorials: [http://courses.coreservlets.com/Course-Materials/]

  • Accessing an IFRAME tag after page being called from Servlet

    Hi there, can anyone help me please.
    I have two JSP pages, JSP1a and JSP2. When I call JSP1a from my browser, it runs some alert messages and then calls JSP2, which does a check on my database and then returns control to JSP1a and reloads the page. This all works fine.
    I am now trying to integrate these two pages into my main app, but I get a problem. I am now calling JSP1a, from a controlling Java Servlet (my app is based around a Model 2 architecture) which fires fine, but the reference to the line
    "window.frames.hidFrame.location.href=jsp2.jsp"
    doesnt seem to work. "hidFrame" is an IFRAME in the body tag of my JSP1a page.
    Can anyone help ? why does this line not fire, when the page has been loaded from a Java Servlet ? but it fires fine when I load the page directly ? and what is the solution to get around this problem please.
    Thanks
    Robert
    JSP1a.jsp
    <HTML>
    <HEAD>
    <SCRIPT language="JavaScript" type="text/javascript">
         function checkFunction(){
              var seconds = new Date();
              alert("inside function 1c ");     
              window.frames.hidFrame.location.href = "jsp2.jsp";
         function retMessage(){
              alert("inside return function");
              window.location.reload(true);
    </SCRIPT>
    </HEAD>
    <BODY onload="setTimeout('checkFunction()',5000);">
    <p>this is JSP1a</p>
    <SCRIPT language="JavaScript">
    alert("inside main body");
    </SCRIPT>
    <IFRAME frameborder="0" id="hidFrame" style="display:none"></iframe>
    </BODY>
    </HTML>
    JSP2.jsp
    <%@ page import="java.util.*" %>
    <jsp:useBean id="dbBean" scope="application" class="myApp.DbBean"/>
    <HTML>
    <!-- JSP2.JSP -->
    <%
    boolean flag = false;
    int i=1;
    flag = dbBean.checkForUpdates();
    System.out.println("flag = " + flag);
    //if(flag == false) {
    if (i == 1){
    %>
         <BODY onload="parent.retMessage()">
    <%} else {%>
         <BODY onload="parent.setTimeout('checkFunction()', 5000)">
    <%}%>
    </BODY>
    </HTML>

    its ok, I have found the problem. Someone recommended to me to change the IFRAME tag to make it visible just while I was debugging and low-and-behold there was a 404 error message being displayed which I had no idea about. It couldnt find my JSP2.jsp page. Because I am calling JSP1a from a servlet now, I needed to add a full path to my reference so that the servlet would know where to look. I did this and it works ok. I know its probably not best practice to hard code the full path to JSP2.jsp, I guess I should go back to the servlet and call JSP2 from there ?
    Regards
    Robert

  • Help With Integrating Servlet and JSP Page?

    Hello There
    --i made jsp page that contain name and description fields and add button
    --and i made servlet that contain the code to insert name and description in the database
    --and i want to make that when the user hit the add button
    -->the entered name and description is sent to the servlet
    and the servlet sent them to database?
    here's what i 've done:
    the jsp code:
    <html:html locale="true">
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>
            Categories Page
           </title>
            <html:base/>
        </head>
        <body style="background-color: white">
        <form action="jpage.jsp" method="get">
            <h1>
                <center>
    categories Operations
                </center>
            </h1>
            <h3>
                 <label>Name</label>
            <input type="text" name="name" value="" size="10" />
                 <label>Description</label>
             <input type="text" name="description" value="" size="10" />
             <input type="submit" value="Add" name="button" />
           </h3>
       </form>
        </body>
    </html:html>the servlet code:
    import java.io.*;
    import java.util.Enumeration;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.net.*;
    class NewServlet1 extends HttpServlet{
         Connection conn;
         private ServletConfig config;
    public void init(ServletConfig config)
      throws ServletException{
         this.config=config;
    public void service (HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException {
       HttpSession session = req.getSession(true);
       res.setContentType("text/html");
    try{
         Class.forName("com.mysql.jdbc.Driver");
       conn = DriverManager.getConnection("jdbc:mysql://localhost/struts", "root", "");
         PreparedStatement ps;
       ps = conn.prepareStatement ("INSERT INTO categories (Name, Description) VALUES(?,?)");
          ps.setString (1, "aa");
          ps.setString (3, "bb");
          ps.executeUpdate();
          ps.close();
          conn.close();
      }catch(Exception e){ e.getMessage();}
      public void destroy(){}
    }

    The JSP Code:
    <html:html locale="true">
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>
            Categories Page
           </title>
            <html:base/>
        </head>
        <body style="background-color: white">
        <form action="actionServlet.do?action=Additem" method="*post*">
            <h1>
                <center>
    categories Operations
                </center>
            </h1>
            <h3>
                 <label>Name</label>
            <input type="text" name="name" value="" size="10" />
                 <label>Description</label>
             <input type="text" name="description" value="" size="10" />
             <input type="button" value="Submit">
           </h3>
       </form>
        </body>
    </html:html>The Servlet Code:
    import java.io.*;
    import java.util.Enumeration;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.net.*;
    public class NewServlet1 extends HttpServlet implements SingleThreadModel {
        public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException,IOException {
            doPost(request,response);
        public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException,IOException {
              String action = request.getParameter("action"); // action = "Additem"
              if (action.equals("Additem")) {
                   String name = request.getParameter("name");
                   String description = request.getParameter("description");
                         RequestDispatcher reqDisp = null;
                   try{
                  Connection conn;
                  PreparedStatement ps;
         Class.forName("com.mysql.jdbc.Driver");
       conn = DriverManager.getConnection("jdbc:mysql://localhost/struts", "root", "");
       ps = conn.prepareStatement ("INSERT INTO categories (Name, Description) VALUES(?,?)");
          ps.setString (1, name);
          ps.setString (3, description);
          ps.executeUpdate();
          ps.close();
          conn.close();
          reqDisp= request.getRequestDispatcher("./index.jsp");
          reqDisp.forward(request, response);
                   catch (Exception ex){
                        System.out.println("Error: "+ ex);
    }The web.xml code:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" 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">
        <servlet>
            <servlet-name>action</servlet-name>
            <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
            <init-param>
                <param-name>config</param-name>
                <param-value>/WEB-INF/struts-config.xml</param-value>
            </init-param>
            <init-param>
                <param-name>debug</param-name>
                <param-value>2</param-value>
            </init-param>
            <init-param>
                <param-name>detail</param-name>
                <param-value>2</param-value>
            </init-param>
            <load-on-startup>2</load-on-startup>
            </servlet>
        <servlet>
            <servlet-name>NewServlet1</servlet-name>
            <servlet-class>NewServlet1</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>action</servlet-name>
            <url-pattern>*.do</url-pattern>
        </servlet-mapping>
        <servlet-mapping>
            <servlet-name>NewServlet1</servlet-name>
            <url-pattern>/NewServlet1</url-pattern>
        </servlet-mapping>
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
            <welcome-file>index.jsp</welcome-file>
            </welcome-file-list>
            <servlet>
         <servlet-name>actionServlet</servlet-name>
         <servlet-class>com.test.servlet.NewServlet1</servlet-class>
    </servlet>
    <servlet-mapping>
         <servlet-name>actionServlet</servlet-name>
         <url-pattern>*.do</url-pattern>
    </servlet-mapping>
        </web-app>

  • Message bundles accessed from JSF and JSP pages

    Hello, everybody!
    I'm developing a localized JSF application. It is working pretty well until now.
    These are my message files:
    mensagens.properties
    mensagens_en_US.propertiesThis is how they're configured in faces-config.xml:
    <application>
        <resource-bundle>
            <base-name>br.urca.www.biblioteca.web.mensagens</base-name>
            <var>msg</var>
        </resource-bundle>
    </application>And this is how I access the messages in a page:
    <h:outputText value="#{msg.titulo}" />Nothing new until now. But now there was a need for me to have a raw jsp page in
    my web application. This page is displaying ok but I also need to access the
    message bundles as I'm able to access in the normal jsp with the JSF components.
    As you should know I can't use something like the above code with an +<h:outputText>+
    to access the messages because this is a JSF component and I'll not be able to use
    JSF components with this raw jsp page.
    So, my question is: how do I access my localized messages from a raw jsp page? I
    suppose there should be a way to do this, but unfortunately I started programming
    to the web world in Java with JSF, not JSP, so I don't know how to do this with
    JSP.
    Thank you very much.
    Marcos

    BalusC wrote:
    Just include [jstl-1.2.jar|https://maven-repository.dev.java.net/repository/jstl/jars/] in your classpath and define the fmt taglib in your JSP. Nothing more is needed.
    Hello, BalusC. Thank you for your help. We're almost there. After I have included the jstl-1.2.jar you provided me I can use the fmt tag and access message bundles from my raw jsp page (even though I had to provide other message bundles instead of the ones that I use in the other jsf pages, but it's better than nothing).
    Now there just on problem to be fixed. The jsp page is not aware when I change the locale of my application. I change this locale in a jsf page.
    I have this component:
    <h:selectOneMenu value="#{pesquisaAcervo.idiomaAplicacao}"
        valueChangeListener="# {pesquisaAcervo.idiomaAplicacaoMudado}" onchange="submit();">
        <f:selectItems value="#{pesquisaAcervo.idiomasAplicacao}" />
    </h:selectOneMenu>that calls this event in my backing bean class:
    public void idiomaAplicacaoMudado(ValueChangeEvent e)
        fIdiomaAplicacao.liberarItens();
        Idioma idioma = Idioma.deString(e.getNewValue().toString());
        // This line is for JSF
        FacesContext.getCurrentInstance().getViewRoot().setLocale(idioma.localidade());
        // This line is for Tiles
        FacesContext.getCurrentInstance().getExternalContext().getSessionMap().
            put(org.apache.tiles.locale.impl.DefaultLocaleResolver.LOCALE_KEY, idioma.localidade());
    }So, do I have to include another line in the idiomaAplicacaoMudado event above in order for the jsp page load the correct resource bundle? Or what else do I have to do?
    Thank you.
    Marcos

  • Problem with displaying BLOB images on JSP page using a servlet

    hi. I have a big problem with displaying BLOB images using JSP. I have a servlet that connects to the oracle database, gets a BLOB image , reads it, and then displays it using a BinaryStream. The problem is , this works only when i directly call that servlet, that is http://localhost:8080/ImageServlet. It doesn't work when i try to use that servlet to display my image on my JSP page (my JSP page displays only a broken-image icon ) I tried several coding approaches with my servlet (used both Blob and BLOB objects), and they work just fine as long as i display images explicitly using only the servlet.
    Here's what i use : ORACLE 10g XE , Eclipse 3.1.2, Tomcat 5.5.16 , JDK 1.5
    here is one of my image servlet's working versions (the essential part of it) :
                   BLOB blob=null;
              rset=st.executeQuery("SELECT * FROM IMAGES WHERE ID=1");
              while (rset.next())
                   blob=((OracleResultSet)rset).getBLOB(2);
              response.reset();
              response.setContentType("image/jpeg");
              response.addHeader("Content-Disposition","filename=42.jpeg");
                    ServletOutputStream ostr=response.getOutputStream();
                   InputStream istr=blob.getBinaryStream(1L);
                    int size=blob.getBufferSize();
              int len=-1;
                    byte[] buff = new byte[size];
                         while ((len=istr.read( buff ))!=-1 ) {
                   ostr.write(buff,0,len);
             response.flushBuffer();
             ostr.close(); and my JSP page code :
    <img src="/ImageServlet" border="0"  > If you could just tell me what i'm doing wrong here , or if you could show me your own solutions to that problem , i would be very greatful ,cos i'm realy stuck here , and i'm rather pressed for time too. Hope someone can help.

    I turns out that it wasn't that big of a problem after all. All i had to do was to take the above code and place it into another JSP page instead of into a servlet like i did before. Then i just used that page as a source for my IMG tag in my first JSP. It works perfectly well. Why this doesn't work for servlets i still don't know, but it's not a problem form me anymore . Ofcourse if someone knows the answer , go ahead and write. I would still appriceatte it.
    here's the magic tag : <img src="ImageJSP.jsp" border="0"  > enjoy : )

  • Request dispatcher and mvc2

    is there any one who has implemented the mvc2 architecture for a ecommerce
              website
              precisely has anyone used servlets to fetch data from ejbs and used the
              data to
              populate the display object.
              this display object is then forwarded to the jsp using
              getRequestDispatcher.forward(jsp page).
              any help is appreciated.
              

    thanks.
              Heres the specific question.
              we are using weblogic 5.1 sp10 and the servlets call the session beans
              and get the data.
              this data is used to populate the display object which is forwarded to the
              jsp page using the requestdispatchers forward method.
              the jsp page then display the values which are set in the display object
              > > when multiple users hit the same page the results are crazy with user A
              > > seeing whole or part of data which user B
              > > is expecting. we will try to use the local variable approach..
              how can we solve the above problem?? we cant use HttpSession since its a
              webfarm approach.
              Cameron Purdy <[email protected]> wrote in message
              news:[email protected]...
              > Yes. Do you have any specific questions?
              >
              > Peace,
              >
              > --
              > Cameron Purdy
              > Tangosol, Inc.
              > Clustering Weblogic? You're either using Coherence, or you should be!
              > Download a Tangosol Coherence eval today at http://www.tangosol.com/
              >
              >
              >
              > "PD" <[email protected]> wrote in message
              > news:[email protected]...
              > > is there any one who has implemented the mvc2 architecture for a
              ecommerce
              > > website
              > >
              > > precisely has anyone used servlets to fetch data from ejbs and used the
              > > data to
              > > populate the display object.
              > >
              > > this display object is then forwarded to the jsp using
              > > getRequestDispatcher.forward(jsp page).
              > >
              > > any help is appreciated.
              > >
              > >
              >
              >
              

  • Second request to a JSP page

    When a second request is made to the JSP page, is the request sent to the servlet directly or is it handled by the JSP page. The question comes bcos when the JSP page is requested for a second time, a copy of the .class file is already available in the servlet container.

    hello,
    Even the first "request" is handled by the generated servlet! On to point, The JSP page GETS COMPILED ONLY ONCE after you install/modify it ,or on restart of server.Once a request is send to the jsp page ,the server checks for the time flag of the JSP file,and if it finds that the jsp page is modified,it recompiles the page,and send the request to the generated servlet for processing.Else it handles over the request to new servlet instance of precompiled servlet class.Note the diff in latency when you first call the JSP page and subsequent calls.This is because of foresaid reason.
    Just 4 fun try deleting the .class files in works folder,if u work on a tomcat.
    cheers
    [email protected]

  • Applet and JSP Page

    Hi.
    I have a class called clsDbGrid under the ./classes/pkgDB and a JSP page under de ./web directory. I need to call the class from my JSP. I wrote the follow code:
       <applet class="clsDbGrid.class" width="640" height="480">
           The browse doesn't support JAVA
       </applet>But this code doesn't work. What's wrong? I put the entire path for package and doesn't work again.
    Please, I'm beginner in Java and need a help.
    Thanks.
    Marco.
    P.S - Sorry for my terrible english. I'm from Brazil.

    See if this helps:
    http://java.sun.com/docs/books/tutorial/deployment/applet/html.html

  • Java File and JSP Page

    I am to create a link verification program -- a simple java file with the database connection & some business logic and a JSP page that instantiates the my java file. It won't work. Everytime I run the jsp page, it gives me java.lang.NullPointerException. Can anyone give me some directions? The web server I am using is JRun.
    Thank you
    Below are my code:
    JSP Page:
    <%--      Verify Links
    --%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <%@ page import="java.sql.*" %>
    <%@ page import="java.net.*" %>
    <%@ page import="pro.*" %>
    <html>
    <head>
    <title>Results</title>
    </head>
    <body>
    <%
    try{
    LinkConnection newconn = new LinkConnection();
    newconn.initialize();
    newconn.query();
    newconn.close();
    }catch (ClassNotFoundException cnfe)
    out.println(cnfe);
    catch (SQLException sqle)
    out.println(sqle);
    catch (NullPointerException npe)
    out.println(npe);
    %>
    </body>
    </html>
    Java Code:
    package pro;
    import java.io.*;
    import java.sql.*;
    import java.net.*;
    public class LinkConnection {
    Connection con;
    ResultSet RS;
    Statement Stmt;
    public void initialize() throws SQLException, ClassNotFoundException
    Class.forName("oracle.jdbc.driver.OracleDriver");
    con = DriverManager.getConnection("XXXX", "XXXX", "XXXX");
    public void query() throws SQLException
    Statement Stmt=con.createStatement();
    String strSQL="Select guideline_name, guideline_url from pgt_guidelines";
    ResultSet RS=Stmt.executeQuery(strSQL);
    while (RS.next())
    String guidelinename = RS.getString("guideline_name");
    String guidelineurl = ("http://" + RS.getString("guideline_url"));
    try {
    URL url = new URL(guidelineurl);
    HttpURLConnection link=(HttpURLConnection)url.openConnection();
    System.out.println("<font color='blue'>");
    System.out.println(guidelinename);
    System.out.println("<br>");
    System.out.println(guidelineurl);
    System.out.println("</font>");
    System.out.println("<font color='red'>");
    System.out.println(link.getResponseCode());
    System.out.println("</font>");
    System.out.println("<br />");
              }catch (Exception e)
              {System.out.println("<font color='yellow'>Error Link </font>")
    public void close() throws SQLException {     
    RS.close();
    Stmt.close();
    con.close();

    i'm having the same problem, what is the solution to this
    A Servlet Exception Has Occurred
    java.lang.NullPointerException
         at test.Lesson.runSql(Lesson.java:80)
    ===== Lesson.java file =====
    package test;
    import java.sql.* ;
    import java.io.Serializable;
    public class Lesson {
         public Lesson( ) { }
    //Line 9
         public String runSql ( ) {
              String browserOutput = "";
              Connection sqlca = null;
              Statement sqlStatement = null;
              ResultSet myResultSet = null;
    //Line 16
              /* Connect to database, run SQL and produce output */
              try { 
                   /* Connection to the database */
                   Class.forName("org.gjt.mm.mysql.Driver").newInstance();
                   String theDatabase ="jdbc:mysql://localhost/employee";
                   sqlca = DriverManager.getConnection(theDatabase,"usr","pwd");
    //Line 24
                   /* Construct and execute the sql, positioning before the
                   first row in the result set */
                   sqlStatement = sqlca.createStatement();
                   myResultSet = sqlStatement.executeQuery
    //Line 29
                   ("select emp_id, " +
                        "emp_lname, " +
                        "city, " +
                        "state," +
                        "zip_code, " +
                        "emp_fname " +
                        "from employee " +
                        "where emp_id < 250 " +
                        "order by emp_lname, emp_fname");
    //Line 39
                   /* Construct the heading for the table */
                   browserOutput =
                        "<div align=left>"+
                        "<table border=0 align=left width=520>" +
                        "<caption><i><b>" +
                        "Employee Listing</b></i></caption>" ;
    //Line 46
                   /* Construct the column headings for the table */
                   browserOutput +=
                        "<th align=left>Emp_id</th>" +
                        "<th>First Name</th>" +
                        "<th>Last Name</th>" +
                        "<th>City</th>" +
                        "<th>State</th>" +
                        "<th>Zip</th>" ;
    //Line 55
                   /* Move to next row and & its contents to the html output */
                   while(myResultSet.next()) {
                        browserOutput += "<TR><TD>" +
                   myResultSet.getObject("emp_id").toString() + "</TD><TD>" +
                   myResultSet.getObject("emp_fname").toString()+"</TD><TD>" +
                   myResultSet.getObject("emp_lname").toString() + "</TD><TD>" +
                   myResultSet.getObject("city").toString() + "</TD><TD>" +
                   myResultSet.getObject("state").toString() + "</TD><TD>" +
                   myResultSet.getObject("zip_code").toString() + "</TD></TR>" ;
    //Line 66
                   }//end of while
                   sqlStatement.close();
                   sqlca.close();
              }//end of try
              catch (SQLException e) {
    //Line 72
                   browserOutput = " Error: SQLException: " + e.getMessage();
                   browserOutput= " Error: SQLState: " + e.getSQLState();
                   browserOutput= " VendorError: " + e.getErrorCode();
              }//end of SQLException
              catch (Exception e) {
                   browserOutput = " Error: JDBC Class creation: " + e.getMessage();
              }//end of Exception
    /**Line 80**/     finally {
                   try { sqlca.close(); }
                   catch(SQLException e) {
                   browserOutput = " Error: Closing connection: " + e.getMessage();
              }//end of finally
         /* Complete the html and return it to the Java Server Page */
         browserOutput += "</table>" + "</div>" ;
         return browserOutput;
         } //end of runSql
    }//end of Lesson

  • Display request contents in JSP page

    i need to display the contents in a request in my JSP.
    meaning:
    i have a hashmap (containing string and a list) coming from the EJB tier to struts action in an event response object, I'm sure that the request has these values. cuz i tested it in struts action using the following code:
    HashMap result = (HashMap)((EventResponseSupport)request.getAttribute(WebKeys.EVENT_RESPONSE)).getPayload();
    System.out.println("Sponsor name = " + result.get("sponsor"));I am able to print it in the console but i need to know how to display it in the jsp. i tried many things but i can't get it right.
    first i need to display the string and then i need to iterate through the list to display its contents in a table.
    any help would be appreciated.

    Kindly use JSP Scriplet to load the HashMap into the Page Context.
    Then you can use the Struts iterate tags to paint the contents of the HashMap

  • Pass Object Between Applet and JSP Page

    Hi all,
    How can I pass an Object(such as Vector, File), rather than just string to the Applet from a JSP page?
    Thank you.

    I used Base64Encoder and Base64Decoder from servlets.com utilities.
    * convert any serializable object to a String
    public synchronized static String objectToString(Serializable obj) throws Exception {
        ByteArrayOutputStream bos = new ByteArrayOutputStream(100);
        ObjectOutputStream oos = new ObjectOutputStream(bos);
        oos.writeObject(obj);
        byte[]bytes = bos.toByteArray();
        bos = new ByteArrayOutputStream(); //to save the encoded String
        Base64Encoder enc = new Base64Encoder(bos);
        enc.write(bytes);
        String encodedString = bos.toString();
        //close all
        enc.close();   
        oos.close();
        bos.close();
        return encodedString;
    * Recreates the object from the encoded String
    public synchronized static Object stringToObject(String str) throws Exception {
        ByteArrayInputStream bis = new ByteArrayInputStream(str.getBytes());
        Base64Decoder dec = new Base64Decoder(bis);
        ObjectInputStream ois = new ObjectInputStream(dec);
        Object obj = (Object)ois.readObject();
        ois.close();
        dec.close();
        bis.close();
        return obj;
    }

Maybe you are looking for