简体   繁体   English

现有Java应用程序的Web UI

[英]Web UI for existing Java application

I am trying to build a search engine using java and the lucene API as part of a project. 我正在尝试使用Java和Lucene API作为项目的一部分来构建搜索引擎。 For the last step, we plan to build a web UI (a local host would do) for the same. 对于最后一步,我们计划为此构建一个Web UI(本地主机可以这样做)。 Are there UI softwares/plugins for eclipse which will allow me to call the functions present in the java classes? 是否有用于Eclipse的UI软件/插件可以让我调用java类中存在的函数?

Essentially I would want to have a search box and a search key, pressing which will throw up the search results(which is computed from the java program). 本质上,我希望有一个搜索框和一个搜索键,按会抛出搜索结果(该结果是从Java程序计算得出的)。 javascript cannot call java code I understand. javascript无法调用我理解的Java代码。 So using that is eliminated? 因此,使用它被消除了吗?

Any suggestions on what to use will be greatly appreciated. 关于使用什么的任何建议将不胜感激。 I have pretty poor knowledge in front end design! 我对前端设计的知识很差!

Cheers! 干杯! AB AB

I think, If your using JAVA, that you should look into JSF. 我认为,如果您使用JAVA,则应该研究JSF。 It's a rather easy to maintain and work with library for just the uses you describe. 对于您所描述的用途,维护和使用库非常容易。

I recommend these tutorials to get you started: http://www.coreservlets.com/JSF-Tutorial/jsf2/#Tutorial-Intro 我推荐这些教程来帮助您入门: http : //www.coreservlets.com/JSF-Tutorial/jsf2/#Tutorial-Intro

There are lots of options to achieve this. 有很多选择可以实现这一目标。 you can create web-ui using jsp. 您可以使用jsp创建web-ui。 I have also created same type of project using Lucene, here i have used spring mvc.i have provided all the back-end process as REST api which any web-ui can use. 我还使用Lucene创建了相同类型的项目,在这里我使用spring mvc.i提供了所有后端过程作为REST api,任何web-ui都可以使用。

Please do not look into JSF; 请不要研究JSF; it is an overengineered pile for your task. 这是您完成任务的过度设计。

Sure you can call your java code from javascript, you can make it really simple with something like DWR. 当然,您可以从javascript调用Java代码,并且可以使用DWR之类的工具使其变得非常简单。

However, for your project I would suggest GWT as then you only deal with Java and it will generate javascript, html and css for you. 但是,对于您的项目,我建议您使用GWT,因为那时您仅处理Java,它将为您生成javascript,html和css。

For your project you dont really need an "enterprise" level framework like spring or a fullstack JavaEE, you could keep it real oldschool with only JSPs and html/javascript. 对于您的项目,您实际上并不需要像Spring或全栈JavaEE这样的“企业”级框架,只需使用JSP和html / javascript,就可以使其保持真正的传统。 However thats a bit too flaky for my taste, so go with GWT. 但是,就我的口味而言,那有点片状,所以选择GWT。

With GWT you basically set it up, define your module, entrance point (look at the hello world), and then you add a layout to your page like something to place the searchbox into and the resultbox to. 使用GWT,您基本上可以进行设置,定义模块,入口点(看看世界),然后将布局添加到页面中,就像将搜索框放置到结果框中一样。 Then you call your other Java code and classes from there like you normally would. 然后,您可以像通常那样从那里调用其他Java代码和类。

I would suggest you to use GWT in your application because GWT enables you to call java methods and it will also convert Javascript and css for your Java modules after GWT compile. 我建议您在应用程序中使用GWT,因为GWT允许您调用Java方法,并且GWT编译后还将转换Java模块的Javascript和CSS。 GWT reference :- http://code.google.com/webtoolkit/gettingstarted.html GWT参考:-http: //code.google.com/webtoolkit/gettingstarted.html

If all you have is a simple screen with a entry field and a button and you simply want to return an html table. 如果您只有一个带有输入字段和按钮的简单屏幕,而您只想返回一个html表。 I would go with a servlet and two jsps. 我将使用一个servlet和两个jsps。 Your servlet can call your search engine and then have the jsp format the data into the table. 您的servlet可以调用您的搜索引擎,然后让jsp将数据格式化到表中。 If you do not know web apis this is probably the easiest entry. 如果您不知道Web API,那么这可能是最简单的输入。

If you're going to use GWT, you could aslo check Vaadin . 如果您要使用GWT,也可以检查Vaadin

Creating a search UI is really simple, and the tutorial show a criteria /result table application taht could be adapted. 创建搜索UI非常简单,并且该教程显示了可以修改的条件/结果表应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM