Dynamic Queries with JSP

I am developing a search page which should first bring the results sorted by some particular field & then the user should have the option of sorting the results by other field names which are provided in a form list.
For generating dynamic requests, ? is used in place of parameter. But for some reason it is not working with Order by. Other dynamic queries are working fine. Please let me know the right way to handle it.
And also if someone can advise a good reference book for dynamic SQL statements in accordance with JSP.
Thanks for your time.

Never mind my previous solution. Some success was not perfect, therefore not acceptable. I used a scriplet and the problem is solved!
  <!-- Dynamically build the query -->
    <%
      String sql = "select * from issue_list_view";
      String where = null;
      String param = null;
      // Status
      param = (String)pageContext.getAttribute("status");
      if(param != null && param.compareTo("")!=0)
        where = "status='"+param+"'";
      else
        where = "status not in ('Closed','Duplicate')";
      // Assigned To
      param = (String)pageContext.getAttribute("assign");
      if(param != null && param.compareTo("")!=0)
        if(where.length()>0) {where += " and ";}
        where = "category='"+param+"'";
      // Category
      param = (String)pageContext.getAttribute("category");
      if(param != null && param.compareTo("")!=0)
        if(where.length()>0) {where += " and ";}
        where = "category='"+param+"'";
      // Type
      param = (String)pageContext.getAttribute("type");
      if(param != null && param.compareTo("")!=0)
        if(where.length()>0) {where += " and ";}
        where += "issue_type='"+param+"'";
      // Id
      param = (String)pageContext.getAttribute("id");
      if(param != null && param.compareTo("")!=0)
        if(where.length()>0) {where += " and ";}
        where += "issue_id="+param;
      // Add where clause if needed
      if(where != null) { sql += " where " + where; }
    %>
    <!-- Do the query -->
    <sql:query var="issues" sql="<%=sql%>"/>

Similar Messages

  • Dynamic checkboxes with jsp

    Hi,
    I need to create dynamic checkboxes in my jsp page from the values retrived from the database(oracle).help me with the code.My oracle queries are in my Java bean coding.pls its very very urgent.help me out.

    hi,
    This is my bean coding.can u pls tell me how to store the resultset values in a arraylist.help me out.
    package campaign;
    //Imports
    import java.io.*;
    import javax.sql.DataSource;
    import javax.naming.*;
    import com.ibm.ws.sdo.mediator.jdbc.Create;
    import java.sql.*;
    * @author n48edf
    * TODO To change the template for this generated type comment go to
    * Window - Preferences - Java - Code Style - Code Templates
    public class AgentDao extends java.lang.Object implements UnsubscribeConstants
    protected int indivID = 0;
    protected Connection _conn;
    protected DataSource ds = null;
    protected ResultSet rs = null;
    private String driver = null;
    //need to code
    public void agentLoad(IndvId) throws IOException
    String driver = ORACLE_DRIVER;
    String dataSource= ORACLE_DATA_SOURCE;
    try
    //Establish database connection
    if (_conn == null)
    try
    Context context = new InitialContext();
    // JDBC JNDI lookup
    ds = (DataSource)context.lookup(dataSource);
    context.close();
    // Get a connection
    _conn = ds.getConnection();
    catch (Exception exp)
    throw exp;
    // Create a connection statement
    Statement stmt = _conn.createStatement();
    rs = stmt.executeQuery("SELECT DISTINCT busn_org_nm "+
    "FROM BUSN_ORG bo,AGYLOCINDV_RESP_BUSORG ab "+
    "WHERE ab.busn_org_cd=bo.busn_org_cd AND ab.indvid=p_IndvId");
    String array[]=rs;
    stmt.close();
    cleanUp();
    catch ( SQLException sqe )
    System.out.println ("AgentDao.java - SQL Exception: " + sqe.toString());
    sqe.printStackTrace();
    catch ( Exception e )
    System.out.println ("AgentDao.java - Exception: " + e.toString());
    e.printStackTrace();
    finally
    if(_conn != null|| rs != null)
    cleanUp();
    public void cleanUp()
    try
    //close resultset
    if (rs != null)
    rs.close();
    rs = null;
    //close connection
    if(_conn != null)
    _conn.close();
    _conn = null;
    catch (SQLException sqe)
    System.out.println("SQL Exception occurred in cleanUp() of AgentDAO");
    sqe.printStackTrace();
    catch (Exception e)
    System.out.println("Error occurred in cleanUp() of AgentDAO");
    e.printStackTrace();
    }

  • Dynamic images with JSP

    Hello,
    I am using NetBeans to make a WebApp. I have an image to display on Page3.jsp that is generated during the navigation from the previous page, Page2.jsp. This image is a png file, and is unique graph generated for each visitor. Is there a simple way to display dynamically created images? I have searched for tutorials and asked my good pal Google but to no avail.
    (FYI: At present, I am saving the images in a folder I have created beneath the 'web' folder, called 'web/images'. Netbeans asks me if I want to reload the image only after the previous, old image has been sent out by the server. I am producing and creating the image with the button_action method of Page2.jsp that then sends the user to Page3.jsp, where the image is to be displayed. Once the image is reloaded, I can refresh the web page and the correct image appears.)
    Any help would be greatly appreciated.
    Thanks,
    Taivo

    Although I have never implemented this, I know it is possible and I can point you in the right direction. If you already have the code to create the .png image, it shouldn't be too difficult to modify the image code into a servlet to serve nothing but the image (and leave rest of the html in place). Just as the page is writen to an output stream from the request for page.jsp (by the servlet created by the jsp parser), a request for an image can be handled by a servlet.
    //this is in page3.jsp as plain HTML
    <img src="/servlet/graph?user=aUser" />This servlet (graph.class) draws ths image, but instead of writing it to a file, writes it to the response stream.
    Hope this helps,
    Bamkin

  • Dynamic dropdown with jsp

    Hi,
    can someone suggest me how to implement following concept in JSP (only through jsp)
    i have one dropdown list box,which is holding source values, on selecting source the second dropdown list box should display destination values from database.
    i have some sample code snippet, but not sure what to put in "onchange". can anyone tell me, pls let me know if there are any easy ways to do this.
    Source <select name="source" onchange="">
    <option value="">Select Source</option>
    <option value="jfk">JFK</option>
    <option  value="heathrow">Heathrow</option>
    <option  value="cst">Mumbai</option>
    <option  value="chennai">Chennai</option>
    </select>
    Destination <select name="destination" >
    <%
    while(rs.next())
                   String destination = rs.getString("destination");
                   out.println("<option value="+destination+">"+destination+"</option>");
    %>
    </select>

    Here is my try which I done with [html tutorial|http://phpforms.net/tutorial/tutorial.html]. You can try to use it.
    <html>
    <head>
    <script language="javascript" type="text/javascript" >
    <!-- hide
    function jumpto(x){
    if (document.form1.jumpmenu.value != "null") {
    document.location.href = x
    // end hide -->
    </script>
    </head>
    <body>
    <select name="source" onchange="">
    <option value="">Select Source</option>
    <option value="jfk">JFK</option>
    <option  value="heathrow">Heathrow</option>
    <option  value="cst">Mumbai</option>
    <option  value="chennai">Chennai</option>
    </select>
    Destination <select name="destination" >
    <%
    while(rs.next())
                   String destination = rs.getString("destination");
                   out.println("<option value="+destination+">"+destination+"</option>");
    %>
    </select>
    </body>
    </html>This is just simple example. You can customize it as you like.

  • Dynamic Labels with JSP/BC4J

    Is it possible to have the labels on a JSP dynamically change as the input changes? IE. If country chosen is canada the label becomes postal code instead of zip code.
    Thanks,
    Natalie

    You can setup control hints per locale. If you setup hints for both locales, the JSP runtime will automatically select the appropriate label based on the browser's language settings.

  • Report Designer - Summary page based on 3 queries with dynamic hierarchy?

    Dear All,
    I am trying to build a workbook based on 3 queries with a summary page that pulls in the query data into one page.
    Each query is based on one key figure that is split by profit centre hierarchy.
    i.e.
    Turnover
    -Profit Centre Node A
    -Profit Centre Node B
    -Profit Centre Node C
    > Profit Centre C1
    > Profit Centre C2
    The user can dril-down into each query at whatever level of the PC Hierarchy they wish.
    My issue is trying to structure a dynamic summary page that pulls in all rows from the individual queries regardless of the number of profit centre hierarchies contained in each. i.e. The summary could have 5 PCs for queries 1,2 & 3 in one execution, but then 10 for all queries in another execution.
    Question:
    Can report designer be used to make a dynamic summary sheet that will capture all rows from the individual query? or would an excel macro summary be the only way of doing this?

    Hi Ingo,
    After much testing and looking into trace etc. we have got this thing to behave as desired. Basically, following two things,
    - no reference to CR Dynamic Hierarchy variable on report. There were places where this parameter was being refered and causing grief. We tested with brand new report.
    - making sure that on query Cost center restriction is placed in Characteristic Restriction area of Filter tab of query, as oppose to default value area filter tab.
    With above in place, the published report in infoview behave as desired, i.e. proper hierarchy structure in cost center prompt and group tree and only desired nodes showing on report.
    Thank you for all you pointers
    Regards
    IMS

  • Can't create dynamic html elements with jsp????? important

    Hi All,
    I am having problem creating dynamic html elements with jsp tags, i have tried to use EL and java scriplet, both of them don't work.
    i am trying to create dynamic menu in my "rightMenu.jspf", based on, if user has logged in or not.
    some like this!
    <jsp:if test ="${validUser == null}">
    some simple text menu here
    </jsp:if>
    but it is not working. it simply loading all and images with in statement, regardless of whether user has logged in or not. i think some how if statement is not working properly.
    "validUser" is a session bean, which is not creating at this point, it will created when user will log in successfully. and also this session bean does not exist at the page, where i am trying to check that .
    Is there any way to create dynamic values in jsp. It is really important, is there any body who help me in this matter. i would be really grateful.
    zaman

    hi jaspre,
    thanks for replying me. you know what, is it not something wrong with web.xml file. i remember once, i deleted some from there, a property with "*.jsp". i can't remember what exactly was it though.
    all if statements works on files ending with extension ".jsp" but don't work only on with extension ".jspf". there must be to do with this.
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <servlet>
    <servlet-name>ValidateServlet</servlet-name>
    <servlet-class>ValidateServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>ValidateServlet</servlet-name>
    <url-pattern>/ValidateServlet</url-pattern>
    </servlet-mapping>
    <servlet>
    <servlet-name>dwr-invoker</servlet-name>
    <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
    <init-param>
    <param-name>debug</param-name>
    <param-value>true</param-value>
    </init-param>
    <init-param>
    <param-name>pollAndCometEnabled</param-name>
    <param-value>true</param-value>
    </init-param>
    </servlet>
    <servlet-mapping>
    <servlet-name>dwr-invoker</servlet-name>
    <url-pattern>/dwr/*</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>
    30
    </session-timeout>
    </session-config>
    <welcome-file-list>
         <welcome-file>
    main.jsp
    </welcome-file>
    </welcome-file-list>
    </web-app>
    if any one can figure it out. i would be grateful.
    zaman

  • Servlet with no dynamic code inside jsp pages

    Hello,
              I saw that a servlet is created even if there is no dynamic code inside jsp pages (scriplets & tags). Is it possible to avoid it on bea side ? (I am using portal 8).
              By the way, do you know if is it possible to define apache in order to avoid to send to bea the jsp which have no dynamic code inside ?
              thank you !

    JSP's always generate a servlet on all web containers. Apache/Tomcat is no
              different. If you have static content, make it an HTML page.
              Bill
              "hournon jc" <[email protected]> wrote in message
              news:22255787.1103297053148.JavaMail.root@jserv5...
              > Hello,
              >
              > I saw that a servlet is created even if there is no dynamic code inside
              jsp pages (scriplets & tags). Is it possible to avoid it on bea side ? (I am
              using portal 8).
              >
              > By the way, do you know if is it possible to define apache in order to
              avoid to send to bea the jsp which have no dynamic code inside ?
              >
              > thank you !
              

  • Dynamic HTML elements with JSP?

    I need to have a row in a HTML page which contains of a combox and two text fields.
    Depending on what I select in the combox I have to insert another row (which contains another combox and two text fields) or I have to remove one or both text fields from the current row.
    Is that possible with JSP?
    Many thanks

    You can certainly accomplish what you're asking for in a jsp. One of the tricks you can use to solve your problem would be to pass variables back into the page using the Get method and catching the values using the request.getParameter() technique. One quick tip, you should wrap any request.getParameter() elements with a try catch, if you try to grab a parameter that hasn't been defined yet (and this is perfectly acceptable) you'll get a null returned.
    I hope this helps

  • How to create two level dynamic list using JSP , Java Script and Oracle

    I am new in JSP. And i am facing problem in creating two level dynamic list using JSP ,Java Script where the listdata will come from Oracle 10g express edition database. Is there any easy way in JSP that is available on in ASP.NET.
    Plz response with details.

    1) Learn JDBC API [http://java.sun.com/docs/books/tutorial/jdbc/index.html].
    2) Create DAO class which contains JDBC code and do all SQL queries and returns or takes ID's or DTO objects.
    3) Learn Servlet API [http://java.sun.com/javaee/5/docs/tutorial/doc/].
    4) Create Servlet class which calls the DAO class, gets the list of DTO's as result, puts it as a request attribute and forwards the request to a JSP page.
    5) Learn JSP and JSTL [http://java.sun.com/javaee/5/docs/tutorial/doc/]. Also learn HTML if you even don't know it.
    6) Create JSP page which uses the JSTL c:forEach tag to access the list of DTO's and iterate over it and prints a HTML list out.
    You don't need Javascript for this.

  • Dynamic Table with two columns

    Hi!
    i have to create a Dynamic Table with two columns having 5-5 links each with some text...... three links r based on certain conditions....they r visible only if condition is true...
    if the links r not visible in this case another links take it's place & fill the cell.
    links/text is coming from database.
    i am using Struts with JSP IDE netbeans
    Please help me
    BuntyIndia

    i wanna do something like this
    <div class="box_d box_margin_right">
              <ul class="anchor-bullet">
              <c:forEach items="${data.faqList}" var="item" varStatus="status"
                        begin="0" end="${data.faqListSize/2-1}">
                        <li>${item}</li>
                   </c:forEach>
              </ul>
              </div>
              <div class="box_d">
              <ul class="anchor-bullet">
              <c:forEach items="${data.faqList}" var="item" varStatus="status"
                        begin="${data.faqListSize/2}" end="${data.faqListSize}">
                        <li>${item}</li>
                   </c:forEach>
              </ul>
              </div>
    wanna divide table in two columns....if one link got off due to condition other one take it's position...
    I have created a textorderedlist
    Bunty

  • Help me!! How to use JavaScript with JSP ??

    I am using JDeveloper and I created a screen in JSP which uses a bean for database connectivity and retriving info onto the page.
    The page has a ListBox where list items are populated from the database.My requirement is
    whenever the list is changed the page shuold be refreshed with the selected item info.
    I tried to use 'JavaScript' for triggering the event with 'onChange' event of the ListBox.But the event is not getting invoked. I think JavaScript is not working with JSP.
    Please help me with how to Use javaScript with JSP or any other alternative where I can meet my requirement.
    I have one more question...I have gone through the JSP samples in OTN and I am trying do download the sample 'Travel servlet' which show list of countries...etc
    I have also gone through the 'readme' but I don't know how to extract .jar file.
    I would be great if you could help me in this.
    Thanks!!
    Geeta
    null

    We have a similar need. We have used Cold Fusion to display data from Our Oracle Database. We have a simple SElect Box in HTML populated with the oracle data. When someone selects say the State of Pennsylvania. then we have an On change event that runs a Javascript to go get all the cities in Pennsylvania.
    Proble we are having is that inorder for the Javascript to work , we currently have to send all the valid data.
    Do you know of any way to dynamically query the the Oracle database in Javascript

  • Dynamic accordion with dynamic datagrid

    I’m trying to create a dynamic accordion with embedded
    datagrids in each accordion area. I have the base working but have
    2 problems I can’t seem to figure out.
    Bases; the accordion uses a repeater and vbox with a custom
    component from a webservice result set to create the accordion. The
    custom component has another webservice that gets a value from the
    repeater to pass it to the custom component.
    My 2 problems:
    1. how do I prevent the custom component from running the
    webservice until the accordion item is clicked or the area is
    visible? Otherwise I end up will a bunch of queries hitting the DB
    and if there is several items for the accordion and many items from
    the datagrid its slower.
    2. how can I get the datagrid query to refresh when the
    accordion item is clicked? Because the data may change I am not
    able to see the updated data unless I reload the entire
    application.
    1 thing I did try. With the tab control you can use the
    show() event and the data will refresh just fine, but with the
    accordion, the show() event does not seem to fire. Its as if they
    are all visible.
    Any help here would be much appreciated, I’ve been
    racking my brain for days now and I sure it is something simple
    that I am missing. Thanks in advance.
    See the example code below.
    the application code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute"
    width="100%"
    height="100%"
    initialize="ws.getMethod1.send()"
    xmlns:output="com.comp.*">
    <mx:Script>
    <![CDATA[
    import mx.controls.Alert;
    [Bindable]
    public var thisWsdl:String = '
    http://localhost/webservice/service.cfc?wsdl';
    ]]>
    </mx:Script>
    <mx:WebService id="ws"
    wsdl="{thisWsdl}"
    useProxy="false"
    showBusyCursor="true"
    fault="Alert.show(event.fault.faultString, 'Error');"
    concurrency="multiple" requestTimeout="30">
    <mx:operation name="getMethod1">
    <mx:request>
    <param1>{param1data}</param1>
    <param2>{param2data}</param2>
    <param3>{param3data}</param3>
    </mx:request>
    </mx:operation>
    </mx:WebService>
    <mx:Accordion width="100%" height="100%"
    fillColors="[#808080, #808080]">
    <mx:Repeater id="rp"
    dataProvider="{ws.getMethod1.lastResult}">
    <mx:VBox label="{String(rp.currentItem.catname)}"
    backgroundColor="#C0C0C0" width="100%" height="100%"
    paddingRight="10">
    <output:comp catid="{rp.currentItem.catid}"/>
    </mx:VBox>
    </mx:Repeater>
    </mx:Accordion>
    </mx:Application>
    the component code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="
    http://www.adobe.com/2006/mxml"
    width="100%"
    height="100%"
    focusIn="ws.getMethod.send()"
    horizontalAlign="center"
    backgroundColor="#FFFFFF">
    <mx:Script>
    <![CDATA[
    import mx.controls.Alert;
    [Bindable]
    public var thisWsdl:String = '
    http://localhost/webservice/service.cfc?wsdl';
    [Bindable]
    public var catid:int;
    ]]>
    </mx:Script>
    <mx:WebService id="ws"
    wsdl="{thisWsdl}"
    useProxy="false"
    showBusyCursor="true"
    fault="Alert.show(event.fault.faultString, 'Error');"
    concurrency="multiple" requestTimeout="30">
    <mx:operation name="getMethod2">
    <mx:request>
    <catid>{catid}</catid>
    </mx:request>
    </mx:operation>
    </mx:WebService>
    <mx:DataGrid id="itemGrid"
    dataProvider="{ws.getMethod2.lastResult}" width="700"
    height="250">
    <mx:columns>
    <mx:DataGridColumn width="100" dataField="itemid"
    headerText="Item Id"/>
    <mx:DataGridColumn wordWrap="true" dataField="itemname"
    headerText="Item Name"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:VBox>

    Perhaps you could use the change event of the accordion, or
    the show event of the child containers?
    Tracy

  • Slow response  on data dictionary queries with optimizer_mode=rule in  10g

    I have two dataabse: DB1 (9i) and DB2 (10g) on windows 2000
    They are two development databases with the same schemas and same tables. The application executes the same commands but with different results and execution plans.
    In DB2 the queries with the most slow response tima are the queries on the data dictionary (for example: all_synonyms).
    These query are very fast with the optimizer_mode=cost and very slow with the optimizer_mode=rule.
    And the the problem is this:
    in DB1 and DB2 the application executes after the connection this command:
    ALTER SESSION SET OPTIMIZER_MODE = 'RULE';
    These are the traces of the session in db1 and db2:
    The queries are created dynamically by the application.
    Is there a solution for this?
    thanks
    Message was edited by:
    user596611

    Here is a simple example of what can happen,
    @>alter session set optimizer_mode=all_rows;
    @>SELECT PLAN_TABLE_OUTPUT FROM TABLE(DBMS_XPLAN.DISPLAY());
    PLAN_TABLE_OUTPUT
    | Id  | Operation        | Name | Rows  | Cost (%CPU)|
    |   0 | SELECT STATEMENT |      |     1 |     2   (0)|
    |   1 |  FAST DUAL       |      |     1 |     2   (0)|
    @>alter session set optimizer_mode=rule;
    @>SELECT PLAN_TABLE_OUTPUT FROM TABLE(DBMS_XPLAN.DISPLAY());
    PLAN_TABLE_OUTPUT
    | Id  | Operation        | Name |
    |   0 | SELECT STATEMENT |      |
    |   1 |  FAST DUAL       |      |
    Note
          - rule based optimizer used (consider using cbo)As you can see incomplete explain plans. Therefore it is not advised.
    Adith

  • Dynamic queries in weblogic

    In case of dynamic queries, I found out that the finder method can not be defined
    in the Home class. I defined the finder
    method in the Bean.
    In my Bean, this is the code:
    public Collection findAllActivities(String filter, Object[] arguments) throws
    FinderException
         Properties myProp = new Properties();
         for(int i = 0; i < arguments.length; i++)
              myProp.setProperty(String.valueOf(i), String.valueOf((arguments)));
         try
              InitialContext ic = new InitialContext();                
              RolesHome rh = (RolesHome)ic.lookup("RolesHome");     
              QueryHome qh = (QueryHome)rh;
              String weblogicQL = "SELECT DISTINCT OBJECT(o) FROM roles AS o" + filter;
              Query query = qh.createQuery();
              return query.find(weblogicQL, myProp);
         catch (Exception e)
              e.printStackTrace();
              return null;
    I get a naming exception if I use :      RolesHome rh = (RolesHome)ic.lookup("RolesHome");
    javax.naming.NameNotFoundException: Unable to resolve 'RolesHome' Resolved: ''
    Unresolved:'RolesHome' ; remaining name
    'RolesHome'
    I get a casting exception if I use:      RolesHome rh = (RolesHome)ic.lookup("Roles");
    In my jsp file:
    I have this code
    InitialContext jndiContext = new InitialContext();
    Object obj = jndiContext.lookup("Roles");
    RolesHome rolesHome = (RolesHome) obj;
    list = (ArrayList) rolesHome.findAllActivities(filter, filterParams);          
    but the problem is that the home interface does not contain the findAllActivities
    function. I have already defined rolesHome
    earlier in the code which I want to use for findAllActivities also. I can not
    cast the bean e.g. RolesBean rolesBean = (
    RolesBean) rolesHome. I do not want to create a new bean as I am already using
    an old rolesHome. How do I solve this
    problem??? Please do let me know. I am really confused.
    Thanks
    Ronak Parekh

    This should be posted to the ejb newsgroups
    mbg
    "ronak" <[email protected]> wrote in message
    news:3e57faa9$[email protected]..
    >
    In case of dynamic queries, I found out that the finder method can not bedefined
    in the Home class. I defined the finder
    method in the Bean.
    In my Bean, this is the code:
    public Collection findAllActivities(String filter, Object[] arguments)throws
    FinderException
    Properties myProp = new Properties();
    for(int i = 0; i < arguments.length; i++)
    myProp.setProperty(String.valueOf(i), String.valueOf((arguments)));
    try
    InitialContext ic = new InitialContext();
    RolesHome rh = (RolesHome)ic.lookup("RolesHome");
    QueryHome qh = (QueryHome)rh;
    String weblogicQL = "SELECT DISTINCT OBJECT(o) FROM roles AS o" + filter;
    Query query = qh.createQuery();
    return query.find(weblogicQL, myProp);
    catch (Exception e)
    e.printStackTrace();
    return null;
    I get a naming exception if I use : RolesHome rh =
    (RolesHome)ic.lookup("RolesHome");
    >
    javax.naming.NameNotFoundException: Unable to resolve 'RolesHome'Resolved: ''
    Unresolved:'RolesHome' ; remaining name
    'RolesHome'
    I get a casting exception if I use: RolesHome rh =(RolesHome)ic.lookup("Roles");
    >
    >
    In my jsp file:
    I have this code
    InitialContext jndiContext = new InitialContext();
    Object obj = jndiContext.lookup("Roles");
    RolesHome rolesHome = (RolesHome) obj;
    list = (ArrayList) rolesHome.findAllActivities(filter, filterParams);
    but the problem is that the home interface does not contain thefindAllActivities
    function. I have already defined rolesHome
    earlier in the code which I want to use for findAllActivities also. I cannot
    cast the bean e.g. RolesBean rolesBean = (
    RolesBean) rolesHome. I do not want to create a new bean as I am alreadyusing
    an old rolesHome. How do I solve this
    problem??? Please do let me know. I am really confused.
    Thanks
    Ronak Parekh

Maybe you are looking for