Security for a jsp page

Hi everybody I have a question , I do I give access certain access
          permission to s specific page
          For example , some one come to my site and is at
          A.jsp after validating it takes them to B.jsp. How do I gaurantee that the
          world can't just access the page by typing the url of B.jsp ?
          Thank you
          -John
          

Put security on B.jsp in your deployment XML file? That's what it is for.
          Check the Servlet spec for details.
          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/
          "John" <[email protected]> wrote in message
          news:3c5f070b$[email protected]..
          > Hi everybody I have a question , I do I give access certain access
          > permission to s specific page
          > For example , some one come to my site and is at
          > A.jsp after validating it takes them to B.jsp. How do I gaurantee that the
          > world can't just access the page by typing the url of B.jsp ?
          > Thank you
          > -John
          >
          >
          

Similar Messages

  • How to Generate a Java file for a JSP Page

    Hi ,
    I am using weblogic11 .
    I am working on a JSP page which nearly consists of 4000 lines of code.
    I need to debug the file , but weblogic server is not generating the java file for the JSP pages .
    Please let me know how can i genertae Java file for the jsp pages ??

    JSPs are compiled into servlets automatically and those classes are stored in WEB-INF/classes folder. Servlet engine handles servlets.

  • Requirements for building jsp pages

    wht are the basic requirements for building jsp pages
    or even 4 wrkin on j2ee..
    new to j2ee and hv exp on j2se

    It's depends what OS you have:
    Windows -- IIS + Tomcat
    Linux(FreeBSD) -- Apache + Tomcat (or Resin, but I prefer Tomcat);
    Of couse you should have a text editor to edit *.jsp file :-)

  • Setting Java class parameters for a JSP page

    Hi,
    I have a Java class that has a reference to a Session Id. I want to call a JSP from the class and set the session id to a String variable in the JSP. I am using a URL class to call the JSP. After the actual URL is passed to the URL constructor, I am appending the "?m_sessionId=e_session Id" at the end of the URL. In my JSP, I have the m_sessionId String parameter that i want to set e_sessionId to. What should i do in my JSP to set this? Any answers will be very helpful and I'd like to offer many thanks in advance
      public void loadSessionStuff(String sessionID){
       String e_sessionId = URLEncode.encode(sessionID);
       URL url = new URL("http://localhost:9000/MyJSP.jsp?m_sessionId="+e_sessionId);
       .....MyJSP.jsp looks something like this
       <%!
          String m_sessionId;
          public void setSessionId(){
           m_sessionid = request.getParameter("e_sessionId");    
           public String getSessionId(){
               return m_sessionId;
            other stuff....
        %>Is this the correct way to do things. It's not working.
    Regards
    R

    Hi Rahul,
    Yeah, i got that resolved. Do you know how i can get the thing in reverse gear. What i mean is i can successfully call and get the JSP to do things for me from my Java bean. What about sending stuff back to my bean?
    I want to send the List back to my calling class so i can work with it.
    Thanks
    Regards
    Jeeves
    My Java code is as follows
    Results i_krf = null;
      if(null != getSessionId()){                   
                    String e_sessionId = URLEncoder.encode(this.m_sessionId);
                    String eQuestion = URLEncoder.encode(sQuestion);
                    Object obj;               
                    String URL = "http://"+m_rea.getHostname()+":"+m_rea.getPort()+"/"+"SecondaryInitiator.jsp"+"?m_sessionId="+e_sessionId+"&question="+eQuestion;
                    URL url = new URL(URL);
                             URLConnection urlConn = url.openConnection();
                    ois = new ObjectInputStream(new BufferedInputStream(urlConn.getInputStream()));
                    while((obj = ois.readObject()) != null){
                         System.out.println("From OIS::"+obj.getClass());
                                    i_krf = (Reults) obj;
    <%@ page import = "java.io.*,java.sql.*,java.util.*"%>
    <%
      String m_sessionId;
      String eQuestion;
      System.out.println("In the JSP Page. Scriptlet part");
      m_sessionId = request.getParameter("m_sessionId");
      eQuestion = request.getParameter("question");
      System.out.println("Session Id in JSP::"+m_sessionId+"::"+eQuestion);
      Results i_krf = loadSession(m_sessionId);
      if(null != i_krf){
       System.out.println("NOT NULL::");
       List list = i_krf.getPathList(eQuestion);
       for(Iterator it = list.iterator();it.hasNext();){
        PathKeys pk = (PathKeys) it.next();
        System.out.println("PATH::"+pk.getPathKey());
    %>
    <%!     
         Shopper m_sSession = null;
         Results i_krf;
         public Results loadSession(String m_sessionId){
          if(null != m_sessionId){
            m_sSession = Shopper.findShopSession(m_sessionId);       
            System.out.println("Session ID from JSP"+m_sessionId);
            if(null != m_sSession ){
              i_krf = new ResultsImpl(m_sSession );
          return (null==i_krf?null:i_krf);
    %>

  • JSP implementation class for a JSP Page

    Hello,
    It is very important for me to know ...
    - Do you consider that a JSP developer should know that each JSP Page becomes at run-time a Java Servlet ? And int the way that the Java code you have wrote in the JSP Page is dispatched in the declaration of this servlet ?
    He should know how the Java code generated by the server looks like ?
    Thank you all for your answers.
    Adriana

    Everybody's going to have their own opinion on this - here's my 2 cents.
    Theoretically, there are at least two roles here.
    #1. An expert in HTML, graphic layout, user interface etc.
    #2. A programmer who understands the technical infrastructure - Java, beans, servlets, database connections etc.
    In the perfect world, Role #1 would build JSPs and would not need to understand Java or the technical architecture. The JSPs would act as templates and not contain any Java code (e.g. scriptlets). Role #2 would build custom tags and beans for use in the JSPs.
    To answer your question, Role #1 should not understand how JSPs are translated to servlets, but Role #2 should.
    In reality, the two roles are often filled by the same person, usually a programmer who may introduce Java elements into the JSP. Once this occurs, then the JSP has become a program rather than a template and knowledge of its translation to servlets is necessary for debugging.

  • How to set an 'alias' for a JSP page in web.xml

    Hi
    Suppose I have a JSP page called SimplePage.jsp and I want to refer to it by someother name while running the application how do I do this in the web.xml file. I have used <servlet-mapping> to do this in the case of a servlet. However I am not sure how to do this with a JSP
    Could somebody show me how to do this. I would be very much grateful.
    All help appreciated and acknowledged.
    thanks in advance
    ilango

    It worked. The correct web.xml version is as below:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app SYSTEM "http://java.sun.com/dtd/web-app_2_3.dtd" [
    ]>
    <web-app>
    <!-- Define servlets that are included in the example application -->
    <servlet>
    <servlet-name>ControllerServlet</servlet-name>
    <servlet-class>ControllerServlet</servlet-class>
    <init-param>
    <param-name>base</param-name>
    <param-value>http://localhost:8080/MVCIIapp/servlet/ControllerServlet</param-value>
    </init-param>
    <init-param>
    <param-name>jdbcDriver</param-name>
    <param-value>sun.jdbc.odbc.JdbcOdbcDriver</param-value>
    </init-param>
    <init-param>
    <param-name>imageUrl</param-name>
    <param-value>http://localhost:8080/MVCIIapp/images/</param-value>
    </init-param>
    <init-param>
    <param-name>dbUrl</param-name>
    <param-value>jdbc:odbc:Burnaby</param-value>
    </init-param>
    <init-param>
    <param-name>ilangocal</param-name>
    <param-value/>
    </init-param>
    <init-param>
    <param-name>mangla</param-name>
    <param-value/>
    </init-param>
    </servlet>
    <servlet>
    <servlet-name>Header</servlet-name>
    <jsp-file>/MVCIIapp/jsp/Header.jsp</jsp-file>
    </servlet>     
    <servlet-mapping>
    <servlet-name>ControllerServlet</servlet-name>
    <url-pattern>/Master</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>Header</servlet-name>
    <url-pattern>/Opener</url-pattern>
    </servlet-mapping>     
    </web-app>
    I have other jps files too.I am going to try and put aliases for them and see how they perform.
    I hope I have not spoken too soon by saying that the aliases work. Let me wait and watch with bated breath.
    But thanks a lot for your suggestions without which this would not have been possible
    ilango

  • Why does people use JSP Tag for their JSP page? (Urgent)

    I don't know what benifit if I am using JSP Tag.
    If anyone knows, pls give me an idea and the advantage of using JSP Tag in JSP Page!
    Thanks in advance!

    You have to read a little about JSP, JSP stands for JavaServer Pages, you can use jsp tags and you can use java code. If you dont want to use jsp tags then you should just write html file, if you just want to use java, then write java class or a servlet.
    The need for jsp arised because people were inserting html code inside a servlet class..a big no no..and a headache. JSP separate model from the view...read a little about MVC-2 model view controller pattern.
    Also read some tutorial on this website...good luck
    K

  • How can i  apply this  java program for  a jsp page?

    import java.io.*;
    import java.util.*;
    public class FileProcessing
      //create a vector container  for the input variables
         Vector variables = new Vector();
      //create a vector container for the constants
         Vector constants = new Vector();
      /*create a string expression container for the equation
         as read from the file */
         String expression = " ";
      //create double result container for the final result
         double result = 0;
         public boolean processFile(String filename,String delim)
          //index for values vector
              int num_values = 0;
          //index for constants vector
              int num_constants = 0;
          //current line being read from the external file.
              String curline = " ";
          //start reading from the external file
              try
                   FileReader fr = new FileReader(filename);
                   BufferedReader br = new BufferedReader(fr);
                   while(true)
                        curline = br.readLine();
                        if(curline == null)
                             break;
                    //determine the type of current interaction
                        boolean variable = curline.startsWith("input");
                        boolean constant = curline.startsWith("constant");
                        boolean equation = curline.startsWith("equation");
                        boolean output = curline.startsWith("result");
                   //on input variables
                        if(variable)
                          StringTokenizer st = new StringTokenizer(curline,delim);
                          int num = st.countTokens();
                          int count=0;
                          while(st.hasMoreTokens())
                               String temp = st.nextToken();
                               if(count==1)
                                    byte b[]= new byte[100];
                                    System.out.println(temp);
                                    System.in.read(b);
                                    String inputval = (new String(b)).trim();
                                    variables.add(num_values,inputval);
                                    num_values++;
                               count++;
                        // on constant values
                        if(constant)
                             StringTokenizer st = new StringTokenizer(curline,delim);
                             int num = st.countTokens();
                             int count = 0;
                             while(st.hasMoreTokens())
                                  String temp = st.nextToken();
                                  if(count==1)
                                       byte b[]= new byte[100];
                                       System.out.println(temp);
                                       System.in.read(b);
                                       String cons = (new String(b)).trim();
                                       constants.add(num_constants,cons);
                                       num_constants++;
                                  count++;
                        // on equation
                        if(equation)
                             StringTokenizer st = new StringTokenizer(curline,delim);
                             int num = st.countTokens();
                             int count = 0;
                             while(st.hasMoreTokens())
                                  String temp = st.nextToken();
                                  if(count==2)
                                       this.expression = temp;
                                  count++;
              // now we are ready to evaluate the expression
                       if(output)
                          org.nfunk.jep.JEP  myparser= new org.nfunk.jep.JEP();
                          myparser.setAllowAssignment(true);
                          for(int i=1;i<variables.size()+1;i++)
                             String name = "arg"+Integer.toString(i);
                             myparser.addVariable(name,new Double(variables.get(i-1)
                                                .toString()).doubleValue());
                          for(int i=1;i<constants.size()+1;i++)
                               String name = "arg" +Integer.
                                         toString(i+variables.size());
                               myparser.addConstant(name,new Double(constants.get(i-1).toString()));
                   //output is obtained as follows
                          myparser.parseExpression(expression);
                          result = myparser.getValue();
                          System.out.println("Assay value: "+result);
              catch(Exception e)
                   System.out.println(e.toString());
              return true;
         public static void main(String[] args)
              FileProcessing fp = new FileProcessing();
              fp.processFile("input.eqn",":");
    }//my text file name is: "input.eqn" (given below)
    input:Enter Value1:arg1
    input:Enter Value2:arg2
    input:Enter Value3:arg3
    constant:arg4
    constant:arg5
    Equation:arg1+arg2+arg3
    result:

    how can i apply this java program for a jsp pagewhy do you want to do this ?
    Your program reads from a file on the disk and formats based on a patterm.
    Jsp is not intended for such stuff.
    ram.

  • How to Use tag in JDeveloper 9i for a JSP Page

    Hi ,
    I am working on JDeveloper 9i. I have a problem that i use JSP page and two tag[b] fmt and core. The uri passed to taglib is http://java.sun.com/jsp/jstl/core and http://java.sun.com/jsp/jstl/fmt. i also have two jar file standard.jar and jstl.jar. when i compile the jsp page, the errors reflect " TAG is not registered". Can any one tell me that how can i use the tags in a jsp page in jdeveloper 9i.
    Thanks

    Hi ,
    I am working on JDeveloper 9i. I have a problem that i use JSP page and two tag[b] fmt and core. The uri passed to taglib is http://java.sun.com/jsp/jstl/core and http://java.sun.com/jsp/jstl/fmt. i also have two jar file standard.jar and jstl.jar. when i compile the jsp page, the errors reflect " TAG is not registered". Can any one tell me that how can i use the tags in a jsp page in jdeveloper 9i.
    Thanks

  • Define a request attribute for a JSP Page

    Where do I need to define the request parameters
    that will be read by my JSP Page?
    If I have a JSP:
    <% String userName = request.getParameter("name") %>Where shud the attribute name be defined so that its value is read
    by the JSP Page?
    Does it need to be defined in the tag lib as an attribute?

    Where do I need to define the request parameters
    that will be read by my JSP Page?It can be a HTML form field in another JSP from which the request comes to this JSP. Alternatively, it can be a parameter passed through the URL like
    http://myhost/myapp/myjsp.jsp?name=Richard

  • How to collect STATISTICS for my jsp pages

    Hola gurus.
    I'd like to collect statistics for my website, for example on my main page and certain other pages. Ideally I'd like to code it myself rather than using an external tool.
    Has anybody done this, or can u recommend an approach ?
    Here's my thoughts so far:
    1. Since I dont want to slow down the presentation of my pages, the first idea is to position the code after the </HTML> tag.
    <HTML>
    </HTML>
    <% MyGreatApp.addStatisticForPageVisit(pageName); %>
    So, even if the action of updating the statistics takes 1 second, my web page won't be delayed by 1 second (right ? or should I multi-thread it ?)
    2. I can keep a memory cache of pages viewed versus session id's, so that my statistics can reflect distinct user sessions (instead of "page visits" which can be misleading if a user clicks 50 times on the one page).
    Maybe there is a neat java caching class that I can use.
    3. I can then "save" my cache of statistics to the db periodically (say, every 5 minutes) to reduce db load. (?) I'm using mysql for my app already.
    Any help / guidance greatly appreciated !
    Thanks for the help java community you r great.

    Sure, we do it. Every time the user requests one of a certain set of pages, we write a record to a table in a database. That's all. No mucking about with threads or caches or anything like that. If you have a database setup where it takes 1 second to write a record, you need to get that fixed right away.
    As for session ID versus user ID, it depends on what you need. We just log the user ID so we can see who is using what applications, but your requirements may differ. There's nothing preventing you from logging both. Also, I do not know whether session ID's are unique over a long period of time, but logging the date and time of access should help you to deal with that problem if it exists. Basically, don't put too much logic into your logging code, just throw records out at the database. Any filtering or selection should be done on the back-end system that analyzes the logs.
    PC&#178;

  • How to set working-dir for precompiled jsp pages to some where under tmp

    If my weblogic application gets exploded into this tmp directory:
    D:\bea_domains\my_wl_domain\servers\SERVER001\tmp\_WL_user\mywebapp\wxyzzz\war
    where "wxyzzz" is a random directory name generated by weblogic 9.2, how would I set my working-dir in weblogic.xml to store the precompiled jsp classes under:
    D:\bea_domains\my_wl_domain\servers\SERVER001\tmp\_WL_user\mywebapp\wxyzzz\war\WEB-INF\classes\jsp_servlet\_jsp directory?
    Is there an "expression" or "variable" that will hold the value of the tmp directory? Thanks.

    If my weblogic application gets exploded into this tmp directory:
    D:\bea_domains\my_wl_domain\servers\SERVER001\tmp\_WL_user\mywebapp\wxyzzz\war
    where "wxyzzz" is a random directory name generated by weblogic 9.2, how would I set my working-dir in weblogic.xml to store the precompiled jsp classes under:
    D:\bea_domains\my_wl_domain\servers\SERVER001\tmp\_WL_user\mywebapp\wxyzzz\war\WEB-INF\classes\jsp_servlet\_jsp directory?
    Is there an "expression" or "variable" that will hold the value of the tmp directory? Thanks.

  • Ssl for my .jsp pages

    where can i get ssl? i went to thawrte.com and and my experiance trying to get ssl from them, has been POOR at best. The only other company i know is verisign, same owner as thawrte, but 4 times as expensive, does anyone know of anyohter company that offers ssl and is recognized by web browswers?
    Thanks
    Mole Man

    Doesn't this depend on settings in the browser? And can't your clients set their browser to 'always trust certificates' from you ...even your own certificate? I thought that was how it worked. Sometime in the past, you must have pressed 'Always trust certificates from verisign'. My browser doesn't automatically trust these ...cause I never press the 'Always trust certsificates from...' button.
    Then again, maybe I am thinking of something else here, but look into this behavior. If my browser automatically trusts these certs ...whats the point of asking permission?

  • How to implement content caching for jsp page ?

    Hello everyone,
    I am reading an article <Servlets and Jsp Best Practice>,at
    http://developer.java.sun.com/developer/technicalArticles/javaserverpages/servlets_jsp/#author, on one section it is saying :
    "Cache content: You should never dynamically regenerate content that doesn't
    change between requests. You can cache content on the client-side, proxy-
    side,or server-side. "
    Now I am working on a project. For every user, some of the content servlet generated will be the same for at least a week . I am thinking if I implement caching for these jsp pages, that would increase performace a lot.
    But I have no idea how to implement it either client-side or server-side, can someone give me a hint ?
    Thanks,
    Rachel

    You mean actually you are caching the response stream
    and the key to distinguish between different response
    streams are made of user's different request
    parameters. And the filter's function is to intercept
    the request to see if this request parameter's
    combination already exists in the Hashmap,then either
    use the cached response or forward to
    servlet.....really interesting...Do I get it right ?Yes that's it in a nutshell.
    >
    Then how do you build those response streams in
    advance ? You did it manually or have some mechanism
    to build it automatically ?
    The data gets cached the first time somebody visits the page.
    Find some examples on Filters, and take a look at the HttpServletResponseWrapper class. You need to cache response headers as well as the body. Another pitfall that you might run into is handling an If-modified-since header on the request. Don't cache the results of those requests.
    -Jonathan
    >
    Thanks again !
    Rachel

  • Need help in countdowntimer in java bean for jsp page

    hi..im student..i need help with countdowntimer in jsp page..with java bean component..im use XHTML MP for my jsp page so i can use it in cellular phone with WAP 1..can anybody help me with this problem..thx

    hi..im student..i need help with countdowntimer in jsp page..with java bean component..im use XHTML MP for my jsp page so i can use it in cellular phone with WAP 1..can anybody help me with this problem..thx

Maybe you are looking for

  • How do i get past apple id login after updating to iOS 8 on iPad 2

    I recently updated my iPad 2 to iOS 8 and now it is asking for my iCloud password to log in. I have read some of the other posts on this matter. However non of them seem to work. I have logged into i message and face time with new current account. I

  • SRM Shopping Cart Error

    Hi All, Can any one explain about the error "Please buy (PR Number) to exist" which is not allowing to create follow-on documents although PR and PO are created in backend. We are following the Classic scenario. Edited by: praveen sridhar on Jul 18,

  • Is iPod Nano Fifth Gen? Anyway, I dropped it in the toilet.

    It's not turning on, toggled the hold button a couple times. Waited 3 days to turn it on. Still not working. Is there a place I can send my iPod Nano away to get it checked or looked at for problems? Or do I need to take it to a local serive provider

  • Spare parts for powerbook G3

    The screen of my powerbook G3 is severely damaged by accident. So I contacted my nearest Apple reseller to find out that there are no spare parts any more for this "old" machine. I just would like to know if this a local problem or are the new G3 par

  • Trying to understand #STG & Skype Credit vs. subsc...

    #STG calling rates reads: "Skype To Go numbers are included when you buy Skype Credit or a subscription, so they don't cost extra to set up. Skype To Go number call costs break down into two parts:" I have set up a STG number for a user in an approve