Session Maintenance in JSp-- Servlet-- JSP

Iam making a browser based Financial Aplication so I want to introduce sessions into it.
My First page is a JSP which takes username and Password. Then it calls a servlet.
So my Problems are-
1. Iam able to start session from servlet (which validates username and password) but after that in the apllication some JSp's are there like for search options so how to maintain sessions in JSP's ?
2. When user quits browser and then opening a browser and directly types a JSP page which is in-between the flow this JSP opens up whereas i want the user to go from starting as its a security loop hole.
So how to maintain a session in a JSP (ie when control passes from Servlet to JSP at that time)?
Plz Help me
Thanks in advance

Hi Innova,
There is a solution .I think while validating the login page entries u should maintain a session variable and give it some constant value if the entered values are valid.And now u should always check this sesson variable for that constant value [ if(session.getParameter("s")==constvalue) ] only then u proceed further else diaplay an error message or link prompting to login
I hope it will work fine check it out.
GoodLuck.
Bye......

Similar Messages

  • Please help........JSP- Servlet- JSP

    Hi all,
    I got left menu in jsp page and when I click on links from there I go to a servlet and then return to the same page with different results.
    My problem is with the browser, it seems that none history data saved, and when I click back the home page appears.
    Any ideas?
    Thanks in advance,
    Sasi

    Simple scenario:
    1. You have a search bar. (like google search bar).
    2. You put a keyword and press search.
    3. You get NEW results page that contains menu on ur left side of the page (like here in Sun Forums), and the results of the search on ur right side of the page.
    4. You click on the left menu.
    5. The a href of the link go to servlet and get new data for you.
    6. You get a results page again as describe in step 3.
    7. You click again on the left menu and steps 5 and 6 occur again.
    8. You click on the BACK button in the explorer.
    9. The search bar appears of step 1 insteand of the previous page of step 4.
    Hope that clear the question.
    Thanks

  • JSP Servlet JDBC connection

    Below is the code for handling login.
    However I am new to servlets, and I am wondering is the code below correct?
    Can anyone give me some advice if it is not correct?
    package gcd;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import com.mysql.jdbc.*;
    public class LoginHandler extends HttpServlet
    public void doPost(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    res.setContentType("text/html");
    PrintWriter out = res.getWriter();
    //Load the driver
    Class.forName("com.mysql.jdbc.Driver");
    //Get a connection to the database
    java.sql.Connection connection=java.sql.DriverManager.getConnection("jdbc:mysql://localhost/gcdBB_db");
    //Create a statement object
    java.sql.Statement statement = connection.createStatement();
    Enumeration parameters = request.getParameterNames();
    if(parameters.hasMoreElements())
    // Get the user's account number, and password
    String username = req.getParameter("username");
    String password = req.getParameter("password");
    statement.executeUpdate("INSERT INTO users (username,password) VALUES ('"+username+"','"+password+"')");
    // Check the name and password for validity
    if (!allowUser(username, password))
    out.println("<HTML><HEAD><TITLE>Access Denied</TITLE></HEAD>");
    out.println("<BODY>Your login and password are invalid.<BR>");
    out.println("You may want to <A HREF=\"Login.jsp\">try again</A>");
    out.println("</BODY></HTML>");
    else
    // Valid login. Make a note in the session object.
    HttpSession session = req.getSession();
    session.setAttribute("logon.isDone", account); // just a marker object
    // Try redirecting the client to the page he first tried to access
    try
    String target = (String) session.getAttribute("login.target");
    if (target != null)
    res.sendRedirect(target);
    return;
    catch (Exception ignored) { }
    // Couldn't redirect to the target. Redirect to the site's home page.
    res.sendRedirect("/");
    protected boolean allowUser(String username, String password)
    return true; // trust everyone
    }

    I made the following changes as suggested, to the LoginHandlaer code.
    I also want to ask about the code for ProtectedResources. Do I need to inlude anything in the program. Will I need to include code for the JDBC connection?
    Are the 2 java servlets below correct, as I want JSP-Servlet-JSP operation for login? I can also include the code for Login.jsp if requested?
    PS: I am using Tomcat 3.1 as my server.
    package gcd;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import com.mysql.jdbc.*;
    public class LoginHandler extends HttpServlet
         public void doPost(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException
                   response.setContentType("text/jsp");
              PrintWriter out = response.getWriter();
              try
                   //Load the driver
                   Class.forName("com.mysql.jdbc.Driver");
                        //Get a connection to the database
                        java.sql.Connection connection=java.sql.DriverManager.getConnection("jdbc:mysql://localhost/gcdBB_db");
                        //Create a statement object
                        java.sql.Statement statement = connection.createStatement();
                        Enumeration parameters = request.getParameterNames();
                        // Get the user's username, and password
                        String username = request.getParameter("username");
                        String password = request.getParameter("password");
                        statement.executeUpdate("INSERT INTO users (username,password) VALUES ('"+username+"','"+password+"')");
                   // Check the username and password for validity
                   if (!allowUser(username, password))
                        out.println("<HTML><HEAD><TITLE>Access Denied</TITLE></HEAD>");
                        out.println("<BODY>Your login and password are invalid.<BR>");
                        out.println("You may want to <A HREF=\"Login.jsp\">try again</A>");
                        out.println("</BODY></HTML>");
                   else
                        // Valid login. Make a note in the session object.
                        HttpSession session = request.getSession();
                        session.setAttribute("logon.isDone", username); // just a marker object
                        // Try redirecting the client to the page he first tried to access
                        try
                             String target = (String) session.getAttribute("login.target");
                             if (target != null)
                                  response.sendRedirect(target);
                                  return;
                        catch (Exception ignored) { }
                             // Couldn't redirect to the target. Redirect to the site's home page.
                             response.sendRedirect(request.getContextPath() + "http://localhost:8080/jsp/gcdBB");
                   catch (ClassNotFoundException e)
                        out.println("Could not load database driver: " + e.getMessage());
                   catch(SQLException e)
                        out.println("SQLException caught: " + e.getMessage());
         protected boolean allowUser(String username, String password)
              return true; // trust everyone
    package gcd;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import com.mysql.jdbc.*;
    public class ProtectedResources extends HttpServlet
         public void doGet(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException
              response.setContentType("text/plain");
              PrintWriter out = response.getWriter();
              // Get the session
              HttpSession session = request.getSession();
              // Does the session indicate this user already logged in?
              Object done = session.getAttribute("logon.isDone"); // marker object
              if (done == null)
                   // No logon.isDone means he hasn't logged in.
                   // Save the request URL as the true target and redirect to the login page.
                   session.setAttribute("login.target",
                   HttpUtils.getRequestURL(request).toString());
                   response.sendRedirect(request.getContextPath() + "http://localhost:8080/jsp/gcdBB/Login.jsp");
                   return;
              // If we get here, the user has logged in and can see the bulletin boards
              out.println("The GCD Computing Bulletin Board awaits you!");
    Any help would be greatly appreciated!

  • How to create session in JSP & Servlet

    Hi All
    I'm really new to JSP & Servlet. So I want to know how to create sessions and how to pass details to another web page
    Thanks
    Padma

    You can easily pass objects from one jsp or servlet to another.
    On your servlet execute method (for example), you can do this as follows:
    HttpSession session = request.getSession();
    User u = new User();
    session.setAttribute("user", u);And get it again on other servlets:
    HttpSession session = request.getSession();
    User user = (User) session.getAttribute("user");I hope this helps you.

  • Session timing in jsp/servlets

    Hi all..!
    I have a small problem..Plz help me..
    We are developing an application in JSP, Servlets on Linux Platform. Here, the default session time set is 30 mins. But I need to extend it by another 15 mins.. i.e., my session should be set to atleast 45 mins..
    I can do it using the setMaxInactiveInterval(int interval). which sets the amount of time that the session will remain active between requests
    before expiring and the int getMaxInactiveInterval() , Which will return the length of time that the session will remain active between requests before
    expiring.
    Through the above method,I can set the session time. But the version of Servlets I have on my system is 2.0 JAR. and The above mentioned methods work only for servlets version 2.1 and above..
    Could U plz suggest a way where I can set the session time for the version of servlets I have?? Plz help me with the solution in servlet/jsp.
    This is quite urgent. Plz try and help me.
    Thanx and regards
    Aparna

    Hi Aparna,
    It seems that u can't set and get the Session timing in servlet 2.0, because the setMaxInactiveInterval() and getMaxInactiveInterval() methods are being introduced only in 2.1.
    But One thing u can try out. Use getLastAccessedTime() method, which will return the last time that a client sent a request for that session. After that u can easily calculate the inactive time. Hope it will work.
    ragards,
    Atanu
    Hi all..!
    I have a small problem..Plz help me..
    We are developing an application in JSP, Servlets on
    Linux Platform. Here, the default session time set is
    30 mins. But I need to extend it by another 15 mins..
    i.e., my session should be set to atleast 45 mins..
    I can do it using the setMaxInactiveInterval(int
    interval). which sets the amount of time that the
    session will remain active between requests
    before expiring and the int getMaxInactiveInterval()
    , Which will return the length of time that the
    session will remain active between requests before
    expiring.
    Through the above method,I can set the session time.
    But the version of Servlets I have on my system is 2.0
    JAR. and The above mentioned methods work only for
    servlets version 2.1 and above..
    Could U plz suggest a way where I can set the session
    time for the version of servlets I have?? Plz help me
    with the solution in servlet/jsp.
    This is quite urgent. Plz try and help me.
    Thanx and regards
    Aparna

  • Configuration of sessions for deployed servlet, jsp, wdp

    Hello,
    I wonder how to configure session for a specific servlet. As there are several locations where to deal with session management.
    I have found the Security Provider->SessionExpirationPeriod property which is fixed to ~27 hours, this is a general parameter for all security providers.
    I need to do it per application, I have then tried to set the session in the servlet descriptor it is not taken into account.
         <session-config>
              <session-timeout>10000</session-timeout>
         </session-config>
    The security provider of the servlet is set to SAML authentication.
    Thanks for your input on this topic,
    Tanguy Mezzano

    Finally, it was that parameter.

  • Javax.servlet.jsp.JspException: Can't insert page '/common/MenuFiles.jsp' :

    Hi,
    I am using WebLogic 11g.
    In my application am getting following exception in my console
    ####<Jun 4, 2012 2:03:47 AM CDT> <Error> <HTTP> <cuscmas1.hillscte.com> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1338793427049> <BEA-101017> <[ServletContext@2141448872[app:amsatms module:/paws path:/paws spec-version:null]] Root cause of ServletException.
    javax.servlet.jsp.JspException: Can't insert page '/common/MenuFiles.jsp' : Connection reset
    at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.processException(InsertTag.java:956)
    at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:884)
    at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473)
    at jsp_servlet._tdms._common.__tdmspage._jsp__tag1(__tdmspage.java:530)
    at jsp_servlet._tdms._common.__tdmspage._jspService(__tdmspage.java:427)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    Previously I was used OC4J, in that I didnt get any error.
    My MenuFiles.jsp is
    <%@ page import="com.hillspet.atms.common.constants.IATMSConstants" %>
    <%@ page import="com.hillspet.atms.common.constants.AnimalConstants" %>
    <%@ page import="com.hillspet.atms.common.constants.IATMSAccessConstants" %>
    <%@ page import="com.hillspet.atms.collectionkit.util.ICollectionKitConstants" %>
    <%@ page import="com.cte.common.IConstants" %>
    <%@ page import="com.cte.common.dto.UserDTO,com.hillspet.atms.common.util.ATMSUtil" %>
    <%@ page import="java.util.ArrayList" %>
    <%@page import="com.hillspet.ahms.animal.util.IAHMSAccessConstants,com.hillspet.admin.common.util.HillspetUtil, com.hillspet.ahms.animal.dto.AnimalBaseDTO"%>
    <%@page import="com.hillspet.ahms.animal.util.IAHMSAccessConstants,com.hillspet.admin.common.util.HillspetUtil, com.hillspet.ahms.animal.dto.AnimalBaseDTO"%>
    <%@ page import="com.cte.common.dto.UserDTO, com.cte.common.IConstants,     com.hillspet.admin.common.util.HillspetUtil, java.util.ArrayList, com.cte.common.ums.dto.RoleListEntryDTO,java.util.Arrays,java.util.Collections"%>
    <%@page import="com.hillspet.tdms.common.util.ITLMSAccessConstants,com.hillspet.admin.common.util.HillspetUtil"%>
    <%
    boolean isInternal = false;
    if(session.getAttribute("ANIMAL_BASE_DTO")!=null ){
         AnimalBaseDTO animalSummaryDetailsDTO = (AnimalBaseDTO) session.getAttribute("ANIMAL_BASE_DTO");
         if(animalSummaryDetailsDTO.getIsExternal()==0){
              isInternal = true;
    %>
    <%
    UserDTO dto = (UserDTO) session.getAttribute(IConstants.USER_OBJECT);
         ArrayList userPermissionsList = dto.getUserPermissionList();
    boolean isAdmin = dto.getRoleList().contains("" + IATMSConstants.ATMS_ADMIN_ROLE_ID);
    //System.out.println("User Permission list is :" + dto.getUserPermissionList());
         java.util.ArrayList rolesList = dto.getRoleList();
         boolean isEUUser = HillspetUtil.checkEUAccess(request, dto);
         ArrayList atmsRolesList=new ArrayList(Arrays.asList ("126","125","109","108","107","106","105","114","103","102","101","100","99","98","97","96","95","93","90","89","88","87","86","67","111","85","83","73","84","116","113", "127","128","130","132","133","134","135","136"));
    boolean displayATMSMenus = !Collections.disjoint(rolesList, atmsRolesList);
    %>
    <script>
         var breadcrumb = "<%=IATMSConstants.SEARCH_AND_VIEW%>";
    Initialize and render the MenuBar when its elements are ready
    to be scripted.
    YAHOO.util.Event.onContentReady("vmenu", function () {
    Instantiate a MenuBar: The first argument passed to the
    constructor is the id of the element in the page
    representing the MenuBar; the second is an object literal
    of configuration properties.
    var oMenuBar = new YAHOO.widget.MenuBar("vmenu", {
    autosubmenudisplay: true,
    hidedelay: 750,
    lazyload: true });
    Define an array of object literals, each containing
    the data necessary to create a submenu.
    var aSubmenuData = [
                        <%
                                  if(rolesList.contains("67") || rolesList.contains("84") || rolesList.contains("118") || rolesList.contains("111") || rolesList.contains("90") || rolesList.contains("83") || rolesList.contains("85") || rolesList.contains("88") || rolesList.contains("82") || displayATMSMenus){
                        %>
    id: "Tab1",
    itemdata: [
    <%if(HillspetUtil.checkAccess(request,IAHMSAccessConstants.CREATE_ANIMNAL_PERMISSION)) {%>
    { text: "Add Animal", url: "addAnimalGeneralInfoAction.do" },
                                            <%}%>
                                                      <%if(HillspetUtil.checkAccess(request,IAHMSAccessConstants.CREATE_ANIMNAL_PERMISSION)) {%>
    { text: "Record Manual Feeding", url: "saveChangeDietAction.do?command=view",disabled:true },
                                                 <%}%>
                                                 <%if(HillspetUtil.checkAccess(request,IAHMSAccessConstants.SEARCH_ANIMNAL_PERMISSION)) {%>
                                       { text: "Search Animals", url: "animalSearchAction.do?command=view" },
                                            <%}%>
                                       <%if(HillspetUtil.checkAccess(request,IAHMSAccessConstants.SEARCH_IMAGES)) {%>
                                       { text: "Search Images",url: "animalImageSearchAction.do?command=view" },
                                       <%}%>
                                       <%if(HillspetUtil.checkAccess(request,IAHMSAccessConstants.SEARCH_IMAGES)) {%>
                                       { text: "Capture Images",url: "captureImageAction.do?command=view" },
                                       <%}
                                       if(!rolesList.contains("95") && !rolesList.contains("98")){ %>
                                            { text: "Animal Panels", url: "animalpanelList.do?command=view&searchFlag=fromMenu" },
    <% }
                                            if (dto.getUserPermissionList().contains(
    AnimalConstants.AR_RECOMMEND_ANIMALS_PERMISSION)|| dto.getUserPermissionList().contains(
    AnimalConstants.AR_VIEW_LIST_OF_RECOMMENDATION_PERMISSION)) {
    %>
                   { text: "Animal Recommendation",
    submenu: {
    id: "subtab11",
    itemdata: [
    <%
    if (dto.getUserPermissionList().contains(AnimalConstants.AR_RECOMMEND_ANIMALS_PERMISSION)) {
    %>
    { text: "Recommend Animals", url: "recommendedAnimal.do?command=view" },
    //{ text: "Reserve / Un-reserve", url: "../ATMS/reserveUnreserve.html"},
    <%}%>
    <%
                                            if (dto.getUserPermissionList().contains(
    AnimalConstants.AR_RECOMMEND_ANIMALS_PERMISSION)|| dto.getUserPermissionList().contains(
    AnimalConstants.AR_VIEW_LIST_OF_RECOMMENDATION_PERMISSION)) {
    %>
    { text: "View Recommendations", url: "recommendedAnimalList.do?command=view"},
    <%}%>
                        <%} else {%>
                             { text: "Animal Recommendation", url: "#" , disabled: true},
                             <%}%>
                                       { text: "Move Animal",
                                       submenu: {
    id: "subtab15",
    itemdata: [
                                                                <% if( isInternal ){%>
    { text: "Change Location", url: "manageAnimalLocationAction.do?command=viewHistory" },
                                                                <%}%>
    <%if(HillspetUtil.checkAccess(request,IAHMSAccessConstants.ANML_DISPOSITION_PERMISSION)) {%>
                                                                { text: "Adoption Record", url: "animalDispositionAction.do?command=view" },
                                                                <%}%>
    id: "Tab2",
    itemdata: [
                                       <%if(HillspetUtil.checkAccess(request,IAHMSAccessConstants.SCHEDULE_FMT)) {%>
    { text: "Schedule Facility Maintenance Task ", url: "scheduleFMTActionForward.do?command=forward", disabled: false },
                                            <%}%>
                                       <%if(HillspetUtil.checkAccess(request,IAHMSAccessConstants.SCHEDULE_GROUP_TASK) || rolesList.contains("99")) {%>
                                       { text: "Schedule Task", url: "groupTaskSearchAction.do?command=view" },
                                       <% } %>
                                       { text: "Daily Task List",
                                       submenu: {
    id: "subtab21",
    itemdata: [
                                                                { text: "Animal Care Task", url: "viewDailyTaskListAction.do?command=view&id=1&actSubTab=1"},
                                       <%if(userPermissionsList.contains(IATMSConstants.SMCL_VIEW_SAMPLES)){%>
                                                      <%if(userPermissionsList.contains(IATMSConstants.SMCL_VIEW_SAMPLES)){%>
                                                      { text: "Test Collections", url: "viewSMSmpleCollections.do?command=view&identifier=fromMenu" },
                                                      <% } %>
                                                      <%if(userPermissionsList.contains(IATMSConstants.SMCL_VIEW_SAMPLES)){%>
                                                      { text: "Health Collections", url: "viewBioHealthSmplCollections.do?command=view&identifier=fromMenu" },
                                                      <%}%>
                                       <%}%>
                                                           <%if(HillspetUtil.checkAccess(request,IAHMSAccessConstants.DAILY_TASK_LIST_MEDICAL_TESTS)) {%>
    { text: "Medical Test", url: "viewDailyTaskListAction.do?command=view&id=2"},
    <%}%>
                                                           <%if(HillspetUtil.checkAccess(request,IAHMSAccessConstants.DAILY_TASK_LIST_MEDICAL_EXAMS)) {%>
                                                                { text: "Medical Exams", url: "viewDailyTaskListAction.do?command=view&id=3"},
                                                                     <%}%>
                                                                { text: "Status Phenotype", url: "viewDailyTaskListAction.do?command=view&id=6"},
                                                                { text: "Surgery/Procedure", url: "viewDailyTaskListAction.do?command=view&id=4"},
                                                                { text: "Facility Maintenance ",submenu: {
                             id: "subtab777",itemdata: [
                                                                          { text: "Facility Maintenance Task",url: "viewDailyTaskListAction.do?command=view&id=5" },
                                                                          { text: "Search FMT Images",url: "searchFMTImageAction.do?command=view" }]
                                                                { text: "Record Group ACTs", url: "RecordWeightFecalScoreAction.do?command=view"},
                                       { text: "Administer Medication", url: "recordMedicationAdministrationAction.do?command=forward" },
                                            <%if(HillspetUtil.checkAccess(request,IAHMSAccessConstants.RECORD_OBSERVATION_PERMISSION)) {%>
                                       { text: "Observations",
                                                 submenu: {
    id: "subtab222",
    itemdata: [
                                                                { text: "Search Observations",url: "recordObservationsAction.do?command=view" },
                                                                { text: "Record Observations",url: "addAnimalObservationAction.do?command=add&page=record&source=monitor" },
                                       <%}%>
                                       { text: "Shared Feed Diet Assignment", url: "RecordWeightFecalScoreAction.do?command=viewDefaultDiet" },
                                       <%if(HillspetUtil.checkAccess(request,IATMSAccessConstants.TRCL_PRINT_LABELS_LIST) || HillspetUtil.checkAccess(request,IATMSAccessConstants.HRCL_PRINT_LABELS_LIST)) {%>
                                       { text: "Print Labels",
                                       submenu: {
    id: "subtab211",
    itemdata: [
                                                                <%if(HillspetUtil.checkAccess(request,IATMSAccessConstants.TRCL_PRINT_LABELS_LIST)) {%>
                                                                { text: "Test Collections", url: "printLabelsAction.do?command=viewTests"},
                                                                <%}%>
                                                                <%if(HillspetUtil.checkAccess(request,IATMSAccessConstants.HRCL_PRINT_LABELS_LIST)) {%>
    { text: "Health Collections", url: "printLabelsAction.do?command=viewHealthCols"},
                                                                <%}%>
                                       <%}%>
                                       //{ text: "Controlled Drug Inventory", url: "#" , disabled: true},
                             <%}%>
    <%if(HillspetUtil.checkAccess(request,IATMSAccessConstants.SM_RECIEVE_SAMPLES )||
                                       HillspetUtil.checkAccess(request,IATMSAccessConstants.SM_RECIEVE_HEALTH_SAMPLES) || dto.getRoleList().contains("85") || dto.getRoleList().contains("111") || !dto.getRoleList().contains("123") && !dto.getRoleList().contains("82") ) {%>
    id: "Tab3",
    itemdata: [
    { text: "Sample Management",
    submenu: {
    id: "subtab41",
    itemdata: [
                                       <%if(HillspetUtil.checkAccess(request,IATMSAccessConstants.SM_RECIEVE_SAMPLES )||
                                       HillspetUtil.checkAccess(request,IATMSAccessConstants.SM_RECIEVE_HEALTH_SAMPLES) || dto.getRoleList().contains("85") || dto.getRoleList().contains("111") || !dto.getRoleList().contains("131") ) {%>
    { text: "Samples Pending Receipt",
                                            submenu: {
                                                 id: "subtabRecieve",
                                                      itemdata: [
                                                           <%if(HillspetUtil.checkAccess(request,IATMSAccessConstants.SM_RECIEVE_SAMPLES)) {%>
                                                      { text: "Biological Test Collections", url: "fetchLabLocationDetailsAction.do?command=forward" , disabled: false},
                                                      <%}%>
                                                           <%if(HillspetUtil.checkAccess(request,IATMSAccessConstants.SM_RECIEVE_HEALTH_SAMPLES) || dto.getRoleList().contains("85") || dto.getRoleList().contains("111")) {%>
                                                      { text: "Biological Health Collections", url: "recieveTestSamplesAction.do?command=forward" , disabled: false},
                                                      <%}%>
                                                      <%if(!dto.getRoleList().contains("706")) {%>
                                                      { text: "Non Biological Collections", url: "receiveNonBiologicalSamplesAction.do?command=viewNBSamples"}
                                                      <% } %>
                                            <%}%>
    <%
    if(HillspetUtil.checkAccess(request,IATMSAccessConstants.LAB_SM_VIEW_RECEIVED_NON_BIO_SMPLS)||HillspetUtil.checkAccess(request,IATMSAccessConstants.SM_RECIEVED_HEALTH_SAMPLES) || HillspetUtil.checkAccess(request,IATMSAccessConstants.SM_RECIEVED_TEST_SAMPLES) || dto.getRoleList().contains("85") || dto.getRoleList().contains("111")) {%>
    { text: "Samples Received",
                                            submenu: {
                                                 id: "subtabRecieved",
                                                      itemdata: [
    <%
    if(HillspetUtil.checkAccess(request,IATMSAccessConstants.SM_RECIEVED_TEST_SAMPLES) || dto.getRoleList().contains("85") || dto.getRoleList().contains("111")) {%>
                                                      { text: "Biological Test Collections", url: "recievedTestSamplesAction.do?command=forward" , disabled: false},
    <%}%>
    <%
    if(HillspetUtil.checkAccess(request,IATMSAccessConstants.SM_RECIEVED_HEALTH_SAMPLES) || dto.getRoleList().contains("85") || dto.getRoleList().contains("111") ) {%>
                                                      { text: "Biological Health Collections", url: "receivedBioTestSamplesAction.do?command=forward" , disabled: false},
    <%}%>
    <%
    if(HillspetUtil.checkAccess(request,IATMSAccessConstants.LAB_SM_VIEW_RECEIVED_NON_BIO_SMPLS) ) {%>
                                                      { text: "Non Biological Collections", url: "receivedNonBiologicalSamplesAction.do?command=viewNBSamples"}
    <%}%>
    <%}%>
                                  <%if(HillspetUtil.checkAccess(request,"VIEW_SAMPLE_BATCHES") || dto.getRoleList().contains("85") || dto.getRoleList().contains("111")||dto.getRoleList().contains("706")) {%>
    { text: "Sample Batches", url: "viewSampleBatches.do?command=view" , disabled: false},
                                       <%}%>
                                       <%     if (dto.getUserPermissionList().contains("OUTSIDE_LAB_SAMPLES_LIST") || dto.getRoleList().contains("131") || dto.getRoleList().contains("706")){ %>
                   { text: "External Lab Samples", url: "outsideLabSamplesAction.do?command=view" , disabled: false},
                                       <% } %>
                             <%
                                            if (dto.getUserPermissionList().contains(
    ICollectionKitConstants.GENERATE_CK_TEMPLATE) ) { %>
                             { text: "Sample Collection Kits",
    submenu: {
    id: "subtab421",
    itemdata: [
                                       <%
                                            if (dto.getUserPermissionList().contains(
    ICollectionKitConstants.GENERATE_CK_TEMPLATE)){ %>
    { text: "Generate Collection Kits", url: "ckCreateTemplateAction.do?command=goToGenerateCkKits" , disabled: false},
                                       <% } %>
                             <%
                                            if (dto.getUserPermissionList().contains(
    ICollectionKitConstants.GENERATE_CK_TEMPLATE) ){ %>
                             { text: "Search & View", url: "ckCreateTemplateAction.do?command=goToCKSearch&fromMenu=true" },
                             <%}%>
                             <%}%>
    <%if(HillspetUtil.checkAccess(request,IATMSAccessConstants.SMIN_VIEW_SAMPLE_INVENTORY) ||
                                            HillspetUtil.checkAccess(request,IATMSAccessConstants.VIEW_FORMULA_INVENTORY) || dto.getRoleList().contains("85") || dto.getRoleList().contains("111") || dto.getRoleList().contains("131")) {%>
    { text: "Sample Information",
                                            submenu: {
                                                 id: "subtabSampleInventory",
                                                      itemdata: [
                                                      <%if(HillspetUtil.checkAccess(request,IATMSAccessConstants.SMIN_VIEW_SAMPLE_INVENTORY) || dto.getRoleList().contains("85") || dto.getRoleList().contains("111")) {%>
                                                      { text: "Biological Samples", url: "sampleInventoryAction.do?command=view" , disabled: false},
                                                      <%}%>
                                                      <%if(HillspetUtil.checkAccess(request,IATMSAccessConstants.VIEW_FORMULA_INVENTORY)) {%>
                                                      { text: "Non Biological Samples", url: "viewInventory.do?command=view&fromLab=Y" , disabled: false},
                                                      <%}%>
    <% if ( HillspetUtil.checkAccess(request,"PENDING_ANALYSIS_REQUEST_LIST") ||
              HillspetUtil.checkAccess(request,"PENDING_ANALYSIS_REQUEST_READ") ) {
    %>
    { text: "Collected Samples New Request", url: "pendingAnalysisReqAction.do?command=view" , disabled: false },
    <%}%>
                                       <%}%>
    ]

    Hi,
    actually this mapping only identifies those requests to be handled by teh JSF servlet. Its not a redirect.
    I see several namespace definitions in your page, but no taglib reference. Wondering how this is supposed to work
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://xmlns.oracle.com/adf/faces/html" prefix="afh"%>
    <%@ taglib uri="http://xmlns.oracle.com/adf/faces" prefix="af"%>
    I assume the next crash you will see is when you add JSF components to
    <f:view>
    <html>
    <head>
    <meta http-equiv="Content-Type"
    content="text/html; charset=windows-1252"/>
    <title>tt</title>
    </head>
    <body><h:form></h:form></body>
    </html>
    </f:view>
    Note that mixing HTML elements with JSF is not a recommended approach
    Frank

  • Session Login and Logout in jsp page

    hi
    i am developing jsp page
    i completed except logout.jsp page
    my login page is in Jsp format and then business Logic in servlet and then get method & set method in bean.java
    i have login and then it sucess page there i have singout button
    if i sign out it should go to login page
    how to do
    how to make session invalidate
    how to get session id
    i have one more doubt i should check session invalidate each jsp page
    regarding session login and logout in jsp
    if anybody knows please give me a piece of code regarding login and logout
    Regards
    Akshatha

    This is part of your filter class now you need login.jsp page
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link rel="Stylesheet" type="text/css" href="/PAS/css/site.css"/>
        <title>Automation System | Login Page</title>
    </head>
    <body>
    <div align="center">
        <h1>Photint Automation System</h1>
    </div>
    <br/><br/><br/>
    <center>
        <table border="1" cellpadding="0" cellspacing="0" width="40%" bgcolor="FFFFFFFF">
            <thead>
                <tr>
                    <th align="left" height="30"> <h3>    Login</h3></th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>
                        <div align="center">
                            <form name="LOGIN" action="/PAS/LoginServlet" method="POST">
                                <table border="0">
                                    <tbody>
                                        <tr>
                                            <td height="15"></td>
                                            <td height="15"></td>
                                            <td height="15"></td>
                                            <td height="15"></td>
                                        </tr>
                                        <tr>
                                            <td height="30"></td>
                                            <td align="right" height="30">User Name : </td>
                                            <td align="left"  height="30"><input type="text" name="USERNAME" value="" size="35"  /></td>
                                            <td height="30"></td>
                                        </tr>
                                        <tr>
                                            <td height="30"></td>
                                            <td align="right" height="30">Password : </td>
                                            <td align="left"  height="30"><input type="password" name="PASSWORD" value="" size="35"  /></td>
                                            <td height="30"></td>
                                        </tr>
                                        <tr>
                                            <td height="50"></td>
                                            <td height="50"></td>
                                            <td align="center" height="50"><input type="submit" value="Login" name="Login" />  <input type="reset" value="Reset" name="Reset" /></td>
                                            <td height="50"></td>
                                        </tr>
                                    </tbody>
                                </table>
                            </form>
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>
    </center>
    <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
    <br/><br/><br/>
    <center>Copyright &copy; 2009 Photint FZ LLC</center>
    <center>Powered by Ali Jamali</center>
    <center>Version : 1.0</center>
    </body>
    </html>And you need loginServlet.java
    package com.ali.util.filter;
    import com.ali.entity.user.UserEntity;
    import com.ali.util.HibernateUtil;
    import java.io.IOException;
    import javax.servlet.RequestDispatcher;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    public class LoginServlet extends HttpServlet {
        private static final long serialVersionUID = 1L;
        protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            String username = request.getParameter("USERNAME");
            String password = request.getParameter("PASSWORD");
            if (username == null || username.length() == 0) {
                System.err.println(" Username textfeild is empty ..... !");
                RequestDispatcher dispatcher = request.getRequestDispatcher("Pages/user/LogIn.jsp");
                dispatcher.forward(request, response);
                return;
            if (UserRegistry.isUserLoggedIn(username)) {
                System.out.printf("User [%s] is already logged in. \n", username);
                RequestDispatcher dispatcher = request.getRequestDispatcher("Pages/user/LogIn.jsp");
                dispatcher.forward(request, response);
                return;
            UserEntity user = null;
            try {
                user = (UserEntity) HibernateUtil.load(UserEntity.class, username);
                if (user == null || !user.getPassword().equals(password)) {
                    RequestDispatcher dispatcher = request.getRequestDispatcher("Pages/user/LogIn.jsp");
                    dispatcher.forward(request, response);
                    System.err.println(" Password or username is not valid ..... !");
                    return;
            } catch (Exception e) {
                e.printStackTrace();
                RequestDispatcher dispatcher = request.getRequestDispatcher("Pages/user/LogIn.jsp");
                dispatcher.forward(request, response);
                return;
            HttpSession session = request.getSession();
            System.err.println(request.getRemoteAddr());
            session.setAttribute("username", user.getFirstName());
            session.setAttribute("userType", user.isAdmin());
            UserRegistry.logInUser(username);
            response.sendRedirect("/PAS/index.jsp");
    }finally is you need to just one user can be online at time or need to know how many user & who is online you should at this class also
    package com.ali.util.filter;
    import java.util.ArrayList;
    import java.util.List;
    public class UserRegistry {
        private static final List loggedInUsers = new ArrayList();
        public static void logInUser(String username) {
            loggedInUsers.add(username);
        public static void logoutUser(String username) {
            if (isUserLoggedIn(username)) {
                loggedInUsers.remove(username);
        public static boolean isUserLoggedIn(String username) {
            return loggedInUsers.contains(username);
    }If you have any more Q. or any comment , Most welcome
    Thanks
    Ali Jamali

  • The best way to implement user's access level via Servlet & JSP (or more)?

    Hi all,
    I am trying to implement user's access level in an application to allow certain access to certain page or components within a page (buttons, etc.). From my experience with JSP, Java, servlet, I am think of having the jsp/servlet to check for user's access level to decide what jsp components or forward page to go to next but that doesn't seem clean or elegant way to handle it.
    Any suggestions of how to do this? Are there other technologies (Struts) out there that can handle this?
    Thanks so much in advance for your feedback or suggestion,
    Thong Bui

    I haven't experienced a lot in defining security roles before, and there is probably a lot to learn about this area. However I might be able to assist you in some way. Whenever I have 2 or more objects that need to be stored in the session, I create a class called UserContainer. Say you have three properties:
    empSsn (String) , isAdmin (Boolean), isAgent (Boolean), then:
    public class UserContainer implements Serializable  {
    private String empSsn = null;
    private Boolean isAdmin = null;
    private Boolean isAgent = null;
    public UserContainer() {
    super();
    public void setIsAdmin(Boolean isAdmin) {
    this.isAdmin = isAdmin;
    public Boolean getIsAdmin() {
    return this.isAdmin;
    // getters and setters for the other properties
    Of course after you decide (in your sevlet) whether the app user is an administrator or an agent, you can set the corresponding property in the user container, and then save it in the session. Afterwords, in any jsp, you can decide to display a certain element (e.g a button) after you check the user's role. Example:
    // Welcome.jsp
    <% UserContainer userContainer = (UserContainer) session.getAttribute("userContainer");
    boolean isAdmin = userContainer.getIsAdmin().booleanValue();
    boolean isAgent = userContainer.getIsAgent.booleanValue();
    if(isAdmin) { %>
    <!-- HTML/Code corresponding to an administrator -->
    <% } if(isAgent) { %>
    <!-- HTML /Code corresponding to an agent -->
    <% } >Of course, this is a very simple way of doing such a task, you will find more secure ways if you look at LDAP or something of that matter.
    Cheers

  • Jsp-servlet-bean problem

    Please help!
    I have a servlet controller, a javabean for the data and a jsp for the view.
    I cannot get the jsp using
    <jsp:useBean id="pList" class="bbs.PostListCommand" scope="request" />
    to access the bean data
    However, when I access the bean in this way
    <%@ page import="bbs.PostListCommand" %>
    // html
    <% bbs.PostListCommand postList = null;
    synchronized(session){
         postList = (bbs.PostListCommand) session.getAttribute("PostListCommand");
         if (postList == null){ %>
              <H1>Nothing in request scope to retrieve ....</H1>
              <P>
    <%     }
         else{  %>
              <TABLE border="1">
    // etc
    � it works
    Does anyone know why the <jsp:useBean> tag does not find the bean
    I have installed tomcat 4.18 and set the environmental variables etc.
    Directory structure is
    E:\Tomcat41\webapps\examples\WEB-INF\jsp          for jsp�s
    E:\Tomcat41\webapps\examples\WEB-INF\classes\bbs     for bean and servlets
    Thanks in advance for any help.
    Chris

    GrayMan - Thanks for your help.
    Let me explain my problem in more detail ...
    Background:
    I have some servlet experience, but I am new to jsp - so sorry if this seems trivial to you ...
    I have a book called bitter java by bruce tate from manning.com . I am trying to get the chapter 3 examples to work
    There are three files
    PostListCommand          the bean
    PostListController     the servlet
    PostListResults          jsp
    And a new test file � PostListResults version 2 with scriptlet code to access the bean.
    There are a couple of typos in the downloaded source files, but nothing that causes the main problem of not being able to access the bean data.
    Program flow
    Servlet instantiates new bean
    Bean � gets data from db
    Servlet passes bean to jsp with a forward
    Jsp outputs data
    I have put the files in the directories �
    E:\Tomcat41\webapps\examples\WEB-INF\jsp          for jsp�s
    E:\Tomcat41\webapps\examples\WEB-INF\classes\bbs     for bean and servlets
    The complete source code for each file is given below.
    1 I have checked the db access � that�s ok
    2 I have also checked reading the bean data back in from the request scope and printing out the results from within the servlet.- ok
    3 I can access the data through a scriptlet (PostListResults version 2), but not with the original PostListResults which uses <jsp:useBean>
    thanks in advance, chris
    PostListController.java
    package bbs;
    // Imports
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    // Import for commands used by this class
    import bbs.PostListCommand;
    public class PostListController
    extends javax.servlet.http.HttpServlet
    implements Serializable {
    * DoGet
    * Pass get requests through to PerformTask
    public void doGet(
    HttpServletRequest request,
    HttpServletResponse response)
    throws javax.servlet.ServletException, java.io.IOException {
    performTask(request, response);
    public void performTask(
    HttpServletRequest request,
    HttpServletResponse response) {
    try {
    PostListCommand postList = (bbs.PostListCommand) java.beans.Beans.instantiate(getClass().getClassLoader(),"bbs.PostListCommand");
    postList.initialize();
    postList.execute();
    request.setAttribute("PostListCommand", postList);
    ServletContext sc = this.getServletContext();
    RequestDispatcher rd =
    sc.getRequestDispatcher("/jsp/PostListResults.jsp");
    rd.forward(request, response);
    } catch (Throwable theException) {
    theException.printStackTrace();
    PostListCommand.java
    package bbs;
    import java.io.*;
    import java.sql.*;
    //import COM.ibm.db2.jdbc.*;
    import java.util.*;
    * Insert the type's description here.
    * Creation date: (07/17/2001 5:07:55 PM)
    * @author: Administrator
    public class PostListCommand {
    // Field indexes for command properties     
    private static final int SUBJECT_COLUMN = 1;
    private static final int AUTHOR_COLUMN = 2;
    private static final int BOARD_COLUMN = 3;
    protected Vector author = new Vector();
    protected Vector subject = new Vector();
    protected Vector board = new Vector();
    // SQL result set
    protected ResultSet result;
    protected Connection connection = null;
    * execute
    * This is the work horse method for the command.
    * It will execute the query and get the result set.
    public void execute()
    throws
    java.lang.Exception,
    java.io.IOException {
    try {
    // retrieve data from the database
    Statement statement = connection.createStatement();
    result =
    statement.executeQuery("SELECT subject, author, board from posts");
    while (result.next()) {
    subject.addElement(result.getString(SUBJECT_COLUMN));
    author.addElement(result.getString(AUTHOR_COLUMN));
    board.addElement(result.getString(BOARD_COLUMN));
    result.close();
    statement.close();
    } catch (Throwable theException) {
    theException.printStackTrace();
    * getAuthor
    * This method will get the author property.
    * Since the SQL statement returns a result set,
    * we will index the result.
    public String getAuthor(int index)
    throws
    java.lang.IndexOutOfBoundsException,
    java.lang.ArrayIndexOutOfBoundsException {
    return (String) author.elementAt(index);
    * getBoard
    * This method will get the board property.
    * Since the SQL statement returns a result set,
    * we will index the result.
    public String getBoard(int index)
    throws
    java.lang.IndexOutOfBoundsException,
    java.lang.ArrayIndexOutOfBoundsException {
    return (String) board.elementAt(index);
    * getSubject
    * This method will get the subject property.
    * Since the SQL statement returns a result set,
    * we will index the result.
    public String getSubject(int index)
    throws
    java.lang.IndexOutOfBoundsException,
    java.lang.ArrayIndexOutOfBoundsException {
    return (String) subject.elementAt(index);
    * initialize
    * This method will connect to the database.
    public void initialize()
    throws java.io.IOException {
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    // URL is jdbc:db2:dbname
    String url = "jdbc:db2:board";
    // URL is jdbc:odbc:bitter3board
    String url = "jdbc:odbc:bitter3board";
    // connect with default id/password
    connection = DriverManager.getConnection(url);
    } catch (Throwable theException) {
    theException.printStackTrace();
    * Insert the method's description here.
    * Creation date: (07/17/2001 11:38:44 PM)
    * @return int
    * @exception java.lang.IndexOutOfBoundsException The exception description.
    public int getSize() {
    return author.size();
    PostListResults.jsp
    <HTML>
    <HEAD>
    <TITLE>Message Board Posts</TITLE>
    </HEAD>
    <BODY BGCOLOR=#C0C0C0>
    <H1>All Messages</H1>
    <P>
    <jsp:useBean id="postList" class="bbs.PostListCommand" scope="request"></jsp:useBean>
    <TABLE border="1">
    <TR>
    <TD>Subject</TD>
    <TD>Author</TD>
    <TD>Board</TD>
    </TR>
    <% for (int i=0; i < postList.getSize(); _i++) { %>
    <TR> <TD><%=postList.getSubject(_i) %></TD>
    <TD><%=postList.getAuthor(_i) %></TD>
    <TD><%=postList.getBoard(_i) %></TD>
    </TR>
    <% } %>
    </TABLE>
    <P>
    </BODY>
    </HTML>
    PostListResults.jsp version 2 � with scriplet code instead of useBean
    <HTML>
    <%@ page import="bbs.PostListCommand" %>
    <!-- This file was generated by the chris -->
    <HEAD>
    <TITLE>Message Board Posts</TITLE>
    </HEAD>
    <BODY BGCOLOR=#C0C0C0>
    <% bbs.PostListCommand postList = null;
    synchronized(request){
         postList = (bbs.PostListCommand) request.getAttribute("PostListCommand");
         if (postList == null){ %>
              <H1>Nothing in request scope to retrieve ....</H1>
              <P>
    <%     }
         else{  %>
              <TABLE border="1">
              <TR>
              <TD>Subject</TD>
              <TD>Author</TD>
              <TD>Board</TD>
              </TR>
         <% for (int i=0; i < postList.getSize(); _i++) { %>
                   <TR> <TD><%=postList.getSubject(_i) %></TD>
              <TD><%=postList.getAuthor(_i) %></TD>
              <TD><%=postList.getBoard(_i) %></TD>
              </TR>
         <% } %>
              </TABLE>
    <%     }
    }%>
    <P>
    goodnight
    </BODY>
    </HTML>

  • Jsp / Servlet / bean / upload

    Hello,
    I use a jsp to enter several fields. These fields are sent to a servlet by using a bean (recorded in the current session). Until now there is no problem. The servlet receives all information. Now I must also send 5 files which must be stored on the server. I have thus to add in my jsp 5 file fields.
    My question :
    Is it possible to integrate the FileUpload package for uploader my files without anything to change in my code (by using of a bean to exchange the data between my jsp and my servlet). ??
    In other words, it is possible to use my bean to also transport files. ??
    Tank u for u help

    Yes it is possible..
    download cos.jar from www.oreily.com for file upload..
    it will read dat from the form as two parts ..
    parameter part and file part..
    and you can implement it throgh a servlet easily..
    for more follow oreily JSP/servlets Cookbook

  • Java.lang.AbstractMethodError: javax.servlet.jsp.JspFactory.getJspApplicati

    Hi,
    I have an application which is executing properly in jboss 3.2.5 but as we are trying to upgrade the jboss version i am getting above mentioned error.
    The application is deployed in jboss as an ear file and the ear contains one jar file that has been removed from the ear and still i am getting this error.
    I am posting the full stack trace over here.
    ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
    java.lang.AbstractMethodError: javax.servlet.jsp.JspFactory.getJspApplicationContext(Ljavax/servlet/ServletContext;)Ljavax/servlet/jsp/JspApplicationContext;
            at org.apache.jsp.Jsp.Common.logout_jsp._jspInit(logout_jsp.java:22)
            at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:52)
            at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:158)
            at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
            at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
            at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at clime.messadmin.filter.MessAdminFilter.doFilter(MessAdminFilter.java:104)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
            at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
            at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
            at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
            at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
            at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
            at java.lang.Thread.run(Thread.java:595)It is happening in logout.jsp, but all other main jsp's are working properly ( login.jsp etc ).
    I am posting the jsp code over here.
    <html>
    <head>
           <script language="JavaScript">
         function init()  {
           window.history.forward(1);
       </script>
      </head>
    <body  onLoad="init();" >
      <%@ page language="java" %>
      <%@ page isThreadSafe="true" %>
        <%
         session.invalidate();
         response.sendRedirect("../../logout.html");
    %>
    </body>
    </html>Please guide me to solve the issue.

    evnafets wrote:
    My guess would be that you have some of the servlet classes deployed with your application.
    Yes.
    Any jar files that contain the javax.servlet.* packages should NOT be part of a web application, but are intended to be on the server.
    First up all there is no such jar files.
    Common candidates:
    servlet.jar
    servlet-api.jar
    j2ee.jar
    All those jars are in lib directory of my app server. I have jsp-api and servlet-api.jar as i am using embedded tomcat 6 in jboss appsever.
    Check the WEB-INF/lib directory of your web application to see that there are none of those there.
    Nothing similar deployed in your ear file?I have extracted my application ear , jar and war then when i checked i found one jar file inside the war but in that no servlet*.jarr files. It is my application oriented files only. I have deleted this ar files and then i executedi am getting same error. Is there any way to find out the exact issue ????.
    Regards
    Rasa

  • Servlet/JSP problems with WL 4.51

    Hi all
              I have a set of Servlets and JSPs running on NewAtlanta's ServletExec
              servlet engine. I am currently porting them to WebLogic. I am facing a
              few problems. I do not want to change any of my HTML/JSP/Java files
              immediately. I want the same files to work in WL as it is. Pl help.
              1. The servlets in ServletExec used to be invoked as
              http://host/servlet/servletName. But in weblogic they are invoked
              as http://host/servletName. I tried registering the servlet names
              in weblogic.properties as
              weblogic.httpd.register.servlet/XServlet=com.foo.XServlet
              weblogic.httpd.initArgs.servlet/XServlet=param=value
              Now I can call this servlet as http://host/servlet/XServlet and so
              I dont have to change any html/JSP files. Will this cause any
              problems in the future?
              2. Since we used to run ServletExec on IIS, we created a virtual
              directory called /jsp in IIS under which we had all the html and
              JSP files. Our servlets will get the http requests, get data from
              database, put the results in session/request variables and dispatch
              it to appropriate JSP page. So, all our servlet code looks like
              this:
              RequestDispatcher dispatcher =
              getServletContext().getRequestDispatcher("/jsp/test.jsp");
              dispatcher.forward(request, response);
              How do I make this code work with WebLogic? Is there any way to
              create virtual directory and make it work like in IIS?
              Thanks for any help.
              shiv
              [email protected]
              

    You might try
              weblogic.httpd.register.jsp/*.jsp=weblogic.servlet.JSPServlet
              but a better/ easier way would be to just move all of your jsp files to a 'jsp'
              subdirectory beneath public_html
              -rrc
              Shiv Kumar wrote:
              > Hi all
              >
              > I have a set of Servlets and JSPs running on NewAtlanta's ServletExec
              > servlet engine. I am currently porting them to WebLogic. I am facing a
              > few problems. I do not want to change any of my HTML/JSP/Java files
              > immediately. I want the same files to work in WL as it is. Pl help.
              >
              > 1. The servlets in ServletExec used to be invoked as
              > http://host/servlet/servletName. But in weblogic they are invoked
              > as http://host/servletName. I tried registering the servlet names
              > in weblogic.properties as
              >
              > weblogic.httpd.register.servlet/XServlet=com.foo.XServlet
              > weblogic.httpd.initArgs.servlet/XServlet=param=value
              >
              > Now I can call this servlet as http://host/servlet/XServlet and so
              > I dont have to change any html/JSP files. Will this cause any
              > problems in the future?
              >
              > 2. Since we used to run ServletExec on IIS, we created a virtual
              > directory called /jsp in IIS under which we had all the html and
              > JSP files. Our servlets will get the http requests, get data from
              > database, put the results in session/request variables and dispatch
              > it to appropriate JSP page. So, all our servlet code looks like
              > this:
              >
              > RequestDispatcher dispatcher =
              > getServletContext().getRequestDispatcher("/jsp/test.jsp");
              > dispatcher.forward(request, response);
              >
              > How do I make this code work with WebLogic? Is there any way to
              > create virtual directory and make it work like in IIS?
              >
              > Thanks for any help.
              > --
              > shiv
              > [email protected]
              Russell Castagnaro
              Chief Mentor
              SyncTank Solutions
              http://www.synctank.com
              Earth is the cradle of mankind; one does not remain in the cradle forever
              -Tsiolkovsky
              

  • JSP / Servlet / OAS 4.0.8.2

    I try to create a session thru JSP, and try to get that session thru servlet. However,
    the servlet can't get the session. How can I make the JSP and servlet communicate thru session under Oracle Application Server 4.0.8.2. ( Note : the JSP and sevlet is under the same application but in different cartridges )
    My JSP code :
    <%@ page session= "true" %>
    <%session.putValue( "name", "brian" ) ; %>
    My Servlet code :
    HttpSession lSession = request.getSession( false ) ;
    null

    Hi Brian,
    Direct from the release notes for OJSP 1.0.0.6.1:
    (new features)
    - New configuration parameter: session_sharing; default value = true;
    Function: This flag relates to session data sharing between JSPs & servlets.
    Previously, when a JSP put a value into the session object, servlets in
    the same JVM could not see the value (directly). It is because the session
    in Oracle JSP is a session wrapper object, and not the original session object
    provided by the servlet container. The values stored in the Oracle
    JSP session were not exposed to the underlying servlet session directly.
    This flag allows easier use of the original session object. The session
    object in Oracle JSP is now the actual servlet session object, if there is
    no globals.jsa file present for the application. For those who are using
    globals.jsa (a beta feature), the JSP session wrapper now by default will
    share the session data with the underlying servlet session object.
    This behavior could be changed by setting initArgs: session_sharing=false.

  • Servlet Jsp Login Problen

    Consider 4 pages
    default.jsp          -          Default page     -     Provides link to update.jsp
    Update.jsp          -          Update Page          -     User came through default page
    login.jsp          -          Displays html      -     Two Input tags user & pass
    check Servlet     -          Authentication     -     Validates userid & pwd from database
    what I want to do ?
    1     User clicks on update link on default page
    2     update checks for session as
              String user = (String) session.getAttribute("user");
              if( user == null )                    
                   response.sendRedirect("/login.jsp");
    3     Now login.jsp displays the HTML form with action = /servlet/check          
    4     check servlet revceives values user & pass from HTML response & validates through
         database
    5     Now if validation succedes it must redirect to the actual page that user had
         requested for ultimately i.e update.jsp
    6 HOW MANY WAYS I CAN DO THIS
    7      Problem becomes more serious when along with login & check other intermediate
         servlets are also there.
    8     The final problem is
         1     Update.jsp receives request data from some HTML form but checks for user
              from session object.
         2     If found null redirect to login page
         3     The above prob. now repeats but the point is after authentication
              the check servlet not only redirects to the actual requested page but
              also supplies the data that update.jsp has received
    Please reply soon

    Thanx Sir!
    But i want to have a more generic solution
    like using <jsp:fordward> & <jsp:param> etc
    but i want it so generic that it can be done in ASP/ JSP
    preferably without using queryString
    And the main point is this problen
    request.setAttribute() is not working
    I am uploading the code
    CODE:
    default.jsp     Update
    update.jsp     String user = (String) session.getAttribute("user");
              if( user == null )     {
                   String look_for = request.getRequestURI();
                   request.setAttribute("look_for",look_for);
                   response.sendRedirect("/login.jsp");
    login.jsp     String req = null;
              req = (String)request.getAttribute("req");
              //out.print(req); --> Error Printing null
              request.setAttribute("req", req);
              <form----
              >
              response.sendRidirect("/servlet/check");
    check     
         String user = null;
    String look_for = (String)request.getAttribute("req");
    if(look_for == null)     {
              request.setAttribute("req", look_for);
         response.sendRedirect(request.getHeader("HTTP_REFERER"));
    if(user != "Hemant") {
    request.setAttribute("req",look_for);
    response.sendRedirect("/login.jsp");
    HttpSession session = request.getSession();
    session.setAttribute("user","Hemant");
    response.sendRedirect(look_for);
    out.close();     

Maybe you are looking for

  • ITunes wont update with new information

    So a brief story to see if anyone knows how to help me out. I have had itunes match for a while now and had no problems apart from the typical issues when uploading. About 2 weeks ago i made a backup of my C: Drive which contain's my itunes library (

  • How to use EXPORT AND IMPORT in OO

    Hi all i am trying to send a table to a memory but i am making in a OO to , Does anybody knows how to do it?, i have already check de documentation but it doesn't show any help. please syncerlly i need a help   EXPORT it_trans_print TO MEMORY ID 'AB'

  • How do i install the Motion2 content?

    Sorry for the lame post, but I have RTFM and tried installing Final Cut Studio all afternoon and it just wont install the Motion content or Live Type content. The apps themselves seem to be fine and i have even registered and got the new free filters

  • Event shows wrong content in preview

    When I run the cursor over the events in iPhoto the preview shows completely different photo's than the actual content (the photo's which are in the event folder when you open it). How can I solve this problem?

  • Export Question Pool

    Is there a (simple) way to export quiz questions for review...as a Word doc or spreadsheet maybe?