а

ConnectorServlet in jsp


#1

Hi,
How to write ConnectorServlet in jsp?

Thanks and Regards,
Karthick K.


#2

You need to create a new class , using ConnectorServlet as base class, and map this class directly to the URI through web.xml, there is no need for separate jsp pages.


#3

Hi,
I am getting error Error type : LoadXML description : Incorrect XML.
It works in my computer and when the same code is deployed in my friends computer but it is not working . I have used dhtmlxcommon_debug.js to track the error it says bad class version and i am using java 1.5. Any idea about this? Expecting your reply soon.

Thanks,
Karthick K.


#4

While latest version of connector must work with java 5 without any problems, the jar file itself was compiled with java 6, so you may need to recompile java classes in the jar with your version of java ( jar contains full set of sources )


#5

hi,
I have used dhtmlxcommon_debug.js to track the error. It shows like this

           [b]Loading:lead.do?uid=127287565831&timeshift=-330
           status:200
           Error:
           XML: False
           Response:[/b]

What might went wrong? do you have any idea?

Thanks,
Karthick K.


#6

If nothing shows in “response” - it means servlet doesn’t output anything at all, it may be a wrong servlet or some server side error which appears before any output is started

You can try to enable logging
docs.dhtmlx.com/doku.php?id=dhtm … nd_logging


#7

Hi,
many thanks .

Regards,
Karthick K.


#8

Hi,
How to display start time and end time in 12 hour format in dhtmlxscheduler?

Thanks,
Karthick K.


#9

There are a lot of date formatting settings
docs.dhtmlx.com/doku.php?id=dhtm … ngs_config

samples/01_initialization_loading/02_hour_scale_format.html
scheduler.config.hour_date="%h:%i %A";


#10

hi,
That works. I have one more question. Is it possible to hide end date not the whole part but except end time in scheduler?

Thanks,
Karthick K.


#11

Can be done only through code customization.


#12

hi,
code customization? how? can you please explain me in detail? I have one more question.
Is it possible to show two different kind of scheduler based on a condition in a single jsp page? I tried to load scheduler using ajax but its not working. Do you have any idea? Expecting your reply soon.

Thanks,
Karthick K.


#13

It possible to change the render method of “time” form block, so it will not render unnecessary controls. Or update its get_value method to set end_date according to your custom rules.

Is it possible to show two different kind of scheduler based on a condition in a single jsp page
Nope, only one scheduler per page is possible
But you can use iframes


#14

Hi,
Thanks for your assistance.

Regards,
Karthick K.


#15

Hi,
Is it possible to use Ajax inside light box of scheduler? I am trying to load data dynamically in Combo box using Ajax but i get this java script error “Unspecified error”. Need your assistance.

Thanks,
Karthick K.


#16

Technically yes, you can call any kind of code from set_value handler of form block, but ajax calls mean asynchronous way of data loading, which can be complicated in real life scenarios.


#17

hi,
Actually this is what i did. I have a combo box in light box with data loaded from database. In on Change event i called a java script function called getStoreName(this.value) . Inside this method i am calling jsp file using Ajax where i have another combo box with data filled from database and then i am displaying that combo box into the div element of scheduler by using the code below,

document.getElementById(“storeHide”).innerHTML=xmlhttp.responseText;

Combo box gets displayed in DIV element but i get this java script error “Unspecified error”. Need your assistance.

Thanks,
Karthick K.


#18

Can you provide some kind of demo link , where issue can be reconstructed ?


#19

Can you please explain how to map this uri ,i am very new to this


#20

I am trying to run contact-manager demo in java JSF/MSSql server, having problems with the grid, after calling the method render_table in my servlet, the grid is not populated, the db connection is ok.

I am loading the library from CDN, the following error is showed in the browser:
uncaught exception: [object XMLHttpRequest] dhtmlx.js:9:31412

Is anybody using dhtmlx grid with java ?

following is my servlet script:
public class dhtmlx_Servlet extends HttpServlet {

/**
 * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
 * methods.
 *
 * @param request servlet request
 * @param response servlet response
 * @throws ServletException if a servlet-specific error occurs
 * @throws IOException if an I/O error occurs
 */
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
          throws ServletException, IOException 
{
    String data = "**** test ****";
    PreparedStatement qps;
    ResultSet rs = null;
    String city = "test";
    String sql;
    Connection conn = null;
    String username = "psv";
    String password = "psv_pw";
    com.dhtmlx.connector.GridConnector gc = null ;
    
    response.setContentType("text/html;charset=UTF-8");
    /*
    
    try {
        InitialContext ctx = new InitialContext();
        DataSource ds = (DataSource) ctx.lookup("jdbc/PsFlowWeb");
        conn = ds.getConnection(username, password);

        sql = "SELECT top 1 *, csDescripcionCiudad as city from TCiudades";
        
        qps = conn.prepareStatement(sql);
        rs = qps.executeQuery();

        if (rs.next()) {
            city = rs.getString("city");
            //response.getWriter().write("---- inside rs.next ----");
        }
        response.getWriter().write(city);
        rs.close();
        qps.close();
        conn.close();
        
    } catch (SQLException ex) {
        Logger.getLogger("DashboardDAO").log(Level.SEVERE, null, ex);
    } catch (Exception ex) {
        Logger.getLogger("DashboardDAO").log(Level.SEVERE, null, ex);
    }
   */
    
    //response.getWriter().write(data);
    
    response.setContentType("text/html;charset=UTF-8");
    
    try (PrintWriter out = response.getWriter()) 
    {
        try 
        {
            InitialContext ctx = new InitialContext();
            DataSource ds = (DataSource) ctx.lookup("jdbc/PsFlowWeb");
            conn = ds.getConnection(username, password);
            gc = new com.dhtmlx.connector.GridConnector(conn);
            gc.servlet(request, response);
            //gc.dynamic_loading(100);
            gc.enable_log("c:/PSFlow/logs/grid.log", true);
            gc.render_table("TCiudades","id","csCodigoCiudad,csDescripcionCiudad,csTipoRiesgo");
        } 
        catch (SQLException | NamingException ex) 
        {
            //Logger.getLogger(SqlServerDAOFactory.class.getName()).log(Level.SEVERE, null, ex);
        }
        
    }
   
}