如果使用 DWR 和 JqGrid,我们必须在 JqGrid 中进行哪些更改? java而不是AJAX & PHP?

发布于 2024-09-16 19:18:34 字数 317 浏览 2 评论 0原文

首先,我必须声明自己,我不懂 PHP 和 PHP。阿贾克斯。我了解 DWR、javaScript 和 Java 等方面的知识。 java,就像我能够使用它们创建基于 Web 的 CRUD 一样。我想集成 DWR 和JAVAjQGrid。我为此做了很多研究。我找不到任何使用 JAVA 和 Java 的东西。 jqGrid 中的 DWR。

任何概念性想法或解决方案都将受到赞赏。 任何在线链接将更加感激。

提前致谢。

First, i have to declare myself that, i dont know PHP & AJAX. I know something in DWR, javaScript & java, like i am able to create a Web based CRUD by using them. I want to integrate DWR & JAVA with the jQGrid. I did a lot of research for that. I am not able to find anything that uses JAVA & DWR in jqGrid.

Any conceptual idea or solution will be appreciative.
Any online links will be more appreciative.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

骷髅 2024-09-23 19:18:34

您询问了可能的解决方案的概念想法。我尝试简短地描述一种可能的方法。我如何从你之前的问题中了解到你是 JavaScript 和 jQuery 的初学者。所以我尝试写简单明了的描述解决方案的架构。

您的 Web 应用程序可以由纯 HTML 或 XHTML 页面(没有任何 JSP 页面)组成,并通过 加载和启动 Javascript 文件;。您将 HTML/XHTML 标记放置在 *.htm 文件中,并将 jqGrid 的定义放置在 *.js 文件中。

jqGrid有三个重要的参数mtype,通常是“GET”或“POST”,datatype以及诸如“xml”或“json”之类的值以及url代码>参数。这三个参数定义了网格的填充方式。还有editurlcwich用于CRUD操作。因此,您可以在 Java 中实现 servlet(请参阅 例如,如何在 Java Web 应用程序中使用 jQuery 学习 AJAX),这可能是解决方案中绑定到 urlediturl 并支持 HTTP GET 或 POST 取决于您的 mtype 选择。它将像一个 Web 服务一样工作,为 jqGrid 提供数据并实现所有 CRUD 操作。

jqGrid 将向 servlet 发送一些标准参数。您可以使用 jqGrid 的 prmNames 参数更改 servlet 的此输入参数的名称(请参阅 http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options)。 servlet 方法最重要的参数是以下int page、int rows、string sidx、string sord。如果您想使用在 jqGrid 中进行单一搜索bool _search,字符串过滤器(如果是 高级搜索。因此,用户单击“下一页”jqGrid 按钮或单击网格列标题对数据进行排序,您的 servlet 将由 jqGrid 使用相应的输入参数值调用。

这样你就有了清晰的解决方案结构。我不确定您是否需要 DWR。只需尝试了解如何使用 jQuery.ajax 来调用 Java servlet。如果您在 jqGrid 内部实现相同的技术时遇到一些问题,您可以自定义 jQuery.ajax 请求,该请求将由 jqGrid 使用 ajaxGridOptions jqGrid 参数发送。您还可以使用 jqGrid 的 serializeGridData 事件(请参阅 http://www.trirand.com/jqgridwiki/doku.php?id=wiki:events#list_of_events) 在数据发送到 servlet 之前实现任何数据转换并使用 jsonReader 或xmlReader(请参阅 http://www.trirand.com/jqgridwiki/doku .php?id=wiki:retriving_data)定义了 jqGrid 如何读取从服务器返回的数据。

You asked about conceptual idea of a possible solution. I try shortly describe a possible way. How I could understend from your previous question you are a beginner in JavaScript and jQuery. So I try to write simple and clear describe the arcitectur of the solution.

Your Web application can consist of pure HTML or XHTML pages (without any JSP pages) with Javascript files loaded and started throght <script type="text/javascript" src="..."></script>. You place HTML/XHTML markup in your *.htm files and the definition of jqGrid in *.js files.

jqGrid has three important parameter mtype which are typically "GET" or "POST", datatype withe the values like "xml" or "json" and url parameter. This three parameters defins how the grid will be filled. There are also editurl cwich are used for CRUD operations. So you can implement a servlet in Java (see How to learn AJAX using jQuery in a Java web app for example) which could be the only active component in your solution which bound to the URL defined by url and editurl and support HTTP GET or POST depend of your mtype choice. It will work like a web service which provide the data for the jqGrids and implement all CRUD operations.

jqGrid will send to servlet some standard parameters. The names of this input parameters of the servlet you can change with prmNames parameter of jqGrid (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options). The most important parameters of the servlet method are following int page, int rows, string sidx, string sord. Adfditional parameters could be also bool _search, string searchField, string searchOper, string searchString if you want to use single searching in th jqGrid or bool _search, string filters in case of advanced searching. So it user click on the "next page" jqGrid button or click on the grids column header to sort the data, your servlet will by called by jqGrid with the corresponding values of the imput parameters.

In the way you have clear structure of your solution. I am not sure that you will need DWR. Just try to find how you can use jQuery.ajax to call your Java servlets. If you will have some problems with implemented the same technique inside of jqGrid you can customize jQuery.ajax requests which will be send by jqGrid with ajaxGridOptions jqGrid parameter. You can also use serializeGridData event of jqGrid (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:events#list_of_events) to implement any data conevrsion before the data will be snd to the servlet and use use jsonReader or xmlReader (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:retrieving_data) which define how the data returned from the server should be readed by jqGrid.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文