Accessing PublicObject_Array in a JSP/Servlet

Guys I really need help on this one. I'm sure it's something simple but maybe I'm looking to hard. I Created a ClassObject with Folder as the the SuperClass. I added several extended attributes, one being an PublicObject_Array which is ClassDomain controlled to point to only a ClassObject with the Supertype being an ApplicationObject which is named TRBINFO.
Summary:
So we have a ClassObject named PROJECT which is a subtype of Folder and has a PublicObject_Array as a data type, and this is an array that references only TRBINFOs which is a subtype of ApplicationObject. I'm unable to figure out how to access the TRBINFO arrays once I create a PROJECT. Following is code for the lucky person who tries to tackle this one:
ApplicationObjectDefinition newApplicationDef = new ApplicationObjectDefinition
(m_session);
Collection classColl1 = m_session.getClassObjectCollection ();
ClassObject trbInfo = (ClassObject) classColl1.getItems ("TRBINFO");
newApplicationDef.setClassObject (trbInfo);
newApplicationDef.setAttribute ("CREATEDATE", AttributeValue.newAttributeValue
(date));
newApplicationDef.setAttribute ("DESCRIPTION", AttributeValue.newAttributeValue
("This a test of the description"));
ApplicationObject newApplicationObj = (ApplicationObject) m_session.createPublicObject
(newApplicationDef);
ApplicationObject[] newArrayPublicObject =
{newApplicationObj, newApplicationObj,newApplicationObj,
newApplicationObj,newApplicationObj,newApplicationObj}
FolderDefinition newFolder = new FolderDefinition (m_session);
newFolder.setName("TESTING7");
Collection classColl = m_session.getClassObjectCollection();
ClassObject projectClass = (ClassObject) classColl.getItems ("PROJECT");
newFolder.setClassObject (projectClass);
//Collection acls = m_session.getSharedAccessControlListCollection();
newFolder.setAttribute ("Name", AttributeValue.newAttributeValue
("3"));
newFolder.setAttribute ("PROJECT_DIRECTORATE", AttributeValue.newAttributeValue
("Test Directorate"));
newFolder.setAttribute ("PROJECT_NUMBER", AttributeValue.newAttributeValue
("3"));
newFolder.setAttribute ("PROJECT_VENDOR", AttributeValue.newAttributeValue
("Project Vendor"));
newFolder.setAttribute ("PROJECT_DEVELOPER", AttributeValue.newAttributeValue
("Project Developer"));
newFolder.setAttribute ("PROJECT_TRBINFO", AttributeValue.newAttributeValue
(newArrayPublicObject));
newFolder.setAttribute ("PROJECT_TRBINFO", AttributeValue.newAttributeValue
(newArrayPublicObject));
Folder newOne = (Folder) m_session.createPublicObject (newFolder);
AttributeValue getTRBInfo = newOne.getAttribute("PROJECT_TRBINFO");
I want to know how to access the values of this AttributeValue which is an Array of TRBINFO object. Please Help!!!

The javadoc for the AttributeValue class has getXXX() methods to get the values for any datatype.
PublicObject[] values = (PublicObject[])getTRBInfo.getPublicObjectArray(m_session);
// if yu need the TRBInfo objects
int length = (values == null) ? 0 : values.length;
TRBInfo[] Trbs = new TRBInfo[length];
System.arraycopy(values, 0, Trbs, 0, length);
thanks,
Sirisha

Similar Messages

  • Can't get EntityManager access in JSP/Servlet

    Hi all,
    our team has started a EJB project (EJBs + JPA configurations)
    we managed to access the configured JPA (EntityManager etc) within the EJB instance; however we don't know how to access the EntityManager within JSP/Servlet
    Our project's structure:
    1 EJB project (EJB classes, EntityBean classes, JPA configuration + eclipselink)
    1 Web project (for JSP, Servlets)
    the main problem is ... we can't access EntityManager(s) in JSP / Servlets (and we already tried using Struts2.0 to replace servlets/jsp... the problem is the same... so it is not ... the matter of choosing the view technology...)
    Jason

    Hi Jason,
    How i tried to get EntityManager is as following:
    Suppose I want to define my Persistence unit like Following:
    *<Your-EAR>/APP-INF/classes/MyEmployee.java*
    "*MyEmployee.java*"
    package entityA;
    import java.io.Serializable;
    import org.apache.commons.lang.builder.EqualsBuilder;
    import org.apache.commons.lang.builder.HashCodeBuilder;
    import org.apache.commons.lang.builder.ToStringBuilder;
    import javax.persistence.*;
    @Entity()
    @Table(name="MYEMPLOYEE")
    public class MyEmployee implements Serializable {
         //default serial version id, required for serializable classes.
         private static final long serialVersionUID = 1L;
         private Long empno;
         private String empname;
    public MyEmployee() {
         @Id()
         @Column(name="EMPNO", unique=true, nullable=false, precision=22)
         public Long getEmpno() {
              return this.empno;
         public void setEmpno(Long empno) {
              this.empno = empno;
         @Basic()
         @Column(name="EMPNAME", length=15)
         public String getEmpname() {
              return this.empname;
         public void setEmpname(String empname) {
              this.empname = empname;
         public boolean equals(Object other) {
              if (this == other) {
                   return true;
              if (!(other instanceof MyEmployee)) {
                   return false;
              MyEmployee castOther = (MyEmployee)other;
              return new EqualsBuilder()
                   .append(this.getEmpno(), castOther.getEmpno())
                   .isEquals();
         public int hashCode() {
              return new HashCodeBuilder()
                   .append(getEmpno())
                   .toHashCode();
         public String toString() {
              return new ToStringBuilder(this)
                   .append("empno", getEmpno())
                   .toString();
    And I have Placed My "*persistence.xml*" file in *"<Your-EAR>/APP-INF/classes/META-INF/persistence.xml"*
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence xmlns="http://java.sun.com/xml/ns/persistence"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
         version="1.0">     
         <persistence-unit name="JPA_A_EJB" transaction-type="RESOURCE_LOCAL">
              <provider>org.hibernate.ejb.HibernatePersistence</provider>
              <class>entityA.MyEmployee</class>
              <properties>
                   <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect"/>
                   <property name="hibernate.connection.driver_class" value="oracle.jdbc.OracleDriver"/>
                   <property name="hibernate.connection.url" value="jdbc:oracle:thin:@localhost:1521:xe"/>
                   <property name="hibernate.connection.username" value="jack"/>
                   <property name="hibernate.connection.password" value="password"/>
              </properties>
         </persistence-unit>     
    </persistence>
    ***********************************HOW I Access The Above Unit from my EJB mentioned Below*******************************
    "*EmployeeSessionBean.java*"
    package sfsbA;
    import entityA.*;
    import javax.ejb.*;
    import javax.persistence.*;
    @Stateless
    public class EmployeeSessionBean implements EmployeeSessionRemoteIntf
    *@PersistenceContext*
    protected EntityManager entityManager;
    *///NOTE: Using the Above Technique You can access the "EntityManager" Object in your Servlets As well...Just write the Above two Lines inside your Servlet*
    public void createEmployee(Long empno,String empname) throws Exception{
              System.out.println("\n\tcreateEmployee() called. EntityManager entityManager = "+entityManager);
              MyEmployee employee = new MyEmployee();
    employee.setEmpno(empno);
    employee.setEmpname(empname);
    entityManager.persist(employee);
              System.out.println("\n\t Entity Manager has persisted the Employee Information...");
    int count = 0;
    public EmployeeSessionBean() {
    System.out.println("\n\t EmployeeSessionBean--> EmployeeSessionBean() invoked");
    @Init("create")
    public void initMethod() throws CreateException {
    System.out.println("\n\t EmployeeSessionBean--> public void initMethod() invoked");
    @Remove(retainIfException=true)
    public void removeWithRetain() throws Exception{
    System.out.println("\n\t EmployeeSessionBean--> removeWithRetain() invoked");
    @Remove
    public void removeWithoutRetain() throws Exception{
    System.out.println("\n\t EmployeeSessionBean--> removeWithoutRetain() invoked");
    public String printRemoteIntf () {
    System.out.println("\n\t EmployeeSessionBean ---> public String printRemoteIntf () invoked");
         return "ReplicableSFSRemoteObjectIntf";
    public String printLocalIntf () {
    System.out.println("\n\t EmployeeSessionBean ---> public String printLocalIntf () invoked");
         return "ReplicableSFSLocalObjectIntf";
    public String printBean () {
    System.out.println("\n\t EmployeeSessionBean ---> public String printBean () invoked");
         return "EmployeeSessionBean";
    public int testIncrement() throws Exception
    System.out.println("\n\t EmployeeSessionBean ---> public int testIncrement() invoked");
    count=count+5;
    return count;
    public int testDecrement() throws Exception
    System.out.println("\n\t EmployeeSessionBean ---> public int testDecrement() invoked");
    count=count-2;
    return count;
    public int getCount() throws Exception
    System.out.println("\n\t EmployeeSessionBean ---> public int getCount() invoked");
    return count;
    "*EmployeeSessionRemoteIntf.java*"
    package sfsbA;
    public interface EmployeeSessionRemoteIntf {
    public void createEmployee(Long emono,String empname)     throws Exception;
    public void removeWithRetain()throws Exception;
    public void removeWithoutRetain() throws Exception;
    public String printBean ();
    public int testIncrement() throws Exception;
    public int testDecrement() throws Exception;
    public int getCount() throws Exception;
    *"ejb-jar.xml"*
    <?xml version="1.0" encoding="UTF-8"?>
    <ejb-jar version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
    <enterprise-beans>
    <session>
    <ejb-name>EmployeeSessionBean</ejb-name>
    <business-remote>sfsbA.EmployeeSessionRemoteIntf</business-remote>
    <ejb-class>sfsbA.EmployeeSessionBean</ejb-class>
    <session-type>Stateless</session-type>
    </session>
    </enterprise-beans>
    </ejb-jar>
    *"weblogic-ejb-jar.xml"* (I am writing these file Just because i want my Own JNDI Simple name...Not the Container Generated Complex JNDI name)
    <weblogic-ejb-jar xmlns="http://www.bea.com/ns/weblogic/90" xmlns:j2ee="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-ejb-jar.xsd">
    <weblogic-enterprise-bean>
    <ejb-name>EmployeeSessionBean</ejb-name>
    <stateless-session-descriptor>
         <business-interface-jndi-name-map>
    <business-remote>sfsbA.EmployeeSessionRemoteIntf</business-remote>
    <jndi-name>EmployeeSessionBean</jndi-name>
         </business-interface-jndi-name-map>
    </stateless-session-descriptor>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
    "*application.xml*"
    <!DOCTYPE application PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN' 'http://java.sun.com/dtd/application_1_3.dtd'>
    <application>
    <display-name>JPAs_Demo_Jason</display-name>
    <module>
    <ejb>AccessEntityManager.jar</ejb>
    </module>
    </application>
    NOTE: The Jar "" Contains
    1). EmployeeSessionBean
    2). EmployeeSessionRemoteIntf
    3). META-INF/ejb-jar.xml
    4). META-INF/weblogic-ejb-jar.xml
    Thanks
    Jay SenSharma
    http://jaysensharma.wordpress.com  (Real WebLogic Stuff...Not less Than a Magic...Here)
    Edited by: Jay SenSharma on Dec 16, 2009 10:59 PM
    Edited by: Jay SenSharma on Dec 16, 2009 11:00 PM

  • How to use session variable in JSP function  & How to use both JSP  Servlet

    Hi,
    I am new to JSP and servlets
    Still I am devloping a website in JSP. I am not mixing JSP with servlets, but I do create Java files for bean, logic and database works.
    I try to keep the hard coding part out of JSP.
    I dont how to use both JSP and Servlets in combination.
    Hence If needed I write some functions in JSP.
    but it gives me error
    +<%! public void abc()+
    +{+
    int intUserId = Integer.valueOf((Integer) session.getAttribute("MySession_UserID"));
    +}+
    +%>+
    Saying cannot find symbol session
    1) So can u please tell how can I access session variables within JSP function
    2) And also give me some links/tutorials about useing both JSP and Servlets in combination.
    Thanks
    Venkat

    The application architecture when you use Servlets and JSP in a standard MVC pattern is explained here (under the heading "Integrating Servlets and JSP Pages") and here ...

  • File upload and download using jsp/servlets

    How to upload any file to the server using jsp/servlets. . Help me out

    You can also try the Jenkov HTTP Multipart File Upload. It's a servlet filter that is easy to add to your web-project. After adding it, you can access both request parameters and the uploaded files easily. It's more transparent than Apache Commons File Upload. There is sufficient documentation to get you started, and there is a forum if you have any questions.
    Jenkov HTTP Multipart File Upload is available under the Apache license, meaning its free to use.

  • Problem with accessing init parameters from JSP file

    Hi,
    I have my init parameters and Jsp configured in web.xml
    <servlet>
              <servlet-name>TestJsp</servlet-name>
              <jsp-file>/Test.jsp</jsp-file>
              <init-param>
                   <param-name>username</param-name>
                   <param-value>Balboa</param-value>
              </init-param>
    </servlet> How do I access 'username' field from JSP file.
    Kindly help.
    Thanks.

    you can do this in the jsp
    <%=config.getInitParameter("username")%>or do it in the jspInit method in the jsp:
    <%!  String userName = null; 
      public void jspInit() {   
        ServletConfig config = getServletConfig();   
        userName   = config.getInitParameter("userName ");  
    %>
    Hello <%=userName%>

  • Accessing MySql database in jsp

    hi everyone!!!
    i m new to java with little knowledge of jsp.
    i want to access mysql database in jsp to develop a web page.
    i have jdk and mysql installed and these are working. what are other requirements and how to do this.
    plz help.
    OS: MS Windows XP/ Fedora 10

    Learn JDBC API: [http://java.sun.com/docs/books/tutorial/jdbc/index.html]. Create a DAO class which uses JDBC to interact with Java and takes or returns the desired data in form of DTO's. Use and test it as a plain vanilla Java application with a main() method. This require a JDBC driver (a concrete implementation of the JDBC API) in the classpath. MySQL offers JDBC drivers as download at their homepage, it is called "Connector/J".
    Once you got the JDBC part to work, create a Servlet class which holds an instance of the DAO class and uses its methods to interact with the database. In the doGet() you can place logic to preload data from the DAO class for display. In the doPost() you can place logic to process data for create, update or delete using the DAO class. Finally let it forward the request to a JSP.
    In the JSP you can use JSTL/EL to display data. For tabular view you may find the JSTL c:forEach useful. For plain display, just use EL the usual way.

  • Using a single connection for jsp, servlets and classes

    Hi! I'm building a web site that uses JSP, Servlets and some classes. I use database access in all my pages. I want to open a connection and use it for all the pages while the user is in my site, so I don't need to open a connection with every new jsp or servlet page. My software must be capable of connection with various databases, like SQLServer, Oracle, Informix, etc... so the solution must not be database (or OS or web server) dependant.
    Can you help me with this? Some ideas, links, tips? I'll REALLY appreciate your help.
    Regards,
    Raul Medina

    use an initialiation servlet with pooled connection which can be accessed as sesssion object.
    Abrar

  • Accessing another par file jsp pages

    Hi
    i need to access another par file JSP pages from my par file, what all i need.
    any help is appreciated.
    Thanks,
    Damodhar.

    Gandhi,
    Well..there is a very good article on how to use resources(watever resources u mentioned) of one par inside any other par file on SDN:
    Here is the document:<a href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/b3c1af90-0201-0010-c0ac-c8d802d264f0">JSPs, Resources...</a>
    Xml files i worked were not property files of an iview.
    They were application specific xml files.I read these xml files on a different par(or iview).For that matter, they don need not be of type xml,could be any type of resource.
    Regards,
    P.

  • Why do I need JSP, Servlets, JSF?

    I want to design web pages in HTML and Javascript and use EJBs to handle business logic. That's it. I don't want to learn another API (ie JSP, Servlets, ...) for designing web pages. Is there a way I can access EJBs from Javascript using XML-based messaging or some other means? JSP seems like a waste.

    Hi,
    JSP is just like HTML mix with JAVA codes. You can mix it with servlets, as you can use servlets to access methods within your EJB. You can call a servlet from within your JSP. Use your JSP as presentation and use the servlets to get data from the EJB and pass it on to your presentation to display it to user. I am not sure of any other way. If you are trying to use Java application server as your server. Then, you have to follow the rules. Otherwise, use another technology such as HTML with ASP or even .NET. So you may have to install IIS as the server. OK
    eve

  • Error due to accessing database connection using jsp

    Hi,
    I have an error, during accessing a datbase using jsp:useBean from jsp.Urgent i need this one
    my source code is
    DbBean.java
    package SQLBean;
    import java.sql.*;
    import java.io.*;
    public class DbBean implements java.io.Serializable{
    private String dbDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
    private Connection dbCon;
    public DbBean(){
    super();
    public boolean connect() throws ClassNotFoundException,SQLException{
    Class.forName(dbDriver);
    dbCon = DriverManager.getConnection("jdbc dbc:mybean","","");
    return true;
    public void close() throws SQLException{
    dbCon.close();
    public ResultSet execSQL(String sql) throws SQLException{
    Statement s = dbCon.createStatement();
    ResultSet r = s.executeQuery(sql);
    return (r == null) ? null : r;
    public int updateSQL(String sql) throws SQLException{
    Statement s = dbCon.createStatement();
    int r = s.executeUpdate(sql);
    return (r == 0) ? 0 : r;
    database.jsp
    <HTML>
    <HEAD><TITLE>DataBase Search</TITLE></HEAD>
    <BODY>
    <%@ page language="Java" import="java.sql.*" %>
    <jsp:useBean id="db" scope="application" class="SQLBean.DbBean" />
    <jsp:setProperty name="db" property="*" />
    <center>
    <h2> Results from </h2>
    <hr>
    <br><br>
    <table>
    <%
    db.connect();
    ResultSet rs = db.execSQL("select * from employ");
    int i = db.updateSQL("UPDATE employ set fname = 'hello world' where empno='000010'");
    out.println(i);
    %>
    <%
    while(rs.next()) {
    %>
    <%= rs.getString("empno") %>
    <BR>
    <%
    %>
    <BR>
    <%
    db.close();
    %>
    Done
    </table>
    </body>
    </HTML>
    The error like this
    org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
    error: Invalid class file format in C:\Program Files\Apache Tomcat 4.0\webapps\muthu\WEB-INF\classes\SQLBean\DbBean.class. The major.minor version '49.0' is too recent for this tool to understand.
    An error occurred at line: 7 in the jsp file: /database.jsp
    Generated servlet error:
    C:\Program Files\Apache Tomcat 4.0\work\localhost\muthu\database$jsp.java:65: Class SQLBean.DbBean not found.
    SQLBean.DbBean db = null;
    ^
    An error occurred at line: 7 in the jsp file: /database.jsp
    Generated servlet error:
    C:\Program Files\Apache Tomcat 4.0\work\localhost\muthu\database$jsp.java:68: Class SQLBean.DbBean not found.
    db= (SQLBean.DbBean)
    ^
    An error occurred at line: 7 in the jsp file: /database.jsp
    Generated servlet error:
    C:\Program Files\Apache Tomcat 4.0\work\localhost\muthu\database$jsp.java:73: Class SQLBean.DbBean not found.
    db = (SQLBean.DbBean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "SQLBean.DbBean");
    ^
    4 errors, 1 warning
    Anybody help me?
    Thanx in advance

    Your code is ok . The problem is in java version witch you use to compile the DbBean class . I think you are using java 1.5 try to change to 1.4 compile and run again should help .

  • JSP - Servlet - Please help

    Hi:
    Can any one suggest me the code for the following scenerio, Am new to jsp-Servlet....
    I need to give an EMPNAME in a Textbox on clicking GO button from my JSP page, a servlet must process thei query and display the output of that employee details back to that JSP page..
    Please help me out with some code snippets...
    Regards,

    The sun's site provides a detailed introduction to JDBC. or
    have to google for JDBC and once you've understood the JDBC concept, then you could progress from there. There is no simple way of doing what you asked.
    You will need a database, though you could use MS Access. But you still need the JDBC.

  • Clean URLs with JSP/Servlet

    Hello. I've found some information on how to setup clean URLs for php, but none for JSP/servlet. Hopefully some one can help. Here's what I mean by 'clean URL':
    http://mydomain/employee.jsp?employeeID=1232
    becomes
    http://mydomain/employee/1232
    And, in that second example, the container would dispatch all requests for /employee* to some JSP/servlet. I don't care if the 'clean URL' has to have an extension or not (e.g. mydomain/employee.jsp/1232) although I would prefer to also remove the JSP extension.
    Additionally (if some one has experience with this need): how do I then access the final part of the URL supplied by the client? In other words, how would 1232 be available to the destination JSP/servlet? Does the container convert it into a parameter, i.e.:
    1) client sends request for "mydomain/employee/1232"
    2) container delegates request to "mydomain/employee.jsp?1232"
    Finally (sorry about the length), I don't have access to top-level config files for this site (it's personal use, although I'm pretty familiar with java APIs from my job), so, ideally, I'd like a .htaccess level solution, where the container can just re-route to a JSP.
    If any one has some suggestions, I'd GREATLY appreciate it. Thanks for your time. Take care.

    ...Just occurred to me- this hosting company is NOT using Tomcat. They use resin.
    Thanks.

  • Java, JSP, Servlet....!!!!????Can you help me?

    Hi all,
    Now I want to use Java (JSP, Bean, Servlet and EJB) for programming (application/web/internet/database). Which architects I should use?
    JSP --> Database.
    JSP --> Beans --> Database.
    Servlet --> Database.
    JSP & Servlet --> Database
    JSP & EJB --> Database...
    Can I use COM/DCOM such as ASP pages?
    And which databases (SQL Server, Oracle, Access, DB...) I should use? Which web servers (Jrun, JWS, Apache, JWS, Orion...)?
    Are there some stuff on Internet relate to this topic (some samples)?
    Thanks so much.

    Hi all,
    Now I want to use Java (JSP, Bean, Servlet and EJB)
    for programming (application/web/internet/database).
    Which architects I should use?you can use the Model-View-Controller or MVC model.
    Model = JavaBeans --> for your business logic/process
    View = JSP --> for your presentation like HTML
    Controller = Servlet --> as your router or dispatcher of the JSPs.
    And which databases (SQL Server, Oracle, Access,
    DB...) I should use? for large business applications that would require security, optimization, etc., i suggest that you go for a good dbase and i'm referring to Oracle, SQL Server, Sybase, Informix, and the likes. But, if you're going to do simple application, MS Access can do the job. Since it comes with MS Office installation, you'll not find it any harder to configure your dbase.
    Which web servers (Jrun, JWS, Apache, JWS, Orion...)?you can use the following apache, IIS, Websphere, etc...
    don't forget that you also need an application server. say, tomcat application server and apache web server.

  • New To Iplanet app server.Can some one help me getting started by delpoying and calling one of each of these:JSP,Servlet,EJB.Tried with iplanet docs..didnt quite get it. thanx

     

    Hi,
    What is that you are trying to accomplish ? Is it deployment or
    trying to develop applications ? Are you getting any errors ? If so,
    please post them to help you. I think the documentation is the best place
    for you to begin with.
    Regards & Happy New Year
    Raj
    Arif Khan wrote:
    New To Iplanet app server.Can some one help me getting started by
    delpoying and calling one of each of these:JSP,Servlet,EJB.Tried with
    iplanet docs..didnt quite get it. thanx
    Try our New Web Based Forum at http://softwareforum.sun.com
    Includes Access to our Product Knowledge Base!

  • JSP/SERVLETS NOT UNDERSTANDING JAAS SECURITY CONTEXT

    Hi ,
    Instead of using the default form action "j_security_check" for form based authentication
    .I have a custom JAAS loginmodule which is a servlet that gets calls when the
    user clicks on "OK" in the login form..
    Scenario1:
    I have a servlet(unprotected) which calls a EJB(which is protected).
    Depending on who has privileges to execute methods on the EJB bean , the authentication
    happens correctly..
    Scenario2:
    I have a PROTECTED servlet.
    When I execute the servlet in the browser , the login-form comes up .Once I click
    on OK,what is happening is I call my
    custom-loginmodule servlet which then calls the protected servlet.
    Now ..from the custom-loginmodule servlet when the request goes to the PROTECTED
    servlet ,the login-page again comes up...for some reason the servlets or JSPs'
    don't understand that the security context has already been created..
    But if the currently protected servlet is made unprotected and if it is made to
    call a protected EJB, the EJB bean gets the security context.
    I am thinking that security context is propagating but for some reason the JSP/servlet
    domain does not seem to get the already created security context.
    Another thing I noticed was with the default approach of using form-auth as "j_security_check"
    does not seem to work with URL rewriting.
    Any hints is greatly appreciated..
    Thanx,
    krish.
    Krishnan.Venkataraman
    Symphoni Interactive
    Technical Lead.
    [email protected]
    412 414 5385(mobile)
    412 446 2219(Work)
    1 800 439 7757 (# 2219) (Work)
    412 343 6549(Res)
    WEB:http://members.123india.com/krishnan

    hi,
    you may set a <servlet-mapping> in web.xml or you may use
    <form action="/servlet/HelloWorldExample" method=post>
    instead of
    <form action="/HelloWorldExample" method=post>
    the <servlet-mapping> should be:
    <web>
    <servlet>
    <servlet-name>HelloWorldExample</servlet-name>
    </servlet>
    <servlet-mapping>
    <servlet-name>HelloWorldExample</servlet-name>
    <url-pattern>/helloWorld.html<url-pattern>
    <servlet-mapping>
    </web>
    after you add the servlet-mapping, you can access the servlet with the url-pattearn, that is:
    <form action="/helloWorld.html" method=post>
    the internal operation of the first and second methods are different, and you should use second one(user servlet-mapping), and the <url-pattern> has may way to use, if you want learn more, see servlet spec. for more.

Maybe you are looking for

  • Clearing of Down Payment

    Hi Gurus, If we made a down payment in reference of a Purchase Order no., then while doing MIRO for that PO system will give message that there is a down payment exist for this PO. If person doing MIRO just overlook the message and post the invoice.

  • Macbook compared to Sony

    I just got a sony vaio sz and macbook but i am keeping one and giving away the other.I was wondering if anyone could tell me any hardware difference between the two? they both have accelerometers, wireless N, Intel core 2 's, web cams. The only hardw

  • HT200197 Apple TV showing image of usb plug

    My apple TV has a blinking light and a picture of a usb plug and itunes symbol.  I am unable to get to the menu.  I have tried holding the down and menu to restart, but it didn't help.

  • BIOS - HP Pro 3015 MT - MotherBoar​d: M2N78-LA (Violet6)

    Desktop: HP Pro 3015 MT  MotherBoard: M2N78-LA (Violet6) Issue: Used update sp54083.exe to update my BIOS to version 5.16. Upgrade succeeded but now my fan is out of control. I read on the internet that a lot of people have these issues. I can't find

  • Slow running data for heart rate variability VI Please help my thesis is due in 3days!! :(

    Hi there i'm having a great issue with a VI i have created to detect heart rate variabilty from ECG and PPG signals and seeing which one is most accurate with regards to HRV. I initially recorded 25 minutes worth of data and saved this into a text fi