Datatable categorization refresh

Hi All,
I have a datatable which generates the hierarchy as shown in attachment.The table is populated from an ArrayList which has an object of type Publication.
Class Publication
   String category = null;
   String subcategory = null;
}Category Subcategory Topic
Focus Reports sub1 topic1
Focus Reports sub1 topic2
Focus Reports sub3 topic3
Risk Perception Natural Catastrophes topic4
The tree structure is obtained by having one rowcategory on category and second on subcategory. The problem is when i add a new Publication to the array list with Category as "Focus Reports" and Subcategory as "sub1"
table gets refreshed but always adds the new entry at end..that is at "Risk Perception---> Natural catastrophes" instead at "Focus Reports--->sub1". Ichecked the object tostring and looks propers.. i am not able to figure out the reason.. why isn't the categorization working properly.. does the order of objects in the list mater..
Please suggest how can i refresh the datatable correctly.
Thanks in advance

I'll try to explain better......
I have a dynamic Table created, with dynamic columns...
and it is working well...
but when I change a combo, and submit, I clear the columns of table, and add other new columns, dynamically....
but, the page is equal before, and when I refresh the page again, it works and the correct columns are displayed.....
How I force table to be displayed correctly at first time?????
anyone?
thanks

Similar Messages

  • Refreshing specific cell in dataTable?

    Hi
    How do I get a dataTable to re-render a specific cell? As an example, consider Bean listed below. Initially, the dataTable displays the values as iterated over Bean.lines. Later in response to a user action (see Bean.updateLine), I'd like the appropriate cell in the dataTable to be refreshed (without of course having to press a 'Refresh' button).
    How do I achieve this with dataTable?
    public class Bean {
      private List<Line> lines = new ArrayList<Line>();
      public List<Line> getLines() {
        return lines;
      // called (in response to a user action for example) to refresh a specific line value
      public void updateLine() {
        lines.get(0).setVal("some new value");
      public class Line {
        private final String id;
        private String val;
        private Line(String id) {
          this.id = id;
        public String getId() {
          return id;
        // calling this must trigger the dataTable to refresh the appropriate cell (ideally)
        // or else the entire dataTable in the browser
        public void setVal(String val) {
          this.val = val;
        public void getVal() {
          return val;
      } // Line
            <h:dataTable value="#{bean.lines}" var="line">
              <h:column>
                <h:outputText value="#{line.id}"/>
              </h:column>
              <h:column>
                <h:outputText value="#{line.val}"/>
              </h:column>
            </h:dataTable>Help much appreciated
    Lance

    Thanks, AJAX is doing the trick nicely.
    For the benefit of a future question, I'm using onclick="doSomething()" on a component within the table (a selectBooleanCheckbox in my case).
    Main JavaScript / AJAX:
          <script type="text/javascript">
            function doSomething(elementId) {
              var rowNum = elementId.split(":")[2]; // position in table
              var someId = document.getElementById("form_id:table_id:" +
                                                  rowNum + ":textbox_id").innerHTML;
              var url = "handler?cmd=MY_SERVLET_CMD" + // handler points to HandlerServlet
                                "&some_id=" + encodeURIComponent(someId) +
                                "&row_num=" + encodeURIComponent(rowNum);
              if (typeof XMLHttpRequest != "undefined") {
                req = new XMLHttpRequest(); // AJAX
              } else if (window.ActiveXObject) {
                req = new ActiveXObject("Microsoft.XMLHTTP");
              } else {
                alert("Browser not supported!");
              req.open("GET", url, true); // true = asynchronous AJAX call
              req.onreadystatechange = doSomethingCallback; // only if asynchronous
              req.send(null);
          </script>Callback function (invoked on return from the servlet - see reference in doSomething above):
          <script type="text/javascript">
            function doSomethingCallback() {
              if (req.readyState == 4) { // checks are needed else we react before response is complete
                if (req.status == 200) { // see comment above
                  var prefix = "form_id:table_id:";
                  var suffix = ":checkbox_id"; // we want to update all check boxes - see below
                  var msg = req.responseXML.getElementsByTagName("message")[0];
                  var lineCount = msg.getElementsByTagName("line_count")[0].childNodes[0].nodeValue;
                  var rowNum = msg.getElementsByTagName("row_num")[0].childNodes[0].nodeValue;
                  var checkAll =
                    document.getElementById(prefix + rowNum + ":check_all_id"); // another check box that determines state of check boxes below
                  var lineCheckId = ""; // line checkbox element
                  for (var i = rowNum, n = parseInt(rowNum) +
                                                  parseInt(lineCount); i < n; i++) {
                    lineCheckId = prefix + i + suffix;
                    document.getElementById(lineCheckId).checked = checkAll.checked; // update the DOM
                } // status
              } // readyState
          </script>

  • DataTable Refresh issue

    I have two datatables on a single JSF page.
    A Master /slave model
    page
    DATA TABLE A
    DATA TABLE B
    DataTable A
    Row 1
    Row 2
    Row n
    When I click on Row1 DataTable B is populated with rows corresponding to Row 1
    But the problem is when I sort DataTable A using some column; DataTable B's content is vanished..
    How can i avoid wholoe page being reloaded/refreshed?
    thanks
    Satish
    Boston

    probably datatable b is populated by a request scoped bean?
    some code fragments would be useful...

  • Refresh dataTable for Search function

    Hi,
    I have a page that contains a dataTable and search function for the dataTable. Basically once i clicked into that page it will display the current day records for me. At the below of the dataTable, it have a search function. So once i click the search button with my search criteria, how i refresh my dataTable to display the records?
    My dataTable already bind with the current day
    <h:dataTable id="outbound" value="#{Outbound.current}" var="sms" bgcolor="#F1F1F1" border="1" cellpadding="0" cellspacing="0" first="0" rows="10" width="100%" columnClasses="outcol1,outcol2,outcol3">
                                        <h:column>
                                            <f:facet name="header">
                                                <h:outputText value="Date-In" />
                                            </f:facet>
                                             <h:outputText value="#{sms.datein}" /> 
                                        </h:column>
                                        <h:column>
                                            <f:facet name="header">
                                                <h:outputText value="SMS Date" />
                                            </f:facet>
                                             <h:outputText value="#{sms.smsdate}" /> 
                                        </h:column>
                                        <h:column>
                                            <f:facet name="header">
                                                <h:outputText value="Del Date" />
                                            </f:facet>
                                             <h:outputText value="#{sms.dndate}" /> 
                                        </h:column>
                                        <h:column>
    </h:dataTable>So how to refresh the dataTable? Unless I do a rebind where I have one dataTable is for current day and another one is for search?
    Thanks.

    adrianclw wrote:
    Yup. I would like to re-render my dataTable after i clicked Search button. So the dataTable will display my search result.
    So existing dataTable unable to do it? Currently I'm using Apache Tomahawk for my dataTable.
    If you want to re-render the datatable without submitting the page, you will have to use Ajax. If you can allow submitting of page, then just change(refresh) the list in the backing bean that you have value-bound to the h:datatable in jsp.
    Another thing, I'm not sure i'm doing it correct or not. Now my dataTable is bind with the getCurrentDay function. So can i re-render it? Will it re-render and getting the same output since it already tied with current day function.
    See the above comment.

  • Can not refresh data int the report...

    Application on C#.
    Steps:
    1. Get Report without data from the database
    2. Change the dataconnections in report to the current user
    3. refresh data on the report (FilePath = TempFilePath)
    4. Resave report file with data
    5. Automatically open CrystalReportsViewer2008 and load the report
    Result
    On developer machine is allright, but on the user machine data isn't refreshed. Therefore CrysrtalReportsViewer2008 can't open report. It say that check the SaveDatawithReport parameter.
    In process  I found that in temp directory on user pc, didn't creates some temprorary files which creates on developer PC. Why? Help me please.
    Sorry for my English.

    There is the code of my programm
    function ParseReport is refreshed the data and change dataconnections for current user
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Data.SqlClient;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using System.IO;
    using System.Diagnostics;
    using CRApp;
    using Microsoft.Win32;
    namespace CRApp
         * u041Au043Bu0430u0441u0441 u0434u043Bu044F u0430u0432u0442u043Eu043Cu0430u0442u0438u0437u0438u0440u043Eu0432u0430u043Du043Du043Eu0433u043E u0432u0438u0437u0443u0430u043Bu044Cu043Du043Eu0433u043E u0434u043Eu0441u0442u0443u043Fu0430
         * u043A u0444u0430u0439u043Bu0430u043C u0448u0430u0431u043Bu043Eu043Du043Eu0432, u0441u0433u0435u043Du0435u0440u0438u0440u043Eu0432u0430u043Du043Du044Bu0445 u0432
         * u043Fu0440u043Eu0433u0440u0430u043Cu043Cu0435 Crystal Reports
        public partial class Export2CR_MForm : Form
            public Export2CR_MForm()
                InitializeComponent();
                Start();
            public void Start()
                LoginForm Login = new LoginForm();
                DialogResult Dres = Login.ShowDialog();
                if (Dres == DialogResult.OK)
                    if (Login.GetConStr().ToString() != "")
                        GetReportNamesFromDataBase(Login.GetConStr());
                        SetConnectionString(Login.GetConStr());
                        this.CenterToScreen();
                        Visible = true;
                        Login.Close();
                else
                    Login.Close();
                    this.CenterToScreen();
                    this.OnClosed(null);
                 * u041Fu043Eu043Bu0443u0447u0430u0435u043C u043Fu0443u0442u044C u043A u0432u0440u0435u043Cu0435u043Du043Du044Bu043C u0444u0430u0439u043Bu0430u043C
                TempFilePath = Path.GetTempPath();
             * u041Au0440u0438u0441u0442u0430u043Bu043Eu0432u0441u043Au0438u0439 u0432u044Cu044Eu0432u0435u0440u043Eu043A
            CrystalDecisions.Windows.Forms.CrystalReportViewer viewer;
             * u041Fu0443u0442u044C u043A u0432u0440u0435u043Cu0435u043Du043Du043Eu0439 u043Fu0430u043Fu043Au0435
            private string TempFilePath;
             * u041Fu0430u0440u0430u043Cu0435u0442u0440 u0437u0430u043Fu0438u0441u0438 u0432 u0440u0435u0436u0438u043Cu0435, u0442u0430u0431u043Bu0438u0446u0435 (u0438u0442u0434...)
             * u041Du0443u0436u0435u043D u0434u043Bu044F u0442u043Eu0433u043E u0447u0442u043Eu0431u044B u0432u044Bu0431u0438u0440u0430u0442u044C
             * u043Eu043Fu0435u0440u0435u0434u043Bu0451u043Du043Du044Bu0439 u0434u0430u0442u0430u0441u0435u0442, u0441u043Eu043Eu0442u0432u0435u0442u0441u0442u0432u0443u044Eu0449u0438u0439 u0432u044Bu0431u0440u0430u043Du043Du043Eu0439 u0437u0430u043Fu0438u0441u0438
            private int ObjectIDOfTemplate;
             * u0423u0441u0442u0430u043Du043Eu0432u043Au0430 u0437u043Du0430u0447u0435u043Du0438u044F ObjectIDOfTemplate
            public void SetObjectIDOfTemplate(int /*
                                                   * ObjectID u0442u043Eu0433u043E u0448u0430u0431u043Bu043Eu043Du0430,
                                                   * u043Au043Eu0442u043Eu0440u044Bu0439 u043Du0430u0434u043E u043Fu043Eu043Bu0443u0447u0438u0442u044C
                                                      EnternalObjectID)
                ObjectIDOfTemplate = EnternalObjectID;
             * u041Fu043Eu043Bu0443u0447u0438u0442u044C ObjectID u0448u0430u0431u043Bu043Eu043Du0430
             * u0441 u043Au043Eu0442u043Eu0440u044Bu043C u0440u0430u0431u043Eu0442u0430u043Bu0438 u0434u043Bu044F
             * u0438u0441u043Fu043Eu043Bu044Cu0437u043Eu0432u0430u043Du0438u044F u0435u0433u043E u0432u043Du0435 u0431u0438u0431u043Bu0438u043Eu0442u0435u043Au0438
            public int GetObjectIDOfTemplate()
                return ObjectIDOfTemplate;
             * u041Fu0443u0442u044C u043A u0432u044Bu043Fu043Bu044Eu043Du0443u0442u043Eu043Cu0443 u0444u0430u0439u043Bu0443
            private string TemplateFilePath;
             * u0423u0441u0442u0430u043Du043Eu0432u0438u0442u044C u043Fu0443u0442u044C u043A
             * u0432u044Bu043Fu043Bu044Eu043Du0443u0442u043Eu043Cu0443 u0444u0430u0439u043Bu0443
            public void SetTemplateFilePath(string In)
                TemplateFilePath = In;
             * u041Fu043Eu043Bu0443u0447u0438u0442u044C u043Fu0443u0442u044C u043A
             * u0432u044Bu043Fu043Bu044Eu043Du0443u0442u043Eu043Cu0443 u0444u0430u0439u043Bu0443
            public string GetTemplateFilePath()
                return TemplateFilePath;
             * u0424u0443u043Du043Au0446u0438u044F u043Eu0442u043Au0440u044Bu0442u0438u044F u0444u0430u0439u043Bu0430,
             * u043Fu043Eu043Bu0443u0447u0435u043Du043Du043Eu0433u043E u0438u0437 u0431u0430u0437u044B u0438
             * u043Fu043Eu043Bu043Eu0436u0435u043Du043Du043Eu0433u043E u0432u043E u0432u0440u0435u043Cu0435u043Du043Du0443u044E u043Fu0430u043Fu043Au0443
            public int ParseReport(string FilePath)
                viewer = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
                CrystalDecisions.CrystalReports.Engine.ReportDocument rd =
                    new CrystalDecisions.CrystalReports.Engine.ReportDocument();
                try
                    rd.Load(FilePath);
                    try
                        for (int i = 0; i < rd.DataSourceConnections.Count; i++)
                            rd.DataSourceConnections<i>.SetConnection(
                                GetConnectionString().GetServerName(),
                                GetConnectionString().GetDatabaseName(),
                                GetConnectionString().GetUserName(),
                                GetConnectionString().GetPassword()
                            for (int j = 0; j < rd.Database.Tables.Count; j++)
                                DataTable dataSet = new DataTable();
                                SqlConnection C = new SqlConnection(GetConnectionString().ToString());
                                string ViewName = GetDataViewName(GetConnectionString(), ParseTableName(
                                                rd.Database.Tables[j].Name));
                                SqlCommand Q = new SqlCommand("select * from " + ViewName
                                    , C);
                                Q.CommandType = CommandType.Text;
                                SqlDataAdapter adapter = new SqlDataAdapter();
                                adapter.SelectCommand = Q;
                                adapter.Fill(dataSet);
                                rd.Database.Tables[j].SetDataSource(dataSet);
                    catch (Exception e)
                        MessageBox.Show(e.Message);
                    try
                        SetTemplateFilePath(TempFilePath + "\\" + FileTreeView.SelectedNode.Text.ToString() + ".rpt");
                        rd.ReportOptions.EnableSaveDataWithReport = true;
                        viewer.ReportSource = rd;
                        viewer.RefreshReport();
                        rd.SaveAs(TemplateFilePath);
                        rd.Close();
                        return 0;
                    catch (Exception e)
                        MessageBox.Show(e.Message);
                        return -1;
                catch (Exception ex)
                    rd.ReportOptions.EnableUseDummyData = true;
                    rd.ReportOptions.EnableSaveDataWithReport = true;
                    viewer.RefreshReport();
                    rd.SaveAs(TemplateFilePath);
                    MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
                    return -1;
             * u0420u0430u0437u0431u0438u0435u043Du0438u0435 u0438u043Cu0435u043Du0438 u0442u0430u0431u043Bu0438u0446u044B
             * u0434u043Bu044F u043Fu043Eu043Bu0443u0447u0435u043Du0438u044F u043Du043Eu043Cu0435u0440u0430 u043Au043Bu0430u0441u0441u0430
            public string ParseTableName(string TableName)
    //            MessageBox.Show(TableName);
                int x = 0;
                if (TableName.Contains("Class"))
                    x = TableName.LastIndexOf("s");
                    return TableName.Remove(0,x+1);
                if(TableName.Contains("Attr"))
                    x = TableName.IndexOf("r");
    //           MessageBox.Show(x.ToString());
    //           MessageBox.Show(TableName.Remove(0, x+1));
                return TableName.Remove(0, x+1);
             * u0424u0443u043Du043Au0446u0438u044F u043Fu043Eu043Bu0443u0447u0435u043Du0438u044F u0444u0430u0439u043Bu0430 u0438u0437 u0431u0430u0437u044B
            public int ParseReportWithDataBase()
                try
                    string ConnectionString = GetConnectionString().ToString();               
                    SqlConnection C = new SqlConnection(ConnectionString);
                    C.Open();
                    string SelectString = "select P119 from "+ GetDataViewName(GetConnectionString(),"24") +" where P115='";
                    SelectString = SelectString+FileTreeView.SelectedNode.Text.ToString()+"'";
                    SqlCommand Q = new SqlCommand(SelectString, C);
                    Q.CommandType = CommandType.Text;
                    SqlDataAdapter adapter = new SqlDataAdapter();
                    adapter.SelectCommand = Q;
                    DataTable table = new DataTable();
                    adapter.Fill(table);
                    byte[] b = (byte[])table.Rows[0].ItemArray.GetValue(0);
                    FileStream fs = File.Create(TempFilePath+"\\"+FileTreeView.SelectedNode.Text.ToString()+".rpt");
                    fs.Write(b, 0, b.Length);
                    fs.Close();
                    C.Close();
                    return 0;
                catch (Exception ex)
                    MessageBox.Show(ex.Message);
                    return -1;
             * u0421u0442u0440u0443u043Au0442u0443u0440u0430, u043Eu043Fu0438u0441u044Bu0432u0430u044Eu0449u0430u044F u043Fu0430u0440u0430u043Cu0435u0442u0440u044B
             * u043Fu043Eu0434u043Au043Bu044Eu0447u0435u043Du0438u044F u043A u0431u0430u0437u0435 u0434u0430u043Du043Du044Bu0445,
             * u043Au0430u043A u0434u043Bu044F u0432u043Du0435u0448u043Du0435u0433u043E u0438u0441u043Fu043Eu043Bu044Cu0437u043Eu0432u0430u043Du0438u044F
             * u0442u0430u043A u0438 u0434u043Bu044F u0432u043Du0443u0442u0440u0435u043Du043Du0435u0433u043E
            public struct ConnectionString
                 * u0418u043Cu044F u0441u0435u0440u0432u0435u0440u0430 u0431u0430u0437u044B u0434u0430u043Du043Du044Bu0445
                private string DataSource_Value;
                 * u041Du0430u0437u0432u0430u043Du0438u0435 u0431u0430u0437u044B u0434u0430u043Du043Du044Bu0445
                private string InitialCatalog_Value;
                 * u0418u043Cu044F u043Fu043Eu043Bu044Cu0437u043Eu0432u0430u0442u0435u043Bu044F
                private string UserID_Value;
                 * u041Fu0430u0440u043Eu043Bu044C
                private string Password_Value;
                 * u041Fu0435u0440u0435u0433u0440u0443u0436u0435u043Du043Du044Bu0439 u043Au043Eu043Du0441u0442u0440u0443u043Au0442u043Eu0440
                 * u0434u043Bu044F u0440u0443u0447u043Du043Eu0439 u0438u043Du0438u0446u0438u0430u043Bu0438u0437u0430u0446u0438u0438
                 * u0441u0442u0440u043Eu043Au0438 u043Fu043Eu0434u043Au043Bu044Eu0447u0435u043Du0438u044F,
                 * u043Du0443u0436u0435u043D u0434u043Bu044F u0438u0441u043Fu043Eu043Bu044Cu0437u043Eu0432u0430u043Du0438u044F u0435u0433u043E
                 * u0432 u043Eu0434u0440u0443u0433u0438u0445 u0444u043Eu0440u043Cu0430u0445
                public ConnectionString(string /*
                                                * u0418u043Cu044F u0441u0435u0440u0432u0435u0440u0430 u0431u0430u0437u044B u0434u0430u043Du043Du044Bu0445
                                                  InDataSource_Value,
                                        string /*
                                                * u041Du0430u0437u0432u0430u043Du0438u0435 u0431u0430u0437u044B u0434u0430u043Du043Du044Bu0445
                                                  InInitialCatalog_Value,
                                        string /*
                                                * u0418u043Cu044F u043Fu043Eu043Bu044Cu0437u043Eu0432u0430u0442u0435u043Bu044F
                                                */ InUserID_Value,
                                        string /*
                                                * u041Fu0430u0440u043Eu043Bu044C
                                                */ InPassword_Value)
                    DataSource_Value = InDataSource_Value;
                    InitialCatalog_Value = InInitialCatalog_Value;
                    UserID_Value = InUserID_Value;
                    Password_Value = InPassword_Value;
                 * u041Fu043Eu043Bu0443u0447u0438u0442u044C u0438u043Cu044F u0441u0435u0440u0432u0435u0440u0430
                 * u0431u0430u0437u044B u0434u0430u043Du043Du044Bu0445
                public string GetServerName()
                    return DataSource_Value;
                 * u041Fu043Eu043Bu0443u0447u0438u0442u044C u043Du0430u0437u0432u0430u043Du0438u0435
                 * u0431u0430u0437u044B u0434u0430u043Du043Du044Bu0445
                public string GetDatabaseName()
                    return InitialCatalog_Value;
                 * u041Fu043Eu043Bu0443u0447u0438u0442u044C u0438u043Cu044F
                 * u0442u0435u043Au0443u0449u0435u0433u043E u043Fu043Eu043Bu044Cu0437u043Eu0432u0430u0442u0435u043Bu044F
                public string GetUserName()
                    return UserID_Value;
                 * u041Fu043Eu043Bu0443u0447u0438u0442u044C u043Fu0430u0440u043Eu043Bu044C
                 * u0442u0435u043Au0443u0449u0435u0433u043E u043Fu043Eu043Bu044Cu0437u043Eu0432u0430u0442u0435u043Bu044F
                public string GetPassword()
                    return Password_Value;
                 * u041Fu0435u0440u0435u0432u043Eu0434 u0441u0442u0440u0443u043Au0442u0443u0440u044B u0432 u0442u0435u043Au0441u0442u043Eu0432u044Bu0439 u0432u0438u0434
                 * u0434u043Bu044F u0438u0441u043Fu043Eu043Bu044Cu0437u043Eu0432u0430u043Du0438u044F u043Fu0440u0438 u0441u043Eu0437u0434u0430u043Du0438u0438 u043Au043Eu043Du043Du0435u043Au0442u043Eu0440u0430
                public override string ToString()
                    return "Data Source="+DataSource_Value+";Initial Catalog="+
                        InitialCatalog_Value+";User ID="+UserID_Value+";Password="+
                        Password_Value;
             * u0424u0443u043Du043Au0446u0438u044F u043Fu043Eu043Bu0443u0447u0435u043Du0438u044F u0441u0442u0440u043Eu043Au0438 u043Fu043Eu0434u043Au043Bu044Eu0447u0435u043Du0438u044F u043Fu043E u0443u043Cu043Eu043Bu0447u0430u043Du0438u044E
             * u043Du0443u0436u043Du0430 u0431u044Bu043Bu0430 u0434u043Bu044F u0442u0435u0441u0442u043Eu0432
            static private string GetDefaultConnectionString()
                return "Data Source=BSRV01;Initial Catalog=Prokat_Last;User ID=sa;Password=";
             * u0412u043Du0443u0442u0440u0435u043Du043Du044Fu044F u0441u0442u0440u043Eu043Au0430 u043Fu043Eu0434u043Au043Bu044Eu0447u0435u043Du0438u044F
             * u043Du0435 u0434u043Eu0441u0442u0443u043Fu043Du0430 u0434u043Bu044F u0432u044Bu0437u043Eu0432u0430 u043Du0430u043Fu0440u044Fu043Cu0443u044E
            private ConnectionString localConnectionString;
             * u0423u0441u0442u0430u043Du043Eu0432u0438u0442u044C u0441u0442u0440u043Eu043Au0443 u0432u043Du0443u0442u0440u0435u043Du043Du0435u0433u043E u043Fu043Eu0434u043Au043Bu044Eu0447u0435u043Du0438u044F
            public void SetConnectionString(ConnectionString CS)
                this.localConnectionString = CS;
             * u041Fu043Eu043Bu0443u0447u0438u0442u044C u0441u0442u0440u043Eu043Au0443 u0432u043Du0443u0442u0440u0435u043Du043Du0435u0433u043E u043Fu043Eu0434u043Au043Bu044Eu0447u0435u043Du0438u044F
            public ConnectionString GetConnectionString()
                return this.localConnectionString;
             * u0424u0443u043Du043Au0446u0438u044F u0443u0434u0430u043Bu0435u043Du0438u044F u0432u0440u0435u043Cu0435u043Du043Du043Eu0433u043E u0444u0430u0439u043Bu0430
             * u043Fu043Eu0441u043Bu0435 u0437u0430u0432u0435u0440u0448u0435u043Du0438u044F u0432u0441u0435u0445 u043Eu043Fu0435u0440u0430u0446u0438u0439 u0441 u0448u0430u0431u043Bu043Eu043Du043Eu043C
            private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
                if (FileTreeView.Nodes.Count!=0)
                    if (File.Exists(TemplateFilePath))
                        File.Delete(TemplateFilePath);
             * u041Eu0431u0440u0430u0431u043Eu0442u0447u0438u043A u0434u0432u043Eu0439u043Du043Eu0433u043E u043Au043Bu0438u043Au0430
             * u043Fu043E u0448u0430u0431u043Bu043Eu043Du0443 u0432 u0434u0435u0440u0435u0432u0435 u0444u0430u0439u043Bu043Eu0432
            public void FileTreeView_DoubleClick(object sender, EventArgs e)
                int Result = 0;
                try
                    Result = ParseReportWithDataBase();
                    if (Result == 0)
                        Result = ParseReport(TempFilePath + FileTreeView.SelectedNode.Text.ToString() + ".rpt");
                        if (Result == 0)
                            Process.Start(TemplateFilePath);
                    else
                        MessageBox.Show("u0424u0430u0439u043B u043Du0435 u043Cu043Eu0436u0435u0442 u0431u044Bu0442u044C u043Eu0442u043Au0440u044Bu0442!");
                catch (Exception ex)
                    MessageBox.Show(ex.Message);
             * u041Fu043Eu043Bu0443u0447u0435u043Du0438u0435 u0432u0441u0435u0445 u0444u0430u0439u043Bu043Eu0432 u0441 u0440u0430u0441u0448u0438u0440u0435u043Du0438u0435u043C .rpt
             * u0438u0437 u0431u0430u0437u044B u043A u043Au043Eu0442u043Eu0440u043Eu0439 u043Fu0440u0438u0441u043Eu0435u0434u0438u043Du0438u043Bu0438u0441u044C
            public void GetReportNamesFromDataBase(ConnectionString CS)
                try
                    SqlConnection C = new SqlConnection(CS.ToString());
                    SqlDataAdapter adapter = new SqlDataAdapter();
                    DataTable table = new DataTable();
                    table.Clear();
                    string sqlcom = "Select P115 from " + GetDataViewName(CS,"24") + " where P116 like '%.rpt'";
                    SqlCommand Q1 = new SqlCommand(sqlcom,C);
                    Q1.CommandType = CommandType.Text;
                    adapter.SelectCommand = Q1;
                    adapter.Fill(table);
                    FileTreeView.Nodes.Clear();
                    for (int i = 0; i < table.Rows.Count; i++)
                            FileTreeView.Nodes.Add(table.Rows<i>.ItemArray.GetValue(
                                table.Rows<i>.ItemArray.Length-1).ToString());
    //                        MessageBox.Show(table.Rows<i>.ItemArray.GetValue(0).ToString());
                    C.Close();
                catch (Exception ex)
                    MessageBox.Show(ex.Message);
             * u041Fu043Eu043Bu0443u0447u0438u0442u044C u0438u043Cu044F DataView
             * u0434u043Bu044F u0442u0435u043Au0443u0449u0435u0433u043E u043Fu043Eu043Bu044Cu0437u043Eu0432u0430u0442u0435u043Bu044F
            private string GetDataViewName(ConnectionString CS,string ClassID)
                string ViewName = "";
                SqlConnection C = new SqlConnection(CS.ToString());
                C.Open();
                SqlCommand Q = new SqlCommand("[dbo].[_SysGetClassesInfoNew1]"/*P115 from dbo.Attr24 where P116='.rpt'*/, C);
                Q.CommandType = CommandType.Text;
                SqlDataAdapter adapter = new SqlDataAdapter();
                adapter.SelectCommand = Q;
                DataTable table = new DataTable();
                adapter.Fill(table);
                for (int i = 0; i < table.Rows.Count; i++)
                    if (table.Rows<i>.ItemArray.GetValue(0).ToString() == ClassID)
                        ViewName = table.Rows<i>.ItemArray.GetValue(13).ToString();
                        // MessageBox.Show(ViewName);
                C.Close();
                return ViewName;
             * u041Eu0431u0440u0430u0431u043Eu0442u0447u0438u043A u043Au043Bu0438u043Au0430 u043Du0430 u0432u044Bu043Fu0430u0434u0430u044Eu0449u0435u043C
             * u043Cu0435u043Du044E u0432 u043Fu0443u043Du043Au0442u0435 "Delete"
            private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
                FileTreeView.SelectedNode.Remove();

  • Problem with binding in h:dataTable

    Hi
    I have a problem with h:dataTable, where the table rows are bound to objects (Bean$Line) nested within a backing bean (Bean).
    JSP:
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
    <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
    <html>
      <f:view>
        <head>
          <link href="styles.css" rel="stylesheet" type="text/css"/>
          <title>Sandbox</title>
        </head>
        <body>
          <h:form>
            <h:dataTable value="#{bean.lines}" var="line">
              <h:column>
                <h:outputText value="#{line.id}"/>
              </h:column>
              <h:column>
                <!-- using value = line.lineSelected here works (assuming boolean property Line.lineSelected) --/>
                <h:selectBooleanCheckbox binding="#{line.lineSelected}"/>
              </h:column>
            </h:dataTable>
          </h:form>
        </body>
      </f:view>
    </html>Bean:
    package com.test;
    import java.util.ArrayList;
    import java.util.List;
    import javax.faces.component.UISelectBoolean;
    public final class Bean {
      private final List<Line> lines;
      public Bean() {
        lines = new ArrayList<Line>();
        lines.add(new Line("one"));
        lines.add(new Line("two"));
        lines.add(new Line("three"));
      public List<Line> getLines() {
        return lines;
       * Nested class in order to access containing class
       * properties etc.
      public static class Line {
        //private boolean lineSelected = false;
        private UISelectBoolean lineSelected;
        private String id;
        public Line(String id) {
          this.id = id;
        /*public boolean isLineSelected() {
          return lineSelected;
        public void setLineSelected(boolean lineSelected) {
          this.lineSelected = lineSelected;
        public UISelectBoolean getLineSelected() {
          return lineSelected;
        public void setLineSelected(UISelectBoolean lineSelected) {
          this.lineSelected = lineSelected;
        public String getId() {
          return id;
        public void setId(String id) {
          this.id = id;
      } // Line
    }The setup works when I use value="#{line.lineSelected}" (assuming the property is defined as boolean in Bean$Line) but as soon as I use a binding, I get the following exception:
    com.sun.rave.web.ui.appbase.ApplicationException: javax.servlet.ServletException: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'line' resolved to null
    at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.cleanup(ViewHandlerImpl.java:594)
    at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.java:325)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
    faces_config:
    <faces-config version="1.2"
                  xmlns="http://java.sun.com/xml/ns/javaee"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
      <application>
        <locale-config>
          <default-locale>en_GB</default-locale>
          <supported-locale>en_GB</supported-locale>     
        </locale-config>
      </application>
      <managed-bean>
        <managed-bean-name>bean</managed-bean-name>
        <managed-bean-class>com.test.Bean</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
      </managed-bean>
    </faces-config>What am I missing here?
    Help much appreciated
    Lance

    Guys
    Thanks a lot, both of your replies are immensely instructive. Maybe a little background on what I'm trying to do. In the table, I have header rows with dependent line rows. When a check box is ticked in the header, I want the corresponding check boxes in the dependent lines to be checked automatically (in slave fashion and ideally without using JavaScript). My idea was to update the bound components (for the lines) from within the Bean (in response to change on the header). However, given there's only a single component for each column in the table, this of course doesn't make sense.
    I'm trying to get to the typical MVC workflow of a) user updates a View component, b) Controller detects the change and updates the Model, c) The Model fires a property change event, which the View detects and updates appropriately. What's the way to achieve this in JSF (by design)?
    Here's a simple fragment (which does not work):
            <h:dataTable value="#{bean.lines}" var="line">
              <h:column>
                <h:outputText value="#{line.id}"/>
              </h:column>
              <h:column>
                <!-- (1) This is the master and (2) should refresh on update here --/>
                <h:selectBooleanCheckbox onchange="submit()" value="#{line.lineSelected}"/>
              </h:column>
              <h:column>
                <!-- (2) This is the slave and I want this to update in response to a change of (1) above --/>
                <h:selectBooleanCheckbox value="#{line.slaveSelected}"/>
              </h:column>
            </h:dataTable>In the setter method for lineSelected, I'm setting slaveSelected to the new value but the View is not refreshing based on this. How do I get the View to update (each dependent line) based on the new values for slaveSelected?
    Thanks again
    Lance

  • How to refresh a crystal report automatically ?

    I deployed my website(asp.net/c#) in IIS 7.5, when i click on the button to open the page that contain the report, i get a blank page but when i refresh the page (F5) it's ok. my question is: how can i open the page that contain the report file directly
    without refresh?

    Tricky to guess without seeing any code.
    Here's some example code which fills and shows a report.
    protected void Page_Load(object sender, EventArgs e)
    ReportDocument rd;
    DataTable dt = (DataTable)Session["xxxxx"];
    // Tricky bit here is to make the name of the datatable match what the report expects
    dt.TableName = "DataTable1";
    rd = new ReportDocument();
    rd.Load(Server.MapPath("Reports\\xxxxReport.rpt"));
    rd.SetDataSource(dt);
    rd.Refresh();
    CrystalReportViewer1.ReportSource = rd;
    CrystalReportViewer1.RefreshReport();
    CrystalReportViewer1.DisplayGroupTree = false;
    Please don't forget to upvote posts which you like and mark those which answer your question.
    My latest Technet article - Dynamic XAML

  • One reason why commandLink doesn't work in dataTable

    Ok, so I think I've got an explanation why commandLink doesn't work in dataTable when the model bean is request scoped. Maybe somebody can tell me if I'm wrong.
    I have a model bean that generates table rows based on some input criteria (request parameters).
    So, we validate the inputs, apply them to the bean and render the page. Once the inputs have been applied to the bean, a request for table rows returns rows, no problem.
    However, we put a commandLink in each row, so we can expand the details. Maybe we even get smart and repeat the input row-generating criteria as a hidden field in the page.
    Unfortunately, when the user hits the commandLink, the list page simply refreshes, maybe even w/out table rows. The user doesn't get the details page as expected.
    Why not?
    Because: in the DECODE phase (even before validation and before "immediate" values have had their valueChangeListeners called), we ask the model bean for the table rows, so we can decode the commandLinks. Unfortunately, in "decode" phase, the request-scoped model bean has not had its row-generating criteria updated (that happens in the "update model" normally, or at the END of the decode phase if we got cute by (1) setting the "immediate" attribute on the row-generating criteria to "true" AND (2) set a valueChangeListener to allow us to update the model bean early. The END of the decode phase isn't good enough -- in the middle of that phase, when we're attempting to deocde commandLinks, the model bean has no citeria, so there's no row data. No row data means no iteration over commandLinks to decode them and queue ActionEvents. So, we march through the rest of the phases, process no events, and return to the screen of origin (the list screen) with no errors.
    So, what's the solution?
    One solution is to make the model bean session-scoped. Fine, maybe we can store a tiny bit of data in it (the search criteria), so it's not such a memory drag to have it live in the session forever. How do we get that data in? A managed property in faces-config.xml with value #{param.PARENT_KEY} won't work because it's assigning request-scoped data to a session-scoped holder. JBoss balks, and rightly so. Do we write code in the model bean that pulls the request parameter out of thin air? (FacesContext.getExternalContext()....) I don't really like to code the name of a specific http request parameter into the bean, I think it's the job of the JSP or faces-config.xml to achieve that binding (request parameter to model propery). Plus, I'd be sad to introduce a dependency on Faces in what was previously just a bean.
    Is there a better way?
    In my particular situation, we're grafting some Faces pages onto an already-existing non-Faces application. I don't get the luxury of presenting the user an input field and binding it to a bean. All I've got to work with is a request parameter.
    Hmm, I guess I just answered my own question. if all I've got to work with is a request parameter, some ugliness is inevitable, I guess.
    I guess the best fix is to cheat and have the bean constructor look for a request parameter. If it finds it, it initializes the criteria field (which, in my case, is the key of an object that has a bunch of associated objects (the rows data), but could be more-general d/b search criteria).
    (I looked at the "repeater" example code in the RI, but it basically statically-generates its data and then uses 100% Faces (of course) to manage the paging (where "page number" is essentially the "criteria").
    Comments? Did I miss something obvious?
    John.

    ...or I could just break down and do the thing I was hoping to avoid (outputLink instead of commandLink):
    <h:outputLink value="/faces/Detail.jsp">
      <f:param name="PARENT_KEY" value="#{bean.parentKey}"/>
      <h:outputText value="#{bean.label}"/>
    </h:outputLink>It's still a "hardcoded" parameter name, but at least the binding is in the JSP and faces-config.xml, not the bean Java code.

  • Error due to drop down menu in the dataTable

    I have a data table which has a drop down menu in one of the table columns. When the drop down menu is disabled, every action in the page works (click on it, and it does what it does). When the drop down menu is enabled, every action (with one exception) in the page does not work (click on it, it refreshes the page, but the action is not fired). I cannot debug the thing because the action is not fired at all.
    The exception is that for buttons that is marked as immediate, it works. I created an inline message, and wire that to the dropdown menu. I do not see any error. Looking into the log file, I do not see anything.
    I was suspecting maybe conversion error. The data value for the drop down menu is integer (I try both setting the convert to integer and nothing). Even there's error in conversion, there should be error message showing up (in the inline message box).
    So, again, how do I diagnos this, and to find out what is going on?
    Thank you very much.
    Vh.

    Thank you for your attention.
    The bug link is:
    https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=51
    I thought I could add attachment afterward, but I couldn't. Please add these for me:
    //////////////////////////////////////////////////// Page3.jsp //////////////////////////////////////////////////////////////////
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page">
        <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
        <f:view>
            <html lang="en-US" xml:lang="en-US">
                <head>
                    <meta content="no-cache" http-equiv="Cache-Control"/>
                    <meta content="no-cache" http-equiv="Pragma"/>
                    <title>Page3 Title</title>
                    <link href="resources/stylesheet.css" rel="stylesheet" type="text/css"/>
                </head>
                <body style="-rave-layout: grid">
                    <h:form binding="#{Page3.form1}" id="form1">
                        <h:dataTable binding="#{Page3.dataTable1}" headerClass="list-header" id="dataTable1" rowClasses="list-row-even,list-row-odd"
                            style="height: 111px; left: 60px; top: 120px; position: absolute" value="#{Page3.dataTable1Model}" var="currentRow" width="360">
                            <h:column binding="#{Page3.column1}" id="column1">
                                <h:outputText binding="#{Page3.outputText1}" id="outputText1" value="#{currentRow.c1}"/>
                                <f:facet name="header">
                                    <h:outputText binding="#{Page3.outputText2}" id="outputText2" value="column1"/>
                                </f:facet>
                            </h:column>
                            <h:column binding="#{Page3.column2}" id="column2">
                                <h:outputText binding="#{Page3.outputText3}" id="outputText3" value="#{currentRow.c2}"/>
                                <f:facet name="header">
                                    <h:outputText binding="#{Page3.outputText4}" id="outputText4" value="column2"/>
                                </f:facet>
                            </h:column>
                            <h:column binding="#{Page3.column3}" id="column3">
                                <f:facet name="header">
                                    <h:outputText binding="#{Page3.outputText6}" id="outputText6" value="column3"/>
                                </f:facet>
                                <h:selectOneMenu binding="#{Page3.dropdown1}" converter="#{Page3.integerConverter1}" id="dropdown1" value="#{currentRow.c3}">
                                    <f:selectItems binding="#{Page3.dropdown1SelectItems}" id="dropdown1SelectItems" value="#{Page3.dropdown1DefaultItems}" />
                                </h:selectOneMenu>
                            </h:column>
                        </h:dataTable>
                        <h:outputText binding="#{Page3.outputMesg}" id="outputMesg" style="height: 32px; left: 240px; top: 50px; position: absolute; width: 180px"/>
                        <h:outputText binding="#{Page3.outputText8}" id="outputText8" style="height: 30px; left: 60px; top: 50px; position: absolute; width: 162px" value="Message:"/>
                        <h:commandButton action="#{Page3.button1_action}" binding="#{Page3.button1}" id="button1"
                            style="height: 25px; left: 300px; top: 260px; position: absolute; width: 109px" value="Say Hello"/>
                        <h:message binding="#{Page3.inlineMessage1}" errorClass="errorMessage" fatalClass="fatalMessage" for="dropdown1" id="inlineMessage1"
                            infoClass="infoMessage" showDetail="false" showSummary="true"
                            style="height: 102px; left: 60px; top: 300px; position: absolute; width: 360px" warnClass="warnMessage"/>
                        <h:outputText binding="#{Page3.outputText5}" id="outputText5" style="height: 30px; left: 60px; top: 260px; position: absolute; width: 120px" value="Error Message:"/>
                    </h:form>
                </body>
            </html>
        </f:view>
    </jsp:root>//////////////////////////////////////////////////// Page3.java //////////////////////////////////////////////////////////////////
    * Page3.java
    * Created on August 10, 2004, 10:35 AM
    * Copyright hovh
    package webapplication1;
    import javax.faces.*;
    import com.sun.jsfcl.app.*;
    import javax.faces.component.html.*;
    import com.sun.jsfcl.data.*;
    import java.util.*;
    import javax.faces.component.*;
    import javax.faces.convert.*;
    public class Page3 extends AbstractPageBean {
        // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Definition">
        private int __placeholder;
        private HtmlForm form1 = new HtmlForm();
        public HtmlForm getForm1() {
            return form1;
        public void setForm1(HtmlForm hf) {
            this.form1 = hf;
        private HtmlDataTable dataTable1 = new HtmlDataTable();
        public HtmlDataTable getDataTable1() {
            return dataTable1;
        public void setDataTable1(HtmlDataTable hdt) {
            this.dataTable1 = hdt;
        private DefaultTableDataModel dataTable1Model = new DefaultTableDataModel();
        public DefaultTableDataModel getDataTable1Model() {
            return dataTable1Model;
        public void setDataTable1Model(DefaultTableDataModel dtdm) {
            this.dataTable1Model = dtdm;
        private UIColumn column1 = new UIColumn();
        public UIColumn getColumn1() {
            return column1;
        public void setColumn1(UIColumn uic) {
            this.column1 = uic;
        private HtmlOutputText outputText1 = new HtmlOutputText();
        public HtmlOutputText getOutputText1() {
            return outputText1;
        public void setOutputText1(HtmlOutputText hot) {
            this.outputText1 = hot;
        private HtmlOutputText outputText2 = new HtmlOutputText();
        public HtmlOutputText getOutputText2() {
            return outputText2;
        public void setOutputText2(HtmlOutputText hot) {
            this.outputText2 = hot;
        private UIColumn column2 = new UIColumn();
        public UIColumn getColumn2() {
            return column2;
        public void setColumn2(UIColumn uic) {
            this.column2 = uic;
        private HtmlOutputText outputText3 = new HtmlOutputText();
        public HtmlOutputText getOutputText3() {
            return outputText3;
        public void setOutputText3(HtmlOutputText hot) {
            this.outputText3 = hot;
        private HtmlOutputText outputText4 = new HtmlOutputText();
        public HtmlOutputText getOutputText4() {
            return outputText4;
        public void setOutputText4(HtmlOutputText hot) {
            this.outputText4 = hot;
        private UIColumn column3 = new UIColumn();
        public UIColumn getColumn3() {
            return column3;
        public void setColumn3(UIColumn uic) {
            this.column3 = uic;
        private HtmlOutputText outputText6 = new HtmlOutputText();
        public HtmlOutputText getOutputText6() {
            return outputText6;
        public void setOutputText6(HtmlOutputText hot) {
            this.outputText6 = hot;
        private HtmlOutputText outputMesg = new HtmlOutputText();
        public HtmlOutputText getOutputMesg() {
            return outputMesg;
        public void setOutputMesg(HtmlOutputText hot) {
            this.outputMesg = hot;
        private HtmlOutputText outputText8 = new HtmlOutputText();
        public HtmlOutputText getOutputText8() {
            return outputText8;
        public void setOutputText8(HtmlOutputText hot) {
            this.outputText8 = hot;
        private HtmlCommandButton button1 = new HtmlCommandButton();
         * Holds value of property tableData.
        private ArrayList tableData;
        public HtmlCommandButton getButton1() {
            return button1;
        public void setButton1(HtmlCommandButton hcb) {
            this.button1 = hcb;
        private HtmlSelectOneMenu dropdown1 = new HtmlSelectOneMenu();
        public HtmlSelectOneMenu getDropdown1() {
            return dropdown1;
        public void setDropdown1(HtmlSelectOneMenu hsom) {
            this.dropdown1 = hsom;
        private DefaultSelectItemsArray dropdown1DefaultItems = new DefaultSelectItemsArray();
        public DefaultSelectItemsArray getDropdown1DefaultItems() {
            return dropdown1DefaultItems;
        public void setDropdown1DefaultItems(DefaultSelectItemsArray dsia) {
            this.dropdown1DefaultItems = dsia;
        private UISelectItems dropdown1SelectItems = new UISelectItems();
        public UISelectItems getDropdown1SelectItems() {
            return dropdown1SelectItems;
        public void setDropdown1SelectItems(UISelectItems uisi) {
            this.dropdown1SelectItems = uisi;
        private IntegerConverter integerConverter1 = new IntegerConverter();
        public IntegerConverter getIntegerConverter1() {
            return integerConverter1;
        public void setIntegerConverter1(IntegerConverter ic) {
            this.integerConverter1 = ic;
        private HtmlMessage inlineMessage1 = new HtmlMessage();
        public HtmlMessage getInlineMessage1() {
            return inlineMessage1;
        public void setInlineMessage1(HtmlMessage hm) {
            this.inlineMessage1 = hm;
        private HtmlOutputText outputText5 = new HtmlOutputText();
        public HtmlOutputText getOutputText5() {
            return outputText5;
        public void setOutputText5(HtmlOutputText hot) {
            this.outputText5 = hot;
        // </editor-fold>
        public Page3() {
            // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Initialization">
            try {
                dropdown1DefaultItems.setItems(new String[] {"1", "2", "3"});
            } catch (Exception e) {
                log("Page3 Initialization Failure", e);
                throw e instanceof javax.faces.FacesException ? (FacesException) e : new FacesException(e);
            // </editor-fold>
            // Additional user provided initialization code
            tableData = new ArrayList();
            tableData.add(new webapplication1.TableEntry("c1_1", "c2_1", 1));
            tableData.add(new webapplication1.TableEntry("c1_2", "c2_2", 2));
            tableData.add(new webapplication1.TableEntry("c1_3", "c2_3", 3));
            this.dataTable1Model.setWrappedData(tableData);
        protected webapplication1.ApplicationBean1 getApplicationBean1() {
            return (webapplication1.ApplicationBean1)getBean("ApplicationBean1");
        protected webapplication1.SessionBean1 getSessionBean1() {
            return (webapplication1.SessionBean1)getBean("SessionBean1");
         * Bean cleanup.
        protected void afterRenderResponse() {
         * Getter for property tableData.
         * @return Value of property tableData.
        public ArrayList getTableData() {
            return this.tableData;
         * Setter for property tableData.
         * @param tableData New value of property tableData.
        public void setTableData(ArrayList tableData) {
            this.tableData = tableData;
        public String button1_action() {
            // User event code here...
            this.outputMesg.setValue("Hello world!");
            return null;
    }//////////////////////////////////////////////////// TableEntry.java //////////////////////////////////////////////////////////////////
    * TableEntry.java
    * Created on September 3, 2004, 2:38 PM
    package webapplication1;
    * @author  hovh
    public class TableEntry  {
        String c1;
        String c2;
        int c3;
        String c3Str;
        public TableEntry(String c1, String c2, int c3){
            this.c1 = c1;
            this.c2 = c2;
            this.c3 = c3;
        public String getC1() {
            return c1;
        public void setC1(String c1) {
            this.c1 = c1;
        public int getC3() {
            return c3;
        public void setC3(int c3) {
            this.c3 = c3;
        public String getC2() {
            return c2;
        public void setC2(String c2) {
            this.c2 = c2;
        public java.lang.String getC3Str() {
         return "" + c3;
        public void setC3Str(java.lang.String c3Str) {
         this.c3Str = c3Str;
         try{
             c3 = Integer.parseInt(c3Str);
         }catch(Exception e){

  • h:dataTable re-rendering problem...

    hi friends,
    In my project i am using JSF and a4j .I am getting re-rendering problem with <h:dataTable> in mozilla it is working fine but in IE6 the dataTable is not re-rendering ..
    code is:
    <a4j:commandButton value="#{rb.New}" onmouseup="javascript:openModalWindow('/NGL/faces/jsp/circulation /ILLPlaceILLRequest.jsp','','dialogWidth:500px;dialogHeight:500px;status:no;scrollbars:yes;top:200;left:200')" >
    <a4j:support event="onmousedown" action="#{requestApprove.newActionPerformed}"/>
    <a4j:support event="oncomplete" reRender="illDetails"/>
    </a4j:commandButton>
    my task is:
    when i press the New button another jsp page will open in modal dialog after closing the dialog the table should re-render...
    Edited by: Venkat_quill on Oct 30, 2008 3:29 AM
    Edited by: Venkat_quill on Oct 30, 2008 3:50 AM

    thanks for your reply...
    I have already tried this case but, the datatable is not re-rendering ...
    I got below solutions..
       <a4j:commandButton value="#{rb.New}" onmouseup="javascript:openModalWindow('/NGL/faces/jsp/circulation  /ILLPlaceILLRequest.jsp','','dialogWidth:500px;dialogHeight:500px;status:no;scrollbars:yes;top:200;left:200')" >
                                    <a4j:support event="onmousedown" action="#{requestApprove.newActionPerformed}"/>
                                    <a4j:support event="oncomplete" action="#{requestApprove.clearData}" reRender="illDetails"/>
    </a4j:commandButton>Why i followed this case this i have Add,Edit ,Delete and Refresh action on datatable.In Edit case i need to set some values in the dialog this also working fine with following code..
    <a4j:commandButton value="#{rb.Edit}" onmouseup="editRequest()">
         <a4j:support event="onmousedown" action="#{requestApprove.editActionPerformed}" reRender="msg,msgmode"/>
        <a4j:support event="oncomplete" action="#{requestApprove.clearData}" reRender="illDetails,msg,msgmode"/>
    </a4j:commandButton>But this problem is oncomplete event is not working in the Internet Explorer....

  • Use dpendent dropdowns in dataTable

    The problem is how to populate/refresh the item list of a dropdown menu in a row af a dataTable according to the changes of an other component in the same row.
    As an example consider the case when the rows of the table corresppond to Project entities, and for each project we can assign a departement and a project leader among the employees of the selected departement. NOw if the user select a departement for a project then the dorpdown for project leader should be populated with the employees of the selected departement.
    I had two ideas but unfortunately none of them works. The first one is to generate the list of SelectItems in the Project entity (not a good programming practice). That is
    <f:selectItems value="#{project.projectLeaderSelect}">so in the getProjectLeaderSelect() method of the entity we have information about the selected project leader.
    The problem of this solution that the JSF framework does not allows us to bind input elements to none managed bean properties. I got exception - I suspect that was the reason.
    The other way would be to send request parameters when populating dropdowns, but unfortunately getters are called several times, and the sent request parameters may be not living at any call.
    At the end I solved the problem a bit strange way. I generated a prepopulated project leader dropdown for each possible departement, and rendered only one according to the present value of the departement attribute of the project. Of course, it is not a general enough way but for our problem was working, the possible values of both dropdowns were static.
    I am still looking for a better solution.

    Hi,
    Please go through the sample application AppModel which is available at:
    http://developers.sun.com/prodtech/javatools/jscreator/reference/codesamples/sampleapps.html
    Hope this helps.
    Thanks,
    RK.

  • How do you reset inputText values in a dataTable?

    I'm having what must be a simple and common problem,
    but nothing I've tried has solved it. I want to be
    able to refresh (reset) the inputText field values in a dataTable.
    I have a dataTable that holds required inputText components.
    I want to have a "cancel" button which would abandon any edits
    on these components and refresh (reset) them with their backing values,
    as well as removing the last row from the table (used to enter a
    new record). Because the inputText components are required,
    I made the cancel button immediate. I don't know what code I can
    put in the button's actionListener. Right now, the displayed values
    survive the round trip to the server and back to the browser, but
    I want them to be reset to their backing values.
    Here is the page, and the backing bean of a test example:
    <%@ include file="../include/taglibs.jsp" %>
    <h:dataTable id="table" value="#{pc_Test.list}" var="x">
        <h:column>
            <h:panelGroup>
                <h:inputText id="label_value" required="true" value="#{x.value}" />
                <h:message for="label_value"/>
            </h:panelGroup>
        </h:column>
        <f:facet name="footer">
            <h:panelGroup>
                <h:commandButton id = "btnn" value="new row" actionListener="#{pc_Test.newRow}" /> 
                <f:verbatim>  </f:verbatim>
                <h:commandButton id = "btnu" value="update" actionListener="#{pc_Test.update}" />  
                <f:verbatim>  </f:verbatim>
                <h:commandButton id = "btnr" value="cancel" immediate="true" actionListener="#{pc_Test.cancel}"/>
            </h:panelGroup>
        </f:facet>
    </h:dataTable>
    <f:verbatim>Summary=</f:verbatim>
    <h:outputText value="#{pc_Test.listString}" />
    package pagecode;
    import java.util.ArrayList;
    import java.util.List;
    import javax.faces.event.ActionEvent;
    public class TestPage {
        public static class Example {
            public Example(String value){this.value = value;}
            public String getValue() {return value;}
            public void setValue(String value) {this.value = value;}
            public String toString(){return getValue();}
            private String value;
        public TestPage(){
            list.add(new Example("a"));
            list.add(new Example("b"));
            list.add(new Example("c"));
        public List getList() {return list;}
        public String getListString() {return list.toString();}
        public void update(ActionEvent event){}
        public void cancel(ActionEvent event){
            if (list.size()>3)
                list.remove(list.size()-1);
        public void newRow(ActionEvent event){
            list.add(new Example(""));
        private boolean readOnly;
        private List list = new ArrayList();
    }If it makes a difference, my implementation of JSF is MyFaces. Thanks!

    bump
    I'm not happy with having javascript reseting fields in a table before submitting:
    there's a noticable screen flash, and I'd like a server-side solution anyway.
    Question: UIInput has methods getSubmittedValue and setSubmittedValue,
    so I can use these to ignore or clear submitted values when I press an
    immediate command button. This takes care of subclasses like HtmlInputText
    but not for data tables. Is there a way to manipulate all the submitted values
    of a data table?

  • Post refresh BI portal shows 500 Internal Server Error

    Hi Experts,
    Post system refresh of BI and ECC system , our JAVA (BI Portal) shows the error "Application error occurred during the request processing" when Approval Portal tab is clicked
    Find the below default trace details. Please let me know what can be done further to resolve this issue.
    #2.0 #2014 05 26 00:00:55:961#0-700#Error#com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl#
    com.sap.ASJ.web.000137##opentext.com/IM_APPROVAL_PORTAL6_0SP5#C000A7EEAF610045000000040000230A#14599451000000004#opentext.com/IM_APPROVAL_PORTAL6_0SP5#com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl#Guest#0##3A20F44EE42B11E39A69000000DEC51B#08015d8ce42611e3a2ed00212817ec24#08015d8ce42611e3a2ed00212817ec24#0#Thread[HTTP Worker [@522913632],5,Dedicated_Application_Thread]#Plain##
    Cannot process an HTTP request to servlet [jsp] in [vimportal] web application.
    For more details on the problem please check traces searching by logId: C000A7EEAF610045000000020000230A#
    #2.0 #2014 05 26 00:00:56:008#0-700#Error#com.sap.engine.services.servlets_jsp.ISE500#
    com.sap.ASJ.web.000500##opentext.com/IM_APPROVAL_PORTAL6_0SP5#C000A7EEAF610045000000050000230A#14599451000000004#opentext.com/IM_APPROVAL_PORTAL6_0SP5#com.sap.engine.services.servlets_jsp.ISE500#Guest#0##3A20F44EE42B11E39A69000000DEC51B#08015d8ce42611e3a2ed00212817ec24#08015d8ce42611e3a2ed00212817ec24#0#Thread[HTTP Worker [@522913632],5,Dedicated_Application_Thread]#Plain##
    500 Internal Server Error is returned for HTTP request [https://sap-xxx1:50101/vimportal/jsp/common/index.jsp]:
    component [jsp],
    web module [vimportal],
    application [opentext.com/IM_APPROVAL_PORTAL6_0SP5],
    DC name [opentext.com/IM_APPROVAL_PORTAL6_0SP5],
    CSN component[],
    problem categorization [com.sap.ASJ.web.000137],
    internal categorization [-1152113356].
    [EXCEPTION]
    java.lang.NullPointerException: while trying to invoke the method java.lang.String.equalsIgnoreCase(java.lang.String) of a null object returned from com.opentext.vim.portal.util.JServerParameter.getWhiteListConigParam()
    at JEE_jsp_jsp_common_index_14599451_1390875356000_1390877128615._jspService(JEE_jsp_jsp_common_index_14599451_1390875356000_1390877128615.java:220)
    at com.sap.engine.services.servlets_jsp.lib.jspruntime.JspBase.service(JspBase.java:102)
    at com.sap.engine.services.servlets_jsp.server.Invokable.invoke(Invokable.java:152)
    at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:428)
    Thanks,
    Preetha Balan

    Hi Tapan,
    Please find the below log details
    2.0 #2014 05 27 03:48:42:030#0-700#Error#com.sap.engine.services.servlets_jsp.ISE500#
    com.sap.ASJ.web.000500##opentext.com/IM_APPROVAL_PORTAL6_0SP5#C000A7EEAF6100900000000700003D20#14599451000000004#opentext.com/IM_APPROVAL_PORTAL6_0SP5#com.sap.engine.services.servlets_jsp.ISE500#Guest#0##29D8F6BFE58B11E3A921000000DEC51B#7771ad18e58c11e3cbed000000dec51b#7771ad18e58c11e3cbed000000dec51b#0#Thread[HTTP Worker [@773885252],5,Dedicated_Application_Thread]#Plain##
    500 Internal Server Error is returned for HTTP request [https://sap-XXX1:50101/vimportal/jsp/common/index.jsp]:
    component [jsp],
    web module [vimportal],
    application [opentext.com/IM_APPROVAL_PORTAL6_0SP5],
    DC name [opentext.com/IM_APPROVAL_PORTAL6_0SP5],
    CSN component[],
    problem categorization [com.sap.ASJ.web.000137],
    internal categorization [-305178439].
    [EXCEPTION]
    java.lang.NullPointerException: while trying to invoke the method java.lang.String.equalsIgnoreCase(java.lang.String) of a null object returned from com.opentext.vim.portal.util.JServerParameter.getWhiteListConigParam()
    at JEE_jsp_jsp_common_index_14599451_1390875356000_1390877128615._jspService(JEE_jsp_jsp_common_index_14599451_1390875356000_1390877128615.java:220)
    at com.sap.engine.services.servlets_jsp.lib.jspruntime.JspBase.service(JspBase.java:102)

  • How to fill table from datatable(MySQL)

    hi;
    I am starting with Visual web java server faces, and I want to fill a Table using an information from MySQL data base, i am trying to modify a example code I have found on netbeans totorials but they are using droplist and I want firts to use a texfield to set a "name" and button to search using a MySQL query to seek on data table and get the return and set it to Table.
    Basicly I dont Know HOW to connect a data base using same code like a desktop application but in Visual Web Java Server Faces.
    thank you in advance.
    Miguel V.

    Hi;
    I hava done this code but still geting a mistake with tomcat
    Next steps i follow to conectand display on data table:
    1.-Create conecction with MySQL usen service.
    2.-On service drag "directorio" to Table
    3.-Binding all objets (Textfield1, Table and Button)
    4.-On button1 create the next code:
    Object optener =3;
    //set the dataprovider with element number 3, on DIRECTORIO.ID of datatable directorio
    directorioDataProvider.setCursorRow(directorioDataProvider.findFirst("DIRECTORIO.ID", optener));
    //Get the row with same ID=3
    getSessionBean1().getDirectorioRowSet().setObject(1, optener);
    //Shows the inf on table
    getSessionBean1().getDirectorioRowSet().execute();
    directorioDataProvider.refresh();

  • Get DataTable From SSRS Server Report

    HI,
    I am using SSRS reporting service. In my web application, I am showing SSRS Server Report in my custom rdlc viewer.
    I am getting report definition by ReportingService2005 Web Service and setting report parameters from UI.  
    My Code Snippet Like Below:
    RptViewer.ProcessingMode = ProcessingMode.Remote;
    IReportServerCredentials irsc = new CustomReportCredentials(System.Configuration.ConfigurationManager.AppSettings["rsUser"], System.Configuration.ConfigurationManager.AppSettings["rsPassword"], System.Configuration.ConfigurationManager.AppSettings["rsDomain"]);
    RptViewer.ServerReport.ReportServerCredentials = irsc;
    RptViewer.ServerReport.ReportServerUrl = new Uri(System.Configuration.ConfigurationManager.AppSettings["SSRSSVR"]);
    RptViewer.ServerReport.ReportPath = my_reportPath;
    RptViewer.ServerReport.SetParameters(reportParameters);
    RptViewer.ServerReport.Refresh();
    MY Question:
    This Code directly show the report. But my requirement is not to showing the report if the datatable return 0 rows.
    How can I get the datatable from server report just before loading the report? Is there any way? 
    Getting the datatable from server report is also necessary for another reason. I want to export the report to excel (only data not rdlc built in excel format), and for that I need the datatable available.
    Since the report is already loaded, I do not want to query again to pick the datable.
    So, Is there any way to get the resultant datatable before the server report loaded in report viewer.
    Regards,

    hope the link is hopeful:http://www.experts-exchange.com/Programming/Microsoft_Development/Q_27581973.html

Maybe you are looking for