JSP - Bean - Scope Issue with ResultSet

Hi there,
I have a JSP page that uses a Bean to get ResultSets from a db. My methods return ResultSets, but they seem to get out of scope on the JSP page when I try to use them. I'm not sure why. I have included 2 snippets below one that works and one that doesn't. I get a java.lang.null exception when the page is run. Not sure how or why the variable seems to go out of scope? I can work around it, but I would rather find out why this is happening.
This one fails:
<%@ page errorPage="error.jsp" %>
<%@ page import="utils.LookupBean" %>
<%@ page import="java.sql.ResultSet" %>
<%
try{
%>
<html>
<head>
<title>lookup</title>
</head>
<body>
<jsp:useBean id="lookup" class="utils.LookupBean">
<%
ResultSet roem = lookup.getOEMDropdown();
//open db conn
lookup.openIlprod();
if(roem!=null){
%>
OEM:  
<select name="OEM">
<%
while(roem.next()){
%>
<option value="<%=roem.getString("id")%>"><%=roem.getString("name")%></option>
<%
%>
</select><br><br>
<%
else{
out.println("OEM:  no records<br><br>");
%>
</jsp:useBean>
</body>
</html>
<%
catch(Exception e){     
     //log to Tomcat
%>
This one works....why??
<%@ page errorPage="error.jsp" %>
<%@ page import="utils.LookupBean" %>
<%@ page import="java.sql.ResultSet" %>
<%
try{
%>
<html>
<head>
<title>lookup</title>
</head>
<body>
<jsp:useBean id="lookup" class="utils.LookupBean">
<%
//open db conn
lookup.openIlprod();
ResultSet roem = lookup.getOEMDropdown();
if(roem!=null){
%>
OEM:  
<select name="OEM">
<%
while(roem.next()){
%>
<option value="<%=roem.getString("id")%>"><%=roem.getString("name")%></option>
<%
%>
</select><br><br>
<%
else{
out.println("OEM:  no records<br><br>");
%>
</jsp:useBean>
</body>
</html>
<%
catch(Exception e){     
     //log to Tomcat
%>

<%@ page errorPage="error.jsp" %>
<%@ page import="utils.LookupBean" %>
<%@ page import="java.sql.ResultSet" %>
<%
String ilprod_db_user;
String ilprod_db_pass;
String tedsi_prod_owner;
String nsp_portal_owner;
String iladmin_owner;
String ilprod_db_host;
String ilprod_db_port;
String ilprod_db_service;
try{
     //get the ilprod_db_user from the deployment descriptor
     ilprod_db_user = (String)getServletContext().getInitParameter("ilprod_db_user");
     //ensure a value is present
     if(ilprod_db_user==null||ilprod_db_user.equals("")){
     throw new ServletException("Error retrieving ilprod_db_user from deployment descriptor. - ilprod_db_user is null or an empty string");
     //get the ilprod_db_pass from the deployment descriptor
     ilprod_db_pass = (String)getServletContext().getInitParameter("ilprod_db_pass");
     //ensure a value is present
     if(ilprod_db_pass==null||ilprod_db_pass.equals("")){
     throw new ServletException("Error retrieving ilprod_db_pass from deployment descriptor. - ilprod_db_pass is null or an empty string");
     //get the tedsi_prod_owner from the deployment descriptor
     tedsi_prod_owner = (String)getServletContext().getInitParameter("tedsi_prod_owner");
     //ensure a value is present
     if(tedsi_prod_owner==null||tedsi_prod_owner.equals("")){
     throw new ServletException("Error retrieving tedsi_prod_owner from deployment descriptor. - tedsi_prod_owner is null or an empty string");
     //get the nsp_portal_owner from the deployment descriptor
     nsp_portal_owner = (String)getServletContext().getInitParameter("nsp_portal_owner");
     //ensure a value is present
     if(nsp_portal_owner==null||nsp_portal_owner.equals("")){
     throw new ServletException("Error retrieving nsp_portal_owner from deployment descriptor. - nsp_portal_owner is null or an empty string");
     //get the iladmin_owner from the deployment descriptor
     iladmin_owner = (String)getServletContext().getInitParameter("iladmin_owner");
     //ensure a value is present
     if(iladmin_owner==null||iladmin_owner.equals("")){
     throw new ServletException("Error retrieving iladmin_owner from deployment descriptor. - iladmin_owner is null or an empty string");
     //get the ilprod_db_host from the deployment descriptor
     ilprod_db_host = (String)getServletContext().getInitParameter("ilprod_db_host");
     //ensure a value is present
     if(ilprod_db_host==null||ilprod_db_host.equals("")){
     throw new ServletException("Error retrieving ilprod_db_host from deployment descriptor. - ilprod_db_host is null or an empty string");
     //get the ilprod_db_port from the deployment descriptor
     ilprod_db_port = (String)getServletContext().getInitParameter("ilprod_db_port");
     //ensure a value is present
     if(ilprod_db_port==null||ilprod_db_port.equals("")){
     throw new ServletException("Error retrieving ilprod_db_port from deployment descriptor. - ilprod_db_port is null or an empty string");
     //get the ilprod_db_service from the deployment descriptor
     ilprod_db_service = (String)getServletContext().getInitParameter("ilprod_db_service");
     //ensure a value is present
     if(ilprod_db_service==null||ilprod_db_service.equals("")){
     throw new ServletException("Error retrieving ilprod_db_service from deployment descriptor. - ilprod_db_service is null or an empty string");
%>
<html>
<head>
<title>lookup</title>
</head>
<body>
<jsp:useBean id="lookup" class="utils.LookupBean">
<jsp:setProperty name="lookup" property="ilprod_db_user" value="<%=ilprod_db_user%>"/>
<jsp:setProperty name="lookup" property="ilprod_db_pass" value="<%=ilprod_db_pass%>"/>
<jsp:setProperty name="lookup" property="tedsi_prod_owner" value="<%=tedsi_prod_owner%>"/>
<jsp:setProperty name="lookup" property="nsp_portal_owner" value="<%=nsp_portal_owner%>"/>
<jsp:setProperty name="lookup" property="iladmin_owner" value="<%=iladmin_owner%>"/>
<jsp:setProperty name="lookup" property="ilprod_db_host" value="<%=ilprod_db_host%>"/>
<jsp:setProperty name="lookup" property="ilprod_db_port" value="<%=ilprod_db_port%>"/>
<jsp:setProperty name="lookup" property="ilprod_db_service" value="<%=ilprod_db_service%>"/>
<%
//open db conn
lookup.openIlprod();
ResultSet roem = lookup.getOEMDropdown();
ResultSet rstat = lookup.getStatusDropdown();
if(roem!=null){
%>
OEM:��
<select name="OEM">
<%
while(roem.next()){
%>
<option value="<%=roem.getString("id")%>"><%=roem.getString("name")%></option>
<%
%>
</select><br><br>
<%
else{
out.println("OEM:  no records<br><br>");
//******* IF I PUT ResultSet IN FRONT OF rstat HERE IT WORKS FINE?
rstat = lookup.getStatusDropdown();
if(rstat!=null){
%>
Status:��
<select name="status">
<%
while(rstat.next()){
%>
<option value="<%=rstat.getString("id")%>"><%=rstat.getString("description")%></option>
<%
%>
</select><br><br>
<%
else{
out.println("Status:  no records<br><br>");
//close db conn
lookup.closeIlprod();
%>
</jsp:useBean>
</body>
</html>
<%
catch(Exception e){
     //set request attributes to pass to error page
     request.setAttribute("javax.servlet.error.exception",e);
     request.setAttribute("javax.servlet.error.message",e.getMessage());
     request.setAttribute("javax.servlet.error.request_uri",     request.getRequestURI());
     request.setAttribute("javax.servlet.error.servlet_name", request.getServletPath());
     //log to Tomcat
     application.log(" Message: "+e.getMessage()+'\r'+'\n'+"RequestURI: "+request.getRequestURI()+'\r'+'\n'+"Servlet Path: "+request.getServletPath(),e);
     //forward to the error page
     RequestDispatcher rd =     request.getRequestDispatcher("error.jsp");
     rd.forward(request,response);
     //out.println(e.getMessage());
%>

Similar Messages

  • NI SCOPE issues with program

    I originally had a program that used cursors on a pulse signal to calculate the average of two different gates, and find the difference between them. It worked at one point when I was using the NI SCOPE express VI, but when I tried switching to the real NI SCOPE using Multi Record, due to efficiency issues, I ran into some bugs that I need some help with. The main issue is that one of the pair of gates(cursors) is not getting averaged, but the first one is. Because of this, the program will not find the difference.The issue may be because I had to switch from using a signal to using a waveform with the property node. If anyone could provide any sort of assistance, that would be great!
    Attachments:
    NewPulse.vi ‏54 KB

    I think you are simply missing a wire
    Jeff

  • Issue with passing parameters from JSP to Backing bean

    hi ,
    I have an issue in passing parameters from my JSP to backing bean. I want to fetch the parameter from my URL in backing bean .This is how i am coding it right now. But the parameter companyID returns me null.
    URL http://localhost:8080/admin/compadmin.jsp?companyID=B1234.
    In my backing bean
    FacesContext context = FacesContext.getCurrentInstance();
    String companyID = (String)context.getExternalContext().getRequestParameterMap().get("CompanyID");
         public void setCompanyID(String companyID)
              this.companyID=companyID;
         public String getCompanyID()
              return this.companyID;
    faces-config.xml :
       <managed-bean-name>admincontroller</managed-bean-name>
              <managed-bean-class>com.admin.controller.AdminController</managed-bean-class>
              <managed-bean-scope>request</managed-bean-scope>
              <managed-property>
                   <property-name>companyadminbean</property-name>
                   <property-class>com.admin.model.AdminBean</property-class>
                   <value>#{companyadminbean}</value>
                         </managed-property>
                        <managed-property>
                                 <property-name>companyID</property-name>
                              <value>#{param.companyID}</value>
                             </managed-property>Please let me know if iam missing something.Appreciate your help in advance
    Thanks

    Thanks very much for your input. I made changes to my bean accordingly. Actually the method getAdminType() is a not a getter of a property. It's just a method which iam calling in AdminController bean constructor to verify whether the person is System Admin or Client admin. So now the issue is inspite of making changes still the link "Copy Users" shows up for Client admin too which is incorrect.
    My Administrator bean:
    public class Administrator {
      boolean GSA=false;
      boolean SA=false;
      public Administrator(){}
    public boolean isGSA()
        return GSA;
      public boolean isSA()
        return SA;
      public void setGSA(boolean value)
        this.GSA=value;
      public void setSA(boolean value)
        this.SA=value;
    }My backing bean:
    public class AdminController {
    private AdminBean adminbean = new AdminBean();
    public AdminController(){
    int userID=1234;
    this.getAdminType(userID);           
    public void getAdminType(int userID)
             Administrator admin = new Administrator();
             if (userID<0) return;
             try{
                 if(Rc.isGlobalSystemAdmin(userID)){
                      admin.setGSA(true);
                              }else if(Rc.isClientSystemAdmin(userID)){
                      admin.setSA(true); // i could see these values setup correctly in the admin bean when i print them
                 adminbean.setAdmin(admin);
                  } catch (Exception e){ }
    Admin Bean:
    public class AdminBean {
    private Administrator admin; 
    public Administrator getAdmin()
                        return this.admin;
              public void setAdmin(Administrator admin)
                        this.admin = admin;
    faces-config.xml
    <managed-bean>
              <managed-bean-name>admincontroller</managed-bean-name>
              <managed-bean-class>com.controller.AdminController</managed-bean-class>
              <managed-bean-scope>request</managed-bean-scope>
              <managed-property>
                   <property-name>adminbean</property-name>
                   <property-class>com.model.AdminBean</property-class>
                   <value>#{adminbean}</value>
             </managed-property>
         </managed-bean>
         <managed-bean>
              <managed-bean-name>adminbean</managed-bean-name>
              <managed-bean-class>com.model.AdminBean</managed-bean-class>
              <managed-bean-scope>request</managed-bean-scope>
              <managed-property>
                   <managed-property>
                   <property-name>admin</property-name>
                   <property-class>com.model.Administrator</property-class>
                   <value>#{admin}</value>
                             </managed-property>
         </managed-bean>     My JSP:<h:outputLink id="ol1" value="/companyadmin/copyusers.jsp">
               <h:outputText id="ot1" value="Copy Users" rendered="#{adminbean.admin.isGSA}" /><f:verbatim><br/></f:verbatim>
               </h:outputLink>    so now the issue is thelink copy users is displayed even #{adminbean.admin.isGSA} is FALSE. please advise.
    Thanks
    Edited by: twisai on Oct 15, 2009 7:06 AM

  • Qusetion with jsp beans

    Hi all
    plz help with this question,if i had asimpl jsp file containing the following code:
    <html>
    <body>
    <form method="get" action="second.jsp">
    <input type="text" name="name">
    <input type="text" name="age">
    <input type="submit" name="submit">
    </form>
    </body>
    </html>
    and another simple jsp file containing this code:
    <html>
    <body>
    <jsp:useBean id="bean" scope="session" class="thebeans.Bean"/>
    <jsp:setProperty name="bean" property="*"/>
    <jsp:getProperty name="bean" property="name"/>
    <jsp:getProperty name="bean" property="age"/>
    <%
    bean.DataBase();
    %>
    </body>
    </html>
    *DataBase() is amethod that take the input from the jsp file and  connect 2 the database 2 see f it exists before</s<br />what i want 2 do is that f it exist load specific html file f not load another html file+
    how can i do that and where 2 write it+
    *(sorry still new 2 java)*

    Actually you're probably off on a false trail with jsp:useBean. The more up to date methods use tag libraries (typically JSTL) and access bean attributes using EL, bean expression language. E.g. you put your initial form data into a request attribute called "data" and you put:
    <input type="text" name="property1" value="${data.property1}" ....useBean is no use for binding returned fields from a form. Always remember that your JSP generates HTML and once that HTML is sent to the browser that's it, the JSP has done it's job and finished. Only with JSF, at present, does what you write in your JSP affect the processing of received form data. When you get the form data back you need to "bind" the values from the request back to the bean. A framework like Spring will do this stuff for you, but in a raw Servlet/JSP environment it's up to you.

  • Issue with a resultSet.wasNull() method

    Hello all
    I'm having a small issue with a resultset, basically i wanna test if it returns a null value but it does not seems to work.
    Its a simple application that pulls football matches data out of a database base on the provided data.
    This is my code, i would like to first say that, connectivity works fine, database existing, tables existing, if correct data's are inserted the application fetches the data with no problem.
    public void getMatch(GregorianCalendar cal){
    java.sql.Date sqlDate= new java.sql.Date(cal.getTimeInMillis());
    try{
    String resultMatch="SELECT resultMatch FROM matches WHERE date=?";
    PreparedStatement pre=connection.prepareStatement(resultMatch);
    pre.setDate(1,sqlDate);
    ResultSet resMatch=pre.executeQuery();
    if(resMatch.wasNull()){
    System.out.println("No data found");
    } else {
    System.out.println("Show all datas");
    }//rest of code
    } catch(SQLException e){
    }//rest of code
    the problem arises now, if i enter a data that its in the DB, its fine, all data's are pulled out and printed (via while(resMatch.next()........))
    If i enter a non existing data....nothing comes out, not even an exception.
    Any advice?
    Thx

    enrico wrote:
    This is my code, i would like to first say that, connectivity works fine, database existing, tables existing, if correct data's are inserted the application fetches the data with no problem.The code posted does not do that.
    >
    public void getMatch(GregorianCalendar cal){
    java.sql.Date sqlDate= new java.sql.Date(cal.getTimeInMillis());
    try{
         String resultMatch="SELECT resultMatch FROM matches WHERE date=?";
         PreparedStatement pre=connection.prepareStatement(resultMatch);
    pre.setDate(1,sqlDate);
         ResultSet resMatch=pre.executeQuery();
    if(resMatch.wasNull()){There is no way that the above code returns 'data' from the database.
    A result set represents a collection of zero or more rows.
    One must first retrieve a row before doing anything with it.
    The above code does not call next() so it absolutely does not retrieve any rows.
    The JDBC tutorial might help.
    http://download.oracle.com/javase/tutorial/jdbc/basics/

  • Prob with running jsp Bean

    Hi,
    I am trying to run a bean through a jsp but its giving error at useBean tag of jsp:
    The error is :
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: /Quadratic.jsp(7,0) The value for the useBean class attribute com.brainysoftware.Quadratic is invalid.
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:150)
         org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1227)
         org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
         org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
         org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
         org.apache.jasper.compiler.Generator.generate(Generator.java:3272)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:244)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:470)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    My jsp is:
    <HTML>
    <HEAD>
    <TITLE> JSP BEAN Quadratic Example </TITLE>
    </HEAD>
    <BODY>
    <%@ page language="java" %>
    <jsp:useBean id="quadratic" scope="session" class="com.brainysoftware.Quadratic" />
    <jsp:setProperty name="quadratic" property="ia" param="a" />
    <jsp:setProperty name="quadratic" property="ib" param="b" />
    <jsp:setProperty name="quadratic" property="ic" param="c" />
    X1= <%= quad.getDx1( ) %>
    X2= <%= quad.getDx2( ) %>
    End of program
    </BODY>
    </HTML>my bean is:
    package com.brainysoftware;
    import java.io.*;
    class Quadratic{
    int ia;
    int ib;
    int ic;
    String dx1;
    String dx2;
    public int getIa( ) {
    return ia;
    public void setIa( int ii) {
    ia=ii;
    public int getIb( ) {
    return ib;
    public void setIb(int ii) {
    ib=ii;
    public int getIc( ) {
    return ic;
    public void setIc(int ii) {
    ic=ii;
    public String getDx1( ) {
    double detA;
    double result;
    detA= ib*ib -4*ia*ic;
    if(detA<0.0)
    return "Real Roots not possible";
    else {
    result= -ib - Math.sqrt(detA/(2 * ia));
    Double Dresult=new Double (result);
    return Dresult.toString( );
    public String getDx2( ) {
    double detA;
    double result;
    detA= ib*ib -4*ia*ic;
    if(detA<0.0)
    return "Real Roots not possible";
    else {
    result= -ib + Math.sqrt(detA/(2 * ia));
    Double Dresult=new Double (result);
    return Dresult.toString( );
    my directory structure is given below:
    C:\tomcat-5.0.28\jakarta-tomcat-5.0.28\webapps\jsp-examples\WEB-INF\classes\com\
    brainysoftware>dir
    Volume in drive C has no label.
    Volume Serial Number is 4C50-9542
    Directory of C:\tomcat-5.0.28\jakarta-tomcat-5.0.28\webapps\jsp-examples\WEB-IN
    F\classes\com\brainysoftware
    05/22/2005 11:15 PM <DIR> .
    05/22/2005 11:15 PM <DIR> ..
    05/22/2005 11:18 PM 134 CalculatorBean.java
    05/23/2005 12:12 AM 216 Counter.java
    05/24/2005 10:48 PM 358 SimpleJavaBean.java
    06/14/2005 11:16 PM 1,205 Calculator.java
    06/14/2005 11:16 PM 1,323 Calculator.class
    06/16/2005 06:44 PM 534 CalculatorBean2.java
    06/17/2005 08:53 AM 703 CalculatorBean2.class
    06/16/2005 07:00 PM 352 CalculatorBean2.html
    06/17/2005 08:51 AM 588 CalculatorBean2.jsp
    06/17/2005 04:29 PM 97 UploadBean.java
    06/17/2005 04:43 PM 527 FileUploadBean.java
    06/17/2005 04:43 PM 834 FileUploadBean.class
    06/18/2005 12:21 PM 863 Quadratic.java
    06/18/2005 12:21 PM 1,093 Quadratic.class
    14 File(s) 8,827 bytes
    2 Dir(s) 8,615,821,312 bytes free
    C:\tomcat-5.0.28\jakarta-tomcat-5.0.28\webapps\jsp-examples\WEB-INF\classes\com\
    brainysoftware>
    The above clearly shows the presence of Bean in the reqd directory but still I am getting an error. Can somebody help me:
    Zulfi.

    class QuadraticThe class is not public. It is only visible to other classes in the same package as itself, so the servlet (JSP) trying to instantiate and reference it can't see it.
    Make it public.

  • Web Logic 10.3 upgrade causes issues with escaped characters in JSP.

    We recently upgraded our application servers from Weblogic 9.2 to Weblogic 10.3 and we are having an issue with escaped characters in a JSP code. Here is an example of what we are seeing:
    var convertedBody1 = document.getElementById('body').value.replace(/\$FIRST_NAME\$/g, firstName);
    This code works in Weblogic 9.2. In Weblogic 10.3 we have to make the following changes:
    var convertedBody1 = document.getElementById('body').value.replace(/\$FIRST_NAME\$/g, firstName);
    Thanks, Tom

    Hi:
    I have resolved the issue with the following in the jspx page.
    Put an
    <jsp:scriptlet>
    response.setContentType(“text/html; charset=UTF-8”);
    </jsp:scriptlet>
    Inside the <f:view> on the jspx file.
    Please refer the link http://www.oracle.com/global/il/support/tip/nlss11061.html for more details. It is helpful.
    Thanks & Regards
    Sridhar Doki

  • Issue with "firstRecord" Business Component method of JAVA Data bean API.

    Hi,
    Following is my use-case scenario:
    I have to add or associate child MVG business component (CUT_Address)
    with the parent business component (Account) using JAVA Data bean API.
    My requirement is: first to check whether child business component(i.e. CUT_address) exists. If it exists then associate it with parent business component (Account)
    otherwise create new CUT_address and associate it with account.
    Code (using JAVA Data bean APIs) Goes as follows:
    SiebelBusObject sBusObj = connBean.getBusObject("Account");
    parentBusComp = sBusObj.getBusComp("Account");
    SiebelBusComp parentBusComp;
    SiebelBusComp childBusComp;
    // retrieve required account.. Please assume Account1 exists
    parentBusComp.activateField("Name");
    parentBusComp.clearToQuery();
    parentBusComp.setSearchSpec("Name", "Account1");
    sBusComp.executeQuery2(true, true);
    sBusComp.firstRecord();
    Counter = 0;
    while (counter < Number_Of_Child_Records_To_Insert)
    childBusComp = parentBusComp.getMVGBusComp("City");
    associatedChildBusComp = childBusComp.getAssocBusComp();
    childBusComp.activateField("City");
    childBusComp.clearToQuery();
    childBusComp.setSearchSpec("City", Vector_of_city[counter]);
    sBusComp.executeQuery2(true, true);
    if( sBusComp.firstRecord() )
    // Child already exist and do processing accordingly
    else
    // Child does not exist and do processing accordingly
    childBusComp.release();
    childBusComp = null;
    associatedChildBusComp.release();
    associatedChildBusComp=null;
    Now the issue with this code is: For the first iteration, SbusComp.firstRecord returns 0 if records does not exist. However from the second iteration, SbusComp.firstRecord returns 1 even if there is no record matching the search specification.
    Any input towards the issue is highly appreciable.
    Thanks,
    Rohit.

    Setting the view mode to "AllView" helped.
    Thanks for the lead!
    In the end, I also had to invoke the business component method SetAdminMode with "true" as the argument so that I could also modify the records from my script.

  • ADF Faces and BC: Scope problem with managed bean

    Hi,
    I am using JDev 10.1.3 and ADF Faces with ADF BC.
    I have created a managed bean which needs to interact with the binding layer and also receive actions from the web pages. I have a managed property on the bean which is defined as follows:
    <managed-bean>
        <managed-bean-name>navigator</managed-bean-name>
        <managed-bean-class>ecu.ethics.view.managed.Navigator</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
        <managed-property>
          <property-name>bindings</property-name>
          <value>#{bindings}</value>
        </managed-property>
      </managed-bean>I need the been to session scope because it needs to keep previous and next pages to navigate the user through their proposal. If i use session scope (as above) i get the following error when i click on a comand link which references a method in the above bean: #{navigator.forwardNext_action} which returns a global forward.
    this is the exception:
    javax.faces.FacesException: #{navigator.forwardNext_action}:
    javax.faces.el.EvaluationException: javax.faces.FacesException:
    javax.faces.FacesException: The scope of the referenced object: '#{bindings}' is shorter than the referring object     at
    com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:78)     at
    oracle.adf.view.faces.component.UIXCommand.broadcast(UIXCommand.java:211) at
    javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)at
    javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381)     at
    com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)     at
    com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)     
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)     at
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)how can i get around this?
    Brenden

    Hi pp,
    you need to create a managed (not backing) been set to session scope.
    You can call/reference the managed bean from your page.
    the backing bean is designed around a page lifecyle which is request oriented in it's design.
    This is a simple managed bean from faces-config.xml
    <managed-bean>
        <managed-bean-name>UserInfo</managed-bean-name>
        <managed-bean-class>ecu.ethics.admin.view.managed.UserInfo</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
          <managed-property>
          <property-name>bindings</property-name>
          <property-class>oracle.adf.model.BindingContext</property-class>
          <value>#{data}</value>
        </managed-property>
      </managed-bean>and the getters and setters for bindings in your session scope managed bean:
        public void setBindings(BindingContext bindings) {
            this._bindings = bindings;
        public BindingContext getBindings() {
            return _bindings;
        }you can access the model from the managed bean using the the BindingContext if needed.
    also have a look at JSFUtils from the ADF BC SRDemo application, there are methods in this class such as resolveExpression which demonstrate how to get the values of items on your page programatically using expression language. You can use this in your managed bean to get values from your pages.
    regards,
    Brenden

  • We had some accuracy issues with NI 5112 scope in one of the ATE and then I decided to perform self calibration using Labvidew vi to perform "niScope_CalSelfCalibrate(handle, "", 0);" function.

    We had some accuracy issues with NI 5112 scope in one of the ATE and then I decided to perform self calibration using Labvidew vi to perform “niScope_CalSelfCalibrate(handle, "", 0);” function.
    But it made it worse. I tried using option 2 to restore but it did not work.
    Could you pls advice me to resolve this issue.

    Hi Ana10,
    Are you using this digitizer with NI VideoMaster? if not you should probably post this in the Digitizer forums. That said I would suggest using the self calibrate function in MAX for this device rather than the LabVIEW API method just so that you can rule out any errors in correctly configuring the digitizer for self cal in LabVIEW. Also you should ensure that all inputs are disconnected before performing a self cal. If this still results in an error in calibration you could refer to the following document or arrange to return the digitizer to NI for external calibration.
    http://www.ni.com/pdf/manuals/370328e.pdf
    Hope this helps,
    Nick

  • Issue with showing input forms for update SQL statement

    Hi guys - I'm currently doing a college project and I'm not overly experienced in the area of Java/JSP but I'm having an issue with a project. I have a JSP project inserting, viewing and deleting rows from a database but having an issue getting the update/modify function working in my project.
    If I hardcode values into my variables and launch the project it updates fine, but I believe theres an issue with how I'm calling the existing rows. I wish for the user to be able to view the rows from the database and modify as they wish. Once they submit the modifications, I want the row to be updated. Can anyone see where the problem might exist in my code below? I hope it's something small, but I'm not able to fix it at the moment and would apreciate anyone's help! :)
    The problem I'm facing at the moment is the input boxes for displaying the current rows from the database are not even showing up..
    ModifyNode.jsp:
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <%@page import="suaspackage.NodeManager" %>
    <jsp:useBean id="AddNode" scope="session" class="suaspackage.NodeManager"/>
    <%@ page language="java" %>
    <%@ page import="java.sql.*" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>Suas</title>
        </head>
        <body
        <%! // Class level declarations
            Connection dbCon; // interface type in java SQL
            ResultSet rs; // interface type in java SQL
            String serverName = "localhost";
            String nodeID;
            String valowneremail;
            String valownersms;
            boolean bFirstTime;
            %>
            <%
            bFirstTime = true;
            if(request !=null){
                if(request.getParameter("submit") != null){
                    nodeID = "6";
                    valowneremail = request.getParameter("OwnerEmail");
                    valownersms = request.getParameter("OwnerSms");
                    bFirstTime = false;
                    AddNode.update(nodeID, valowneremail, valownersms);
            %>
            %>
        <%
            try{
            Class.forName("com.mysql.jdbc.Driver"); // SQLServer specifics 1
            dbCon = DriverManager.getConnection( // SQLServer specifics 2
                    "jdbc:mysql://" + serverName + ":3306" + "/suasdb", "root", "9631");
            Statement stmt;
            String sqlString = "select nodeid, node, owneremail, ownersms from nodemanager";
            stmt = dbCon.createStatement();
            rs = stmt.executeQuery(sqlString);
            } catch (ClassNotFoundException e){
                out.write("<B><CENTER><P>");
                out.write("Error loading class for Suas database connection: </P><P>");
                out.write(e.toString());
                out.write("</B></CENTER></P>");
                } catch (SQLException e){
                    out.write("<B><CENTER><P>");
                    out.write("Error accessing Suas database connection: </P><P>");
                    out.write("</B></CENTER></P>");
            if(rs!=null){
        %>
    <jsp:include page="includeheader.jsp" />
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><img src="images/pagemarker_nodemanager.jpg" alt="Node manager" width="176" height="55"></td>
        </tr>
      </table>
             <jsp:include page="includenodemenu.jsp" />
    <TABLE WIDTH="75% BORDER="0" CELLPADDING="5" ALIGN="CENTER">
    <TR BGCOLOR="#9ddc4f">    </TR>
    <br>
    <TR BGCOLOR="#9ddc4f">
      <TH>Node ID</TH>
      <TH>Node</TH>
      <TH>Owner E-Mail Address</TH>
      <TH>Owner SMS Number</TH>
      <TH></TH>
    </TR>
             <%  } else {
                %>
    <% while (rs.next()){
        %>
    <FORM>
    <TR BGCOLOR="#d7eabf">
        <TD><%=rs.getString("nodeid")%></TD>
        <TD><%=rs.getString("node")%></TD>
        <TD><INPUT size="20" type="text" name="OwnerEmail" value="<%=rs.getString("owneremail")%>"</TD>
        <TD><INPUT size="20" type="text" name="OwnerSms" value="<%=rs.getString("ownersms")%>"</TD>
        <TD><INPUT type="submit" name="submit" value="Save"></TD>
    </TR>
    <% }
        %>
        </body>
    </html>
    {code}
    The relevant part of my NodeManger package:
    {code}
        public void update(String updateNodeId, String valEmail, String valSMS) throws ClassNotFoundException, SQLException{
            try{
                String updateSQL;
                String nodeid = updateNodeId;
                String updateowneremail = valEmail;
                String updateownersms = valSMS;
                Connection dbCon;
                Statement stmt;
                ResultSet rs;
                String serverName = "localhost";
                Class.forName("com.mysql.jdbc.Driver"); // SQLServer specifics 1
                dbCon = DriverManager.getConnection( // SQLServer specifics 2
                 "jdbc:mysql://" + serverName + ":3306" + "/suasdb", "root", "9631");
                updateSQL = "update nodemanager SET owneremail='" + updateowneremail + "', ownersms='" + updateownersms + "' WHERE nodeid='" + nodeid + "'";
                stmt = dbCon.createStatement();
                stmt.execute(updateSQL);
            } catch (ClassNotFoundException e){
                throw(e);
            } catch (SQLException e){
                throw(e);
        }{code}
    Edited by: daveomcgee on Apr 9, 2009 8:03 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    I support what ThomYork suggests. Learn how to properly separate database/business logic from your view logic. Learn how to use servlets and JSPs together. Read abourt DAO classes. Learn how to build a view in JSPs using taglibs (JSTL to begin with).
    You might think it is too much work, but if you learn this stuff the wrong way now, it is going to be that much harder converting to the clean, readable, reusable and maintainable way later on.

  • How to change MANAGED-BEAN-SCOPE??????

    Hi Gurus,
    How to change the managed-bean-scope? In my ADF application I have created one backing bean which has attched with the page fragment. I cant able to set the bean scope other than REQUEST....
    If I set the bean scope request, then page and the inside fragment is rendering without any error. But I need to make that bean scope to pageFlow... but if I do, getting the below error. Non of the scopes are working except request... Please help me how to set the other scope which will solve my major development issue!!!!
    Error:
    Error trying to include:viewId:/advsearch-flow-definition/advUserSearch uri:/app/advUserSearch.jsffjavax.faces.FacesException: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'UserSearch' resolved to null
    My ADFC-Config.xml:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
    <managed-bean>
    <managed-bean-name>backing_app_idm</managed-bean-name>
    <managed-bean-class>edu.syr.oim.backing.app.Idm</managed-bean-class>
    <managed-bean-scope>backingBean</managed-bean-scope>
    <!--oracle-jdev-comment:managed-bean-jsp-link:1app/idm.jspx-->
    </managed-bean>
    <managed-bean>
    <managed-bean-name>backing_app_userMgmt</managed-bean-name>
    <managed-bean-class>edu.syr.oim.backing.app.UserMgmt</managed-bean-class>
    <managed-bean-scope>backingBean</managed-bean-scope>
    <!--oracle-jdev-comment:managed-bean-jsp-link:1app/userMgmt.jspx-->
    </managed-bean>
    *<managed-bean>*
    *<managed-bean-name>UserSearch</managed-bean-name>*
    *<managed-bean-class>edu.syr.oim.backing.app.UserSearch</managed-bean-class>*
    *<managed-bean-scope>request</managed-bean-scope>*
    *</managed-bean>*
    </adfc-config>
    -kln
    Edited by: klogube on Jan 14, 2010 7:23 AM

    *public class UserSearch {*
    private RichTable searchResultTable;
    private Row currentRow;
    private String selectedNetID;
    private RichInputText inputOne;
    private RichInputText inputTwo;
    private RichInputText inputThree;
    private RichSelectOneChoice choiceOne;
    private RichSelectOneChoice choiceTwo;
    private RichSelectOneChoice choiceThree;
    private RichRegion region;
    private String choiceOneVal;
    private String choiceTwoVal;
    private String choiceThreeVal;
    DCBindingContainer bindings;
    int choiceOneRowIndex;
    int choiceTwoRowIndex;
    int choiceThreeRowIndex;
    Row choiceOnerw;
    Row choiceTworw;
    Row choiceThreerw;
    String choiceOneUserSelected = null;
    String choiceTwoUserSelected = null;
    String choiceThreeUserSelected = null;
    static String  txnTypeOne  = null;
    static String  txnTypeTwo  = null;
    static String  txnTypeThree  = null;
    String netid;
    RequestContext requestContext = RequestContext.getCurrentInstance();
    HashMap rcBackupHM = new HashMap();
    FacesContext facesContext = FacesContext.getCurrentInstance();
    Application app = facesContext.getApplication();
    ExpressionFactory elFactory = app.getExpressionFactory();
    ELContext elContext = facesContext.getELContext();
    FacesContext fc = FacesContext.getCurrentInstance();
    HttpServletRequest request = (HttpServletRequest)fc.getExternalContext().getRequest();
    HttpSession session = request.getSession();
    *public UserSearch() {*
    *public String userSelected() {*
    FacesCtrlHierNodeBinding binding = (FacesCtrlHierNodeBinding) searchResultTable.getSelectedRowData();
    currentRow = binding.getRow();
    selectedNetID = (String) currentRow.getAttribute("netid");
    requestContext.getPageFlowScope().put("netid",selectedNetID);
    return "goToDetails";
    ** Invoke this method when user double click the row in searchResult*
    *public void doDbClick(ClientEvent clientEvent) {*
    FacesCtrlHierNodeBinding binding = (FacesCtrlHierNodeBinding) searchResultTable.getSelectedRowData();
    currentRow = binding.getRow();
    selectedNetID = (String) currentRow.getAttribute("netid");
    requestContext.getPageFlowScope().put("netid",selectedNetID);
    *try{*
    FacesContext facesCtx = FacesContext.getCurrentInstance();
    NavigationHandler nh = facesCtx.getApplication().getNavigationHandler();
    nh.handleNavigation(facesCtx, "", "goDetails");
    *// Refresh the current region; advse1 is the id of the region component inside jspx page*
    AdfFacesContext.getCurrentInstance().addPartialTarget(region);
    *catch(Exception e){ }*
    *public void setSearchResultTable(RichTable searchResultTable) {*
    this.searchResultTable = searchResultTable;
    *public RichTable getSearchResultTable() {*
    return searchResultTable;
    *public void setInputOne(RichInputText inputOne) {*
    this.inputOne = inputOne;
    *public RichInputText getInputOne() {*
    return inputOne;
    *public void setInputTwo(RichInputText inputTwo) {*
    this.inputTwo = inputTwo;
    *public RichInputText getInputTwo() {*
    return inputTwo;
    *public void setInputThree(RichInputText inputThree) {*
    this.inputThree = inputThree;
    *public RichInputText getInputThree() {*
    return inputThree;
    *public void setChoiceOne(RichSelectOneChoice choiceOne) {*
    this.choiceOne = choiceOne;
    *public RichSelectOneChoice getChoiceOne() {*
    return choiceOne;
    *public void setChoiceTwo(RichSelectOneChoice choiceTwo) {*
    this.choiceTwo = choiceTwo;
    *public RichSelectOneChoice getChoiceTwo() {*
    return choiceTwo;
    *public void setChoiceThree(RichSelectOneChoice choiceThree) {*
    this.choiceThree = choiceThree;
    *public RichSelectOneChoice getChoiceThree() {*
    return choiceThree;
    *public void setChoiceOneVal(String choiceOneVal) {*
    this.choiceOneVal = choiceOneVal;
    *public String getChoiceOneVal() {*
    return choiceOneVal;
    *public void setChoiceTwoVal(String choiceTwoVal) {*
    this.choiceTwoVal = choiceTwoVal;
    *public String getChoiceTwoVal() {*
    return choiceTwoVal;
    *public void setChoiceThreeVal(String choiceThreeVal) {*
    this.choiceThreeVal = choiceThreeVal;
    *public String getChoiceThreeVal() {*
    return choiceThreeVal;
    *public void setRegion(RichRegion region) {*
    this.region = region;
    *public RichRegion getRegion() {*
    return region;
    Can you please explain how to define the 2nd bean in the pageFlowScope and injnect?...bacially my problem is I am loosing the pageFlowScope value when I navigate from first page to next page which I am setting by this above class....I need to carry forward the netid which I am losing ...any idea plz

  • Issue with addPartialTarget method (Pop-up window)

    Hi, I am facing an issue with addPartialTarget method (pop-up window case). Please refer the thread Re: popup dialog problem
    If we are using addPartialTarget method, should the managed bean be in session scope? I've set it is in request scope. It works fine with 1 user. But if we test with more than 1 user using HP mercury load runner, it is failing and giving the following exception related to partial target. What should be the solution for this issue? This is very urgent. Even after setting the managed bean in session scope, I am getting the same error as shown below:
    java.lang.ArrayIndexOutOfBoundsException: -1
    at java.util.ArrayList.get(Unknown Source)
    at oracle.adfinternal.view.faces.renderkit.core.ppr.PPRResponseWriter._popPartialTarget(PPRResponseWriter.java:223)
    at oracle.adfinternal.view.faces.renderkit.core.ppr.PPRResponseWriter.endElement(PPRResponseWriter.java:138)
    at oracle.adfinternal.view.faces.ui.ElementRenderer.postrender(ElementRenderer.java:81)
    at oracle.adfinternal.view.faces.ui.laf.base.xhtml.XhtmlLafRenderer.postrender(XhtmlLafRenderer.java:225)
    at oracle.adfinternal.view.faces.ui.BaseRenderer.render(BaseRenderer.java:83)
    at oracle.adfinternal.view.faces.ui.laf.base.xhtml.XhtmlLafRenderer.render(XhtmlLafRenderer.java:69)
    at oracle.adfinternal.view.faces.ui.BaseUINode.render(BaseUINode.java:346)
    at oracle.adfinternal.view.faces.ui.BaseUINode.render(BaseUINode.java:301)
    at oracle.adfinternal.view.faces.ui.composite.UINodeRenderer.renderWithNode(UINodeRenderer.java:90)
    at oracle.adfinternal.view.faces.ui.composite.UINodeRenderer.render(UINodeRenderer.java:36)
    at oracle.adfinternal.view.faces.uinode.UIXComponentUINode.renderInternal(UIXComponentUINode.java:177)
    at oracle.adfinternal.view.faces.uinode.UINodeRendererBase.encodeEnd(UINodeRendererBase.java:53)
    at oracle.adf.view.faces.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:624)
    at oracle.adfinternal.view.faces.renderkit.RenderUtils.encodeRecursive(RenderUtils.java:54)
    at oracle.adfinternal.view.faces.renderkit.core.CoreRenderer.encodeChild(CoreRenderer.java:242)
    at oracle.adfinternal.view.faces.renderkit.core.CoreRenderer.encodeAllChildren(CoreRenderer.java:265)
    at oracle.adfinternal.view.faces.renderkit.core.xhtml.PanelPartialRootRenderer.renderContent(PanelPartialRootRenderer.java:65)
    at oracle.adfinternal.view.faces.renderkit.core.xhtml.BodyRenderer.renderContent(BodyRenderer.java:117)
    at oracle.adfinternal.view.faces.renderkit.core.xhtml.PanelPartialRootRenderer.encodeAll(PanelPartialRootRenderer.java:102)
    at oracle.adfinternal.view.faces.renderkit.core.xhtml.BodyRenderer.encodeAll(BodyRenderer.java:60)
    at oracle.adfinternal.view.faces.renderkit.core.CoreRenderer.delegateRenderer(CoreRenderer.java:281)
    at oracle.adfinternal.view.faces.renderkit.core.xhtml.DocumentRenderer.encodeAll(DocumentRenderer.java:60)
    at oracle.adfinternal.view.faces.renderkit.core.CoreRenderer.encodeEnd(CoreRenderer.java:169)
    at oracle.adf.view.faces.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:624)
    at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:645)
    at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:568)
    at oracle.adf.view.faces.webapp.UIXComponentTag.doEndTag(UIXComponentTag.java:100)
    at app.App__cusadd_jspx._jspService(_App__cusadd_jspx.java:3274)
    at com.orionserverhttp://Oracle Containers for J2EE 10g (10.1.3.3.0) .http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at com.evermindhttp://Oracle Containers for J2EE 10g (10.1.3.3.0) .server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:162)
    at com.evermindhttp://Oracle Containers for J2EE 10g (10.1.3.3.0) .server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:623)
    at com.evermindhttp://Oracle Containers for J2EE 10g (10.1.3.3.0) .server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
    at com.evermindhttp://Oracle Containers for J2EE 10g (10.1.3.3.0) .server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:287)
    at com.evermindhttp://Oracle Containers for J2EE 10g (10.1.3.3.0) .server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:51)
    at com.evermindhttp://Oracle Containers for J2EE 10g (10.1.3.3.0) .server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:193)
    at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:283)
    at com.evermindhttp://Oracle Containers for J2EE 10g (10.1.3.3.0) .server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:198)
    at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:346)
    at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:152)
    at oracle.adfinternal.view.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:157)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:214)
    at com.evermindhttp://Oracle Containers for J2EE 10g (10.1.3.3.0) .server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
    at oracle.webcache.adf.filter.PageCachingFilter.doFilter(PageCachingFilter.java:274)
    at com.evermindhttp://Oracle Containers for J2EE 10g (10.1.3.3.0) .server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
    at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:228)
    at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:197)
    at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:123)
    at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:103)
    at com.evermindhttp://Oracle Containers for J2EE 10g (10.1.3.3.0) .server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:162)
    at com.evermindhttp://Oracle Containers for J2EE 10g (10.1.3.3.0) .server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:162)
    at com.evermindhttp://Oracle Containers for J2EE 10g (10.1.3.3.0) .server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
    at com.evermindhttp://Oracle Containers for J2EE 10g (10.1.3.3.0) .server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
    at com.evermindhttp://Oracle Containers for J2EE 10g (10.1.3.3.0) .server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
    at com.evermindhttp://Oracle Containers for J2EE 10g (10.1.3.3.0) .server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
    at com.evermindhttp://Oracle Containers for J2EE 10g (10.1.3.3.0) .server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
    at com.evermindhttp://Oracle Containers for J2EE 10g (10.1.3.3.0) .server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
    at com.evermindhttp://Oracle Containers for J2EE 10g (10.1.3.3.0) .server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
    at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
    at com.evermindhttp://Oracle Containers for J2EE 10g (10.1.3.3.0) .util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
    at java.lang.Thread.run(Unknown Source)

    duplicate
    Frank

  • Issue with h:selectManyListBox - java.util.NoSuchElementException

    I facing an issue with <h:selectManyListBoxs in JSF 1.1 with portlets.
    I am using RAD 7.5.3 and server is Web sphere Portal v6.1 Server on WAS 7.
    I have two <h:selectManyListbox moving options from Left to Right which i am doing in Javascript and it is perectly working fine.
    For the right hand side list box i have an additional movement for up and down which i am doing in javascript and it is working fine.
    Now the issue when I move from left to right and click on Save it is working fine. when I try to touch/select the options
    in right hand side list box and click on save i am getting NoSuchElementException in the processValidation phase as shown below.
    (It is not calling the save function at all in this case, it just calling the getLinkedBenchmarks method and failing).
    I added the attribute as immediate= true and the exception is comming now in APPLY_REQUEST phase.
    JSF1054: (Phase ID: PROCESS_VALIDATIONS 3, View ID: /jsp/Test.jsp) Exception thrown during phase execution:
    javax.faces.event.PhaseEvent[source=com.sun.faces.lifecycle.LifecycleImpl@32fc32fc]
    Caused by: javax.portlet.PortletException
         at com.ibm.faces.portlet.FacesPortlet.processAction(FacesPortlet.java:199)
         at com.ibm.ws.portletcontainer.invoker.impl.PortletFilterChainImpl.doFilter(PortletFilterChainImpl.java:77)
         at com.ibm.wps.propertybroker.standard.filter.PropertyBrokerActionFilter.doFilter(PropertyBrokerActionFilter.java:731)
    Caused by: java.util.NoSuchElementException
         at javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:128)
         at javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:175)
         at javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:60)
         at javax.faces.component.UISelectMany.matchValue(UISelectMany.java:497)
         at javax.faces.component.UISelectMany.validateValue(UISelectMany.java:466)
         at javax.faces.component.UIInput.validate(UIInput.java:875)
         at javax.faces.component.UIInput.executeValidate(UIInput.java:1072)
         at javax.faces.component.UIInput.processValidators(UIInput.java:672)
         at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1047)
         at javax.faces.component.UIForm.processValidators(UIForm.java:235)
         at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1047)
         at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1047)
         at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:673)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.access$201(AjaxViewRoot.java:53)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot$3.invokeRoot(AjaxViewRoot.java:315)
         at org.ajax4jsf.framework.ajax.JsfOneOneInvoker.invokeOnRegionOrRoot(JsfOneOneInvoker.java:53)
         at org.ajax4jsf.framework.ajax.AjaxContext.invokeOnRegionOrRoot(AjaxContext.java:191)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.processValidators(AjaxViewRoot.java:329)
         at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
         at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
         at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
         at com.ibm.faces.portlet.FacesPortlet.processAction(FacesPortlet.java:189)
         ... 118 more
      JSP code: I tried to add value for the <h:selectManyList it only allowing to add String not Arrays it displays the following warning
    message "Cannot coerce type String[] to java.lang.String"
    <h:selectManyListbox  size="10" id="availableBMId" converter="com.Converter"
         binding="#{lookup.components.availableBMId}" >
         <f:selectItems
              value="#{themeAttributeBean.availableBMs}" />
    </h:selectManyListbox></td>
    <td style="vertical-align: middle;">
    <div id="benchmark_button1" align="center"><hx:graphicImageEx
         id="Benchmark_AllRight" url="/images/AllRight.gif" height="16"
         hspace="2" style="cursor: hand" width="16" title="All Right"
         onclick="return listbox_moveall('#{lookup.clientIds.availableBMId}', '#{lookup.clientIds.linkedBMId}');">
    </hx:graphicImageEx> <br>
    <br>
    <hx:graphicImageEx id="Benchmark_Right" url="/images/Right.gif"
         height="16" hspace="2" style="cursor: hand" width="16" title="Right"                                                  
         onclick="return listbox_moveacross('#{lookup.clientIds.availableBMId}', '#{lookup.clientIds.linkedBMId}');">
    </hx:graphicImageEx> <br>
    <br>
    <hx:graphicImageEx id="Benchmark_Left" url="/images/Left.gif" title="Left"
         height="16" hspace="2" style="cursor: hand" width="16"                                                  
         onclick="return listbox_moveacross('#{lookup.clientIds.linkedBMId}', '#{lookup.clientIds.availableBMId}');">
    </hx:graphicImageEx> <br>
    <br>
    <hx:graphicImageEx id="Benchmark_AllLeft" title="All Left"
         url="/images/AllLeft.gif" height="16" hspace="2"
         style="cursor: hand" width="16"                                             
         onclick="return listbox_moveall('#{lookup.clientIds.linkedBMd}', '#{lookup.clientIds.availableBMId}');">
    </hx:graphicImageEx></div>
    </td>
    <td valign="top">
    <h:selectManyListbox size="10"
         id="linkedBenchmarksId" converter="com.TAPConverter"
         binding="#{lookup.components.linkedBMId}">
         <f:selectItems value="#{themeAttributeBean.linkedBMs}" />
    </h:selectManyListbox></td>
    <td style="vertical-align: middle;">
    <div id="benchmark_button2" align="center">
    <hx:graphicImageEx id="benchmark_up" url="/images/Up.gif" title="Up"
         height="16" hspace="2" style="cursor: hand" width="16"                                                  
         onclick="movePageUp('#{lookup.clientIds.linkedBMId}');"></hx:graphicImageEx>
    <br>
    <hx:graphicImageEx id="benchmark_down" url="/images/Down.gif" title="Down"
         height="16" hspace="2" style="cursor: hand" width="16"                                                  
         onclick="movePageDown('#{lookup.clientIds.linkedBMId}');"></hx:graphicImageEx>
    <br></div>
    *getting teh javascript values in a hiddend value:*
    <h:inputHidden id="hiddenLinkedBms"
    binding="#{lookup.components.hiddenLinkedBenchmarks}" value="#{bean.hiddenLinkedBms}" />
    *Backing Bean code:*
    public Map<String, Index> getAvailableBenchmarks() {
         availableBM = dao.getAllBM();
         if (themeID.intValue() > 0) {          
              linkedBM = dao.getLinkedBenchmarks(themeID.intValue());
              System.out.println("Linked Bench marks in getAvailableBM.. " + linkedBM);
              removeKeys(availableBM, linkedBM);
         return availableBM;
    public Map<String, Index> getLinkedBM() {
         linkedBenchmarks = dao.getLinkedBM(id);
         return linkedBM;
    Additional info:
         I override the equals and hashcode method in the Object class as suggested on the internet.
         I added the Custom converter by implementing javax.faces.convert.Converter and
         @Override
         public String getAsString(FacesContext arg0, UIComponent arg1, Object obj) {
              if(obj == null){
                   return null;
              } else if(obj instanceof Index){
                   final TAPIndex index = (Index) obj;
                   return index.getIndexName().toString();
              } else if(obj instanceof Objective){     
                   final InvestmentObjective invest = (Objective) obj;
                   return invest.getDescription()+" (" + invest.getCode() + ")".toString();
              return obj.toString();
         @Override
         public Object getAsObject(FacesContext arg0, UIComponent arg1, String value) {
                   return value;
    I have no Idea why it is behaving like this. Please help me.Edited by: Joglekar on Sep 17, 2010 10:17 AM

    Here is the proof - Let me know if am doing any thing wrong! FYI, I used JSF portlets in RAD 7.5.3 and Websphere portal server v6.1.
    I have two SelectManyListBox components and moving the options from left to right using Javascript and then select one of the options in the right hand side list box and click on submit. You will see the NosuchElementException.
    I don't have any logic inside my bean class in any of the methods.
    My Test JSP
    <%-- jsf:pagecode language="java" location="/.apt_generated/com/jsp/TestJSP.java" --%><%-- /jsf:pagecode --%><%@taglib
         uri="http://java.sun.com/portlet" prefix="portlet"%><%@taglib
         uri="http://www.ibm.com/jsf/html_extended" prefix="hx"%><%@taglib
         uri="http://java.sun.com/jsf/core" prefix="f"%><%@taglib
         uri="http://java.sun.com/jsf/html" prefix="h"%><%@page language="java"
         contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" session="false"%><portlet:defineObjects />
    <f:view>
    <script language="javascript">
    function listbox_moveall(sourceID, destID) {
         var src = document.getElementById(sourceID); var dest = document.getElementById(destID);
         for(var count=0; count < src.length; count++) {
              var option = src[count];
              try {
                   dest.add(new Option(option.text, option.text), null); //Standard
                   src.remove(count, null);
              } catch(error) {
                   dest.add(new Option(option.text, option.text)); // IE only
                   src.remove(count);
              } count--;
         } return true;
    function listbox_moveacross(sourceID, destID) {
         var src = document.getElementById(sourceID); var dest = document.getElementById(destID);
         var selectedIndex = src.selectedIndex;
         if(selectedIndex == -1){
              alert("Please select to move");
         for(var count=0; count < src.length; count++) {
              if(src[count].selected == true) {
                   var option = src[count];
                   try {
                        dest.add(new Option(option.text, option.value), null); //Standard
                        src.remove(count, null);
                   } catch(error) {
                        dest.add(new Option(option.text, option.value)); // IE only
                        src.remove(count);
                   }  count--;               
    </script>
    <hx:scriptCollector id="scriptCollector1">
         <h:form styleClass="form" id="form1" prependId="false">
         <table BORDER="0" CELLPADDING="1" CELLSPACING="0" bgcolor="eeeeee">
              <tbody>
                   <tr> <td colspan="3"><b>TAP Investment Objectives</b></td> </tr>
                   <tr> <td bgcolor="#bfbfbf"><b>Available List</b></td>      <td width="65"></td>
                        <td bgcolor="#bfbfbf"><b>Linked List </b></td> </tr>
                   <tr><td valign="top">
         <h:selectManyListbox size="10" styleClass="selectManyListbox" id="listbox1">
                   <f:selectItems value="#{selectitems.testJSP.availableBMs.availableBMs.toArray}" id="selectItems2" />
         </h:selectManyListbox></td>
         <td style="vertical-align: middle;"> <div id="objective_button" align="center">
         <hx:graphicImageEx url="/images/AllRight.gif" title="All Right" height="16" hspace="2" width="16"
         onclick="return listbox_moveall('listbox1', 'listbox2');"></hx:graphicImageEx>      <br> </div> </td>
         <td valign="top">
              <h:selectManyListbox size="10" styleClass="selectManyListbox" id="listbox2" >
                   <f:selectItems value="#{selectitems.testJSP.linkedBMs.linkedBMs.toArray}" id="selectItems1" />
              </h:selectManyListbox>
         </td>
              </tr>
              </tbody>
         </table>
         <hx:commandExButton type="submit" value="Submit"
              styleClass="commandExButton" id="button1" action="#{testJSP.save}"></hx:commandExButton>
         </h:form>
    </hx:scriptCollector>
    </f:view>My Backing Bean Class
    package com.jpmorganchase.tap.ui.bean;
    import java.util.ArrayList;
    import java.util.List;
    import javax.faces.component.UIComponent;
    import javax.faces.event.ActionEvent;
    public class TestUIJSP {
         private List<String> availableBMs;
         private List<String> linkedBMs;
         private UIComponent selectedBindingBMs;
         public UIComponent getSelectedBindingBMs() {
              System.out.println("getSelectedBindingBMs .. " + selectedBindingBMs);
              return selectedBindingBMs;
         public void setSelectedBindingBMs(UIComponent selectedBindingBMs) {
              this.selectedBindingBMs = selectedBindingBMs;
         public TestUIJSP(){
              System.out.println("inside constructor...............");
              availableBMs = new ArrayList<String>();
              availableBMs.add("Venkat");
              availableBMs.add("Narayana");
              availableBMs.add("Joglekar");
              linkedBMs = new ArrayList<String>();
         public List<String> getAvailableBMs() {
              return availableBMs;
         public void setAvailableBMs(List<String> availableBMs) {
              this.availableBMs = availableBMs;
         public List<String> getLinkedBMs() {
              return linkedBMs;
         public void setLinkedBMs(List<String> linkedBMs) {
              this.linkedBMs = linkedBMs;
         public String save(){
              System.out.println("save availableBMs........." + availableBMs);
              System.out.println("save linkedBMs........." + linkedBMs);
              return null;
         public void moveAllLeftToRight(ActionEvent evt){
              System.out.println("availableBMs.." + availableBMs);
              linkedBMs.addAll(availableBMs);
              System.out.println("LinkedBM's");
              availableBMs.clear();
         public void moveLeftToRight(ActionEvent evt){
              System.out.println("availableBMs.." + availableBMs);
    }MyFaces Config.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN" "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
    <faces-config>
         <application>
              <state-manager>com.ibm.faces.application.DevelopmentStateManager</state-manager>
              <property-resolver>com.ibm.faces.databind.SelectItemsPropResolver</property-resolver>
              <variable-resolver>com.ibm.faces.databind.SelectItemsVarResolver</variable-resolver>
              <variable-resolver>com.ibm.faces.portlet.PortletVariableResolver</variable-resolver>
              <locale-config><supported-locale>en</supported-locale></locale-config>
              <message-bundle>com.PortletResource</message-bundle>
         </application>
         <factory><faces-context-factory>com.ibm.faces.context.AjaxFacesContextFactory</faces-context-factory>
              <render-kit-factory>com.ibm.faces.renderkit.AjaxRenderKitFactory</render-kit-factory></factory>
         <managed-bean>
                <managed-bean-name>pc_TestJSP</managed-bean-name><managed-bean-class>com.jsp.TestJSP</managed-bean-class>
                   <managed-bean-scope>session</managed-bean-scope>
              </managed-bean><managed-bean>
              <managed-bean-name>testJSP</managed-bean-name><managed-bean-class>com.bean.TestUIJSP</managed-bean-class>
                   <managed-bean-scope>session</managed-bean-scope></managed-bean>
         <lifecycle>     <phase-listener>com.ibm.faces.webapp.ValueResourcePhaseListener</phase-listener></lifecycle>
    </faces-config>
    My Protlet.xml<?xml version="1.0" encoding="UTF-8"?>
    <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" version="1.0" id="com.ibm.faces.portlet.FacesPortlet.c8eddc2f92">
         <portlet>
              <portlet-name>TestProject</portlet-name>
              <portlet-class>com.ibm.faces.portlet.FacesPortlet</portlet-class>
              <init-param><name>com.ibm.faces.portlet.page.view</name><value>/jsp/testJSP.jsp</value></init-param>
              <init-param><name>wps.markup</name><value>html</value></init-param>
              <expiration-cache>0</expiration-cache>
              <supports><mime-type>text/html</mime-type><portlet-mode>view</portlet-mode></supports>
              <supported-locale>en</supported-locale><resource-bundle>com.PortletResource</resource-bundle>
         </portlet>
    </portlet-app>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

  • Create jsp/bean webapp deploy fine...  add JSTL library wont deploy!

    winxp
    SJSE8
    PROBLEM:
    Using the new project wizard, I create a simple jsp/bean webapp using the embedded tomcat 5.5.7 as server... It deploys and runs with now issue
    Then, I right-click on project name (in project tree)... click properties... add library... select "JSTL 1.1".... do clean/build.... do deploy - which fails!
    message is: "Failed to deploy application at context path /bcd" (where bcd is my project name)
    Why does this happen?
    --------------simple app---------------
    ***jsp1.jsp****
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>JSP Page</title>
        </head>
        <body>
        <h1>JSP Page</h1>
        <h1>get stuff JSP Page</h1>
        <jsp:useBean id="a" class="bcdpkg.IndexBean" scope="request"/>
        <h3>after1...</h3>
        <!--jsp:setProperty name="a" property="stuff" value="xxx" /-->
        <jsp:getProperty name="a" property="stuff" />
        </body>
    </html>***IndexBean.java***
    package bcdpkg;
    public class IndexBean
        /** Creates a new instance of IndexBean */
        public IndexBean()
        private String stuff = "this is stuff";
        public String getStuff()
            return this.stuff;
        public void setStuff(String s)
            this.stuff = s;
    }

    well.... I restarted SJSE8 (and tomcat 5.5.7) and now I can right-click on the project and click deploy...successfully.
    (Apologies for the "hair trigger" posting)
    I'll reply once more if it happens again.
    thanx

Maybe you are looking for