Need JSP-URL in controlling servlet

Hi,
I have a simple questions which is driving me crazy.
2 JSP's are using same Servlet which has to process their input.
Inside this servlet I need to know which jsp is calling the servlet.
I tried following code :
          System.out.println("req.getRequestURI() = \"" + req.getRequestURI() +"\"");
          System.out.println("req.getClass() = \"" + req.getClass() +"\"");
          System.out.println("req.getPathInfo() = \"" + req.getPathInfo() +"\"");
          System.out.println("req.getPathTranslated() = \"" + req.getPathTranslated() +"\"");
          System.out.println("req.getServletPath() = \"" + req.getServletPath() +"\"");
          System.out.println("HttpUtils.getRequestURL(req)= \"" + HttpUtils.getRequestURL(req) +"\"");
but none of them are returning the correct name of the calling JSP...
Here are the results in same sequence:
req.getRequestURI() = "/servlet/com.clipper.servlets.FQController"
req.getClass() = "class com.ibm.servlet.engine.webapp.WebAppDispatcherRequest"
req.getPathInfo() = "null"
req.getPathTranslated() = "null"
req.getServletPath(req) = "/servlet/com.clipper.servlets.FQController"
HttpUtils.getRequestURL()= "http://www.clippersupport.be:2031/servlet/com.clipper.servlets.FQController"
As you can see, I only retrieve the Servlets info, not the JSP's...
I need to find :
/JSP/JSP1.jsp
How do I do this ???

I don't think it is possible to find out the details of the calling jsp in another servlet jsp or servlet. The only possibility is in the jsp get requestURL and place this as a request parameter in the request. Then when you call the servlet, the servlet can then extract this request parameter.

Similar Messages

  • How to get the query values from the url in a servlet and pass them to jsp

    ok..this is the situation...
    all applications are routed through a login page...
    so if we have a url like www.abc.com/appA/login?param1=A&param2=B , the query string must be passed onto a servlet(which is invoked before the login page is displayed)..the servlet must process the query string and then should pass all those values(as hidden values) to the login jsp..then user enters username and pswd, then there should be another servlet which takes all the hidden values of jsp and also username and pswd, authenticates the user and sends the control back to that particular application along with the hidden values...
    so i need help on how to parse the query string from the original url in the servlet, pass it out to jsp, and then pass it back to the servlet and back to the original application...damnn...any help would be greatly appreciated...thanks

    ok..this is the situation...Sounds like you have a bad design on your hands.
    You're going to send passwords in a GET request as clear text? Nice security there.
    Why not start with basic security and work your way up?
    %

  • Why jsp is converted into servlet?

    hi,
    Why the jsp is converted into servlet in the container? reason? why cant is evalute as a jsp file itself? why did not they develope a seperate container for jsp?

    hi :-)
    Why the jsp is converted into servlet in the container? reason? why cant is evalute as a jsp file itself?
    JSP is an extension of servlet technology :-)
    why did not they develope a seperate container for jsp?
    Note: (an excerpt from a book)
    "Inside the JSP container is a special servlet called the page compiler.
    The servlet container is configured to forward to this page compiler all HTTP
    requests with URLs that match the .jsp file extension.
    This page compiler turns a servlet container into a JSP container.
    When a .jsp page is first called, the page compiler parses and compiles
    the .jsp page into a servlet class. If the compilation is successful,
    the jsp servlet class is loaded into memory. On subsequent calls,
    the servlet class for that .jsp page is already in memory; however, it could have been updated.
    Therefore, the page compiler servlet will always
    compare the timestamp of the jsp servlet with the jsp page. If the .jsp page
    is more current, recompilation is necessary. With this process, once
    deployed, JSP pages only go through the time-consuming compilation
    process once"
    For more info you can refer to the packages: javax.servlet.jsp and
    javax.servlet.jsp.tagext
    and also the two servlet packages: javax.servlet and javax.servlet.http
    you might be asking why refer to servlet packages? because JSP needs it :-)
    as i mention earlier, JSP is an extension of servlet technology.
    hope other's will also give answer about your question.
    regards,

  • 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();

  • Filter does not work with *.jsp URL pattern???

    Hi All,
    I am, by no means, very good at JSF or Java. I have looked at various forum posts on here for ways to implement a security filter to intercept requests to pages that first require one to be logged in, and if not, redirect them to the login page. Yes, I know a lot of you have heard this many times before, and I'm sorry to bring it up again.
    BUT, from the guidance of other posts, I have got a filter that works fine when the url pattern is set to "/faces/*" or "/<anything>/*", however it won't work for "*.jsp" or "*.<anything>"
    My filter is as follows:
    package test.security;
    import javax.faces.context.FacesContext;
    import javax.servlet.Filter;
    import javax.servlet.FilterChain;
    import javax.servlet.FilterConfig;
    import javax.servlet.http.HttpSession;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class SecurityFilter implements Filter{
        /** Creates a new instance of SecurityFilter */
        private final static String FILTER_APPLIED = "_security_filter_applied";
        public SecurityFilter() {
        public void init(FilterConfig filterConfig) {
        public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws java.io.IOException, ServletException{
            HttpServletRequest req = (HttpServletRequest)request;
            HttpServletResponse res = (HttpServletResponse)response;
            HttpSession session = req.getSession();
            String requestedPage = req.getPathTranslated();
            String user=null;
            if(request.getAttribute(FILTER_APPLIED) == null) {
                //check if the page requested is the login page or register page
                if((!requestedPage.endsWith("Page1.jsp")) /* This is the login page */
                    //set the FILTER_APPLIED attribute to true
                    request.setAttribute(FILTER_APPLIED, Boolean.TRUE);
                    //Check that the session bean is not null and get the session bean property username.
                    if(((test.SessionBean1)session.getAttribute("SessionBean1"))!=null) {
                        user = ((test.SessionBean1)session.getAttribute("SessionBean1")).getUsername();
                    if((user==null)||(user.equals(""))) {
                       // try {
                     //       FacesContext.getCurrentInstance().getExternalContext().redirect("Page1.jsp");
                      //  } catch (ServletException ex) {
                      //      log("Error Description", ex);
                        res.sendRedirect("../Page1.jsp");
                        return;
            //deliver request to next filter
            chain.doFilter(request, response);
        public void destroy(){
    }My web.xml declaration for the filter is:
    <filter>
      <description>Filter to check whether user is logged in.</description>
      <filter-name>SecurityFilter</filter-name>
      <filter-class>test.security</filter-class>
    </filter>
    <filter-mapping>
      <filter-name>SecurityFilter</filter-name>
      <servlet-name>Faces Servlet</servlet-name>
    </filter-mapping>
    Note: I have also tried this with <url-pattern>*.jsp</url-pattern> for the filter mapping in place of the Faces Servlet
    My web.xml declaration for the url pattern is:
    <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>*.jsp</url-pattern>
    </servlet-mapping>Which JSC/NetbeansVWP automatically creates a "JSCreator_index.jsp" which has:
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root  version="1.2" xmlns:jsp="http://java.sun.com/JSP/Page">
      <jsp:forward page="Page1.jsp"/>
    </jsp:root>When run, this causes an Error 500 in the browser and a NullPointerException in SecurityFilter.java on the line:
    if((!requestedPage.endsWith("Page1.jsp")) /* This is the login page */I think I'm missing something that would be obvious to anyone who knows better than me. Any ideas?

    Dear Ginger and Boris,
    thanks for the information - the problem seems to ocur in EP7 as well, Boris told me it is fixed in SP15. We are on SP14 now, so there is hope !
    actually the information in the oss note stated above is also true, as we have an Oracle DB. On a similar demo system (only difference is SQL DB) the hyphen search works !
    best regards, thank you !
    Johannes

  • Jsp is faster that servlets

    hi why people will prefer jsp instead of servlets..
    and also what are all the prons and cons of servlsts and jsp..
    while using tomcat ...
    can any body specify with good examples and good reasons iam very thank full to them..
    .... i hope iam clear in my question

    Not everyone prefers JSPs to Servlets!
    JSPs are often preferred because they are automatically compiled and used by the application server. JSPs get compiled to Servlets and cached in the server and are then reused in the same way normal Servlets are.
    The choice of whether to use one or the other depends on the problem you are facing. In short, though, anything you can do with a JSP you can do with a Servlet and vice-versa.
    I would use a JSP for functionalty directly relating to display. This is because it is easy to alter without needing to restart the server (particularly useful for people maintaining content on a site).
    I would use Servlets for more core functionality such as authenticating users, dispatching XML to remote applications etc.
    A typical site might be made up of a few powerful Servlets and a large number of content-providing JSPs.

  • How to map every  request url to one servlet

    HI experts,
    I have a requirement like below,
    i want to map every request to a uinque servlet.
    http://localhost/krish/images/kk,gif
    http://localhost/krish/images/rao,gif
    http://localhost/krish/images/hh,jpg
    http://localhost/krish/images/srn.txt
    http://localhost/krish/images/hel.wav
    etc.............the no requests unlimited.
    So if i write mapping in web.xml its hard to write hundreds of urls.
    so i need some other process to map all these urls to one servlet ( processrequest.java)
    which will process all those requests.
    How do i do it?
    thanks in advance

    use url-pattern as /images/* then it will call the same servlet for all URL like you mentioned

  • How to add transient attribute to URL Data Control

    Hi,
    Is it possible to add a kind of "transient" attribute to an URL Data Control on model layer?
    regards
    Peter

    Hi,
    no. it doesn't. Even with ADF BC, the transient attributes need to be held by the business service and not the data control
    Frank

  • Processing a jsp file through a servlet first

    At my company we have a lot of code tied up in servlets for our website. We would like to integrate JSPs along side the servlet architecture. We need to process the html files though both our serlvet architecture (Our website menu system and security are handled here) and the jsp tags.
    Here is what currently happens. We write a webpage, the servlet archtecture process the pages, doing substitutions on specific objects and running code in specific objects to build the html that is sent to the users browser. Instead of immediately sending the output to the users browser, i'd like to process it through the jsp servlet first. How would I go about running the newly substituted code through the jsp engine?
    Thanks in advance,
    Jeff

    That I probably wasn't clear enough with what is happening on our site.
    Let me walk you through how our site works.
    Here is an extremely simple page, and i'll walk you through what happens.
    <HTML>
    <HEAD></HEAD
    <BODY>
    Welcome {!s:username!}
    <!--#SQLLOOP name="SELECT" QUERY="SELECT year, name FROM programs where program_group_id = 35"-->
    {!r:select:name!}--- {!r:select:year!}
    <!--#/SQLLOOP-->
    </BODY>
    </HTML>When that page is called, the servlet starts. It opens up the file, does a substitiution on {!s:username!} for the username variable from session data. It then will execute a javaclass for the SQLLLOOP statement and output the year and name for all values where the program_group_id = 35. After the substitutions are done, then spits the html back at you.
    Now what I would like to do is to get this code to play nice with JSPs.
    the <jsp:include> tag does not appear to work.

  • jsp:include from a Servlet???

    Hi guys,
    Does anybody know if there is a way of using <jsp:include> from a servlet?? It would save me alot of hassle!!

    Of course <jsp:include> is a JSP tag so it requires JSP :-).
    It is not clear exactly what you want to do, but here is one way to do includes. The JOT Servlets framework (http://www.jotobjects.com)
    has a general include mechanism. Here is an example that could be configured with web.xml elements to merge (include) one web page into another without any Java programming:
    <html>
    <body>
    ... start of page
    JOT.ContentName.Content
    <!-- merges content from another file or URL -->
    ... rest of page
    </body>
    </html>

  • How to map ALL .jsp to a Main servlet ?

    the problem is that i want to submit all forms on web pages to be processed by servler but to see in adress bar of my browser url with .jsp
    i tried to map main sertvlet in such a way
    <url-mapping>/*.jsp</url-mapping>
    but it didn't work...
    is there a way to invoke servlet but to see *. jsp as an url ?
    in other word, is it possible by calling index.jsp invoke some servlet behind the scene ?
    if i could map *.jsp this could be done automatically.....

    In theory you can use:<url-mapping>/*.jsp</url-mapping>However most web servers already intercept that mapping and it may bypass your mapping.
    For example in Tomcat there is a web descriptor in the <TOMCAT_HOME>/conf directory that maps all jsp extensions to org.apache.jasper.servlet.JspServlet.
    If you want to work with jsps on this level, try using filters intead, they may not be affected by the JspServlet as they have to pass through the filter first.
    Anthony

  • No parms passed to controlling servlet

    I want a page with an inputfield, 2 selectboxes and 1 (or more) submit-buttons. User MUST select a button before 'controlling servlet' is executed. (I mean, no action when 'enter' is used).
    These are the 2 scenarios I tried:
    Scenario (A)
    When i put the <Form ...> tag at the top of my jsp and include inputfields and buttons, I get a 500_error when the cursor is in an inputfield and users presses 'enter'.
    It seems that the parameters are not correctly passed to the 'controlling servlet'
    However, when I
    1) 'click' the Submit-button
    or
    2) 'click' outside this inputfield and then 'enter' or 'click' the Submit-button
    the parms are correctly passed and 'controlling servlet' is correctly executed.
    ==>
    <FORM action="/servlet/com.clipper.servlets.FQController" method=POST>
    <td width="150" height="25" colspan="3" bgcolor="#FFFFFF">
         <INPUT size="15" type="text" maxlength="15" tabindex="1" name="agency" value="<%= ((String) session.getValue("sessionid.useragencycode")).trim() %>"></td>
    <td width="600" height="25" bgcolor="#99CCFF" colspan="12">
    <p align="left"><INPUT type=submit tabindex="5" name="action" value=" List "></p></td>
    </FORM>
    Scenario (B)
    I changed code and do not have the 500_error when in inputfield but no parms are passed anymore.
    This is the code
    ==>
    <td width="150" height="25" colspan="3" bgcolor="#FFFFFF">
         <INPUT size="15" type="text" maxlength="15" tabindex="1" name="agency" value="<%= ((String) session.getValue("sessionid.useragencycode")).trim() %>"></td>
    <FORM action="/servlet/com.clipper.servlets.FQController" method=POST>
    <td width="600" height="25" bgcolor="#99CCFF" colspan="12">
    <p align="left"><INPUT type=submit tabindex="5" name="action" value=" List "></p></td></FORM>
    What is the correct implementation of this ?

    1. your text field or any other form fields have to place between the <form> and </form> tag..
    2. I don't know why you didn't get any paramter values, but you can write a function to list all the parameters that were in the request, call the function in the beginning of your control servlet.... Below is a sample...
         public static void listParameterValues(HttpServletRequest request) {
            Enumeration names = request.getParameterNames();
            if(names != null)  {
              String name="";
              while(names.hasMoreElements())  {
                name = (String)names.nextElement();
                String[] values = request.getParameterValues(name);
                if(values != null)  {
                  for(int i=0; i<values.length; i++)  {
                    System.out.println("listParameterValues(), " + name + "[" + i + "] = " + values);

  • 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/]

  • "Source not found" Error creating URL Data control with query parameters

    Hi,
    I have a restful service for which i want to create a URL data control. I am able to create the URL data control successfully when i am not passing any parameters in the Source field. But if i am specifying the parameters in the source field like this Department=##ParamName##, something weird is happening. After giving the param string in the Source field, it asks for default param value to test the url. It tests the url successfully. After that i select XML as the data format in which i am mentioning the xsd like this . "file:///C:/..../something.xsd" . And this is when i am getting the error. "Invalid Connection. The source is not found". I am giving exactly same path for xsd which i gave while creating URL data control without query parameters. Infact i was able to create the URL data control with query parameters successfully till afternoon. after that it started giving me this error all of a sudden. Infact as soon as i was able to create a URL data contol with query parameter successfully, i took a backup of the application before moving further. But even that backup is not working now.
    As far as i understand, i dont think there will be any change in xsd if query params are passed to a web service. Please correct me if i am wrong.
    Just dont know what could be the issue. Please help
    Thanks

    Hi,
    xsd is used for the URL service to know what the returned data structure is so it can create the ADF DC metadata
    Frank

  • Need create a new control key, which message control is "error mode", then PR or PO

    Hi All,
    Can please help me I got an issue in QM ,
    Issue Description :-  Current QM control key for supplier validation date is “0001”, the message mode is only warning. PR or PO still can be created forcibly. Need create a new control key, which message control is “error mode”, then PR or PO cannot be created successfully.
    I thing should add some additional logic using BADI or USER-EXIT.
    can please help me how to find BADI or USER-EXIT if you know the appropriate BADI please let me know.
    Regards,
    Nani

    Hi,
    I tried that way I entered message control as Defect even purchase requisition is created how can I restricted purchase request ion.
    Regards,
    Nani.   

Maybe you are looking for

  • Is it possible to scan without preview/ image capture??

    These programs are useless for scanning. Every time I try to scan something it automatically guesses where the image is cropped. It gets it wrong almost every time and there is no way of turning it off. I tried clicking the more details button but my

  • How to send notification mail by IDM 7.1?

    HI, I configured the idm 7.1 and want to send notification mail to user when a new user is created. But I can not get email from IDM. I think the SMTP server is right and I can telnet to SMTP server and send mails. How to test the IDM configuration i

  • Crystal Reports Server 2008 (Linux) - Crystal Reports/MySQL/ODBC Issue

    Hello, I have successfully installed CRS '08 on a Red Hat Enterprise Linux 4 server.  All services run fine. In the CMC, I have uploaded a Crystal Report that connect to a remote MySQL server.  I have installed the My SQL ODBC 3.51.11 and .12 Drivers

  • Confusion Does Bad Psu Equal Bad Overclocking

    I have recentley built my first system about a year ago, and its been runnin fine. The power supply in it now came with the case and is pretty weak, its only 430 watts and im pretty sure it has weak rails but it did the job. My query is that I recent

  • Unicode (numerical) character conversion

    What is the problem? Some characters written in unicode format do not get transformed to their appropriate font-character. Example Numerical version:    ≥ is printed as ≥ String version:          ≥ is printed correctly Both have the same unicode, yet