누구나 간단한 Java 웹 앱 프레임 워크를 추천 할 수 있습니까?
Java에서 비교적 빠른 웹 응용 프로그램이 되길 바라는 작업을 시작하려고하지만 시도한 대부분의 프레임 워크 (Apache Wicket, Liftweb)에는 많은 설정, 구성 및 시도가 필요합니다. 이클립스와 잘 어울리도록 Maven을 둘러 보면서 주말 내내 코드의 첫 줄을 작성하는 지점에 도달하려고 노력했습니다!
Maven, 엄청나게 복잡한 디렉토리 구조 또는 수동으로 편집해야하는 수많은 XML 파일을 포함하지 않는 간단한 Java 웹 애플리케이션 프레임 워크를 추천 할 수 있습니까?
직접 해본 적은 없지만
많은 잠재력이 있습니다 ...
PHP와 고전적인 ASP에서 나에게 유망하게 들리는 최초의 자바 웹 프레임 워크입니다 ....
원래 질문 asker에 의해 수정-2011-06-09
업데이트를 제공하고 싶었습니다.
나는 Play와 함께 갔고 정확히 내가 요청한 것입니다. 구성이 거의 필요하지 않으며 즉시 사용할 수 있습니다. 가능한 한 단순하게 유지하기 위해 일반적인 Java 모범 사례를 피하는 것은 드문 경우입니다.
특히 정적 메서드를 많이 사용하고 메서드에 전달 된 변수 이름에 대한 일부 자체 검사도 수행합니다. 이는 Java 리플렉션 API에서 지원하지 않습니다.
Play의 태도는 첫 번째 목표가 유용한 웹 프레임 워크이며 일반적인 Java 모범 사례와 관용구를 고수하는 것이 그에 부차적이라는 것입니다. 이 접근 방식은 나에게 의미가 있지만 Java 순수 주의자들은 그것을 좋아하지 않을 수 있으며 Apache Wicket을 사용하면 더 나을 것 입니다.
요약하면 Ruby on Rails와 같은 프레임 워크와 비교할 수있는 편리함과 단순함으로 웹 앱을 빌드하고 싶지만 Java에서 Java 도구 (예 : Eclipse)의 이점이있는 경우 Play Framework가 훌륭한 선택입니다.
(Spring 3.0 업데이트)
나는 갈 스프링 MVC 뿐만 아니라.
여기 에서 Spring을 다운로드해야합니다.
Spring을 사용하도록 웹앱을 구성하려면 다음 서블릿을 web.xml
<web-app>
<servlet>
<servlet-name>spring-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>spring-dispatcher</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
그런 다음 Spring 구성 파일을 만들어야합니다. /WEB-INF/spring-dispatcher-servlet.xml
이 파일의 첫 번째 버전은 다음과 같이 간단 할 수 있습니다.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="com.acme.foo" />
<mvc:annotation-driven />
</beans>
그러면 Spring은 주석이 달린 클래스를 자동으로 감지합니다. @Controller
간단한 컨트롤러는 다음과 같습니다.
package com.acme.foo;
import java.util.logging.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
@RequestMapping("/person")
public class PersonController {
Logger logger = Logger.getAnonymousLogger();
@RequestMapping(method = RequestMethod.GET)
public String setupForm(ModelMap model) {
model.addAttribute("person", new Person());
return "details.jsp";
}
@RequestMapping(method = RequestMethod.POST)
public String processForm(@ModelAttribute("person") Person person) {
logger.info(person.getId());
logger.info(person.getName());
logger.info(person.getSurname());
return "success.jsp";
}
}
그리고 details.jsp
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<form:form commandName="person">
<table>
<tr>
<td>Id:</td>
<td><form:input path="id" /></td>
</tr>
<tr>
<td>Name:</td>
<td><form:input path="name" /></td>
</tr>
<tr>
<td>Surname:</td>
<td><form:input path="surname" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Save Changes" /></td>
</tr>
</table>
</form:form>
이것은 Spring이 할 수있는 일과 관련하여 빙산의 일각 일뿐입니다 ...
도움이 되었기를 바랍니다.
나는 정말 Stripes를 그루 빙하고있다 . 전체 설정에는 일부 잘라 내기 및 붙여 넣기 XML이 앱의 web.xml에 포함되어 있습니다. Stripes는 구성에 대한 관례 프레임 워크이므로 구성이 필요하지 않습니다. 기본 동작을 재정의하는 것은 Java 1.5 주석을 통해 수행됩니다. 문서는 훌륭합니다. 튜토리얼을 읽고 첫 번째 앱을 설정하는 데 약 1 ~ 2 시간이 걸렸습니다.
아직 Struts 또는 Spring-MVC에 대한 심층 비교를 할 수는 없습니다. 아직 전체 규모를 구축하지 않았기 때문에 (Struts에서와 같이) 그 수준으로 확장 될 것 같습니다. 아주 잘 건축.
http://grails.org/를 검색하고 있습니다.
You code it with groovy, a dynamic language based upon Java and runs smoothly together with Java code, classes and libraries. The syntax is neither hard to learn nor far away from Java. Give it a try, it's some minutes to get a web site up and running. Just follow http://grails.org/Installation and http://grails.org/Quick+Start
Greetz, GHad
Check out WaveMaker for building a quick, simple webapp. They have a browser based drag-and-drop designer for Dojo/JavaScript widgets, and the backend is 100% Java.
Stripes : pretty good. a book on this has come out from pragmatic programmers : http://www.pragprog.com/titles/fdstr/stripes. No XML. Requires java 1.5 or later.
tapestry : have tried an old version 3.x. I'm told that the current version 5.x is in Beta and pretty good.
Stripes should be the better in terms of taking care of maven, no xml and wrapping your head around fast.
BR,
~A
Grails is written for Groovy, not Java. AppFuse merely reduces the setup time required to get any number of Webapp frameworks started, rather than promoting any one of them.
I'd suggest Spring MVC. After following the well-written tutorials, you'll have a simple, easy model auto-wired (with no XML configuration!) into any view technology you like.
Want to add a "delete" action to your list of customers? Just add a method named "delete" to your customer controller, and it's autowired to the URL /customers/delete.
Need to bind your request parameters onto an object? Just add an instance of the target object to your method, and Spring MVC will use reflection to bind your parameters, making writing your logic as easy as if the client passed a strongly-typed object to begin with.
Sick of all the forced MVC division of labor? Just have your method return void, and write your response directly to the servlet's Writer, if that's your thing.
I like Spring MVC, using 2.5 features there is very little XML involved.
The Stripes Framework is an excellent framework. The only configuration involved is pasting a few lines in your web.xml.
It's a very straight forward request based Java web framework.
Apache Wicket, Liftweb) require so much set-up, configuration
I disagree, I use Wicket for all my projects and never looked back! it doesn't take much to set up, not even an hour to set up a full environment to work with Wicket..
Have a look at Ninja Web Framework.
It is a pure Java MVC framework in the tradition of Rails. It does not use any xml based configuration and has all you need to get started right away: Session management, Security management, html rendering, json rendering and parsing, xml rendering and parsing. It also features a built-in testing environment and is 100% compatible with traditional servlet containers.
It uses Maven, though - but Maven used correctly makes software development super simple. It also allows you to use any Ide right away :)
By the way - developing Ninja is really productive - make changes to your code and see the results immediately.
Check out: http://www.ninjaframework.org.
I like writing plain old servlets+winstone servlet container. From there I bolt on templating (velocity, XSLT, etc) and DB access (hibernate, torque, etc) libraries as I need them rather than going in for an actual framework.
Try Apache Click
It is like Wicket, but much more productive and easy to learn.
Tapestry 5 can be setup very quickly using maven archetypes. See the Tapestry 5 tutorial: http://tapestry.apache.org/tapestry5/tutorial1/
I really don't see what is the big deal with getting maven + eclipse to work, as long as you don't have to change the pom.xml too much :)
Most frameworks that user maven have maven archetypes that can generate stub project.
So basically the steps should be:
- Install maven
- Add M2_REPO class path variable to eclipse
- Generate project with the archetype
- Import project to eclipse
As for Wicket, there is no reason why you couldn't use it without maven. The nice thing about maven is that it takes care of all the dependencies so you don't have to. On the other hand, if the only thing you want to do is to prototype couple of pages than Wicket can be overkill. But, should your application grow, eventually, the benefits of Wicket would keep showing with each added form, link or page :)
The correct answer IMO depends on two things: 1. What is the purpose of the web application you want to write? You only told us that you want to write it fast, but not what you are actually trying to do. Eg. does it need a database? Is it some sort of business app (hint: maybe search for "scaffolding")? ..or a game? ..or are you just experimenting with sthg? 2. What frameworks are you most familiar with right now? What often takes most time is reading docs and figuring out how things (really) work. If you want it done quickly, stick to things you already know well.
After many painful experiences with Struts, Tapestry 3/4, JSF, JBoss Seam, GWT I will stick with Wicket for now. Wicket Bench for Eclipse is handy but not 100% complete, still useful though. MyEclipse plugin for deploying to Tomcat is ace. No Maven just deploy once, changes are automatically copied to Tomcat. Magic.
My suggestion: Wicket 1.4, MyEclipse, Subclipse, Wicket Bench, Tomcat 6. It will take an hour or so to setup but most of that will be downloading tomcat and the Eclipse plugins.
Hint: Don't use the Wicket Bench libs, manually install Wicket 1.4 libs into project.
This site took me about 2 hours to write http://ratearear.co.uk - don't go there from work!! And this one is about 3 days work http://tnwdb.com
Good luck. Tim
The web4j tool markets itself as simple and easy. Some points about it:
- uses a single xml file (the web.xml file required by all servlets)
- no dependency on Maven (or any other 3rd party tool/jar)
- full stack, open source (BSD)
- smallest number of classes of any full stack java framework
- SQL placed in plain text files
- encourages use of immutable objects
- minimal toolset required (JSP/JSTL, Java, SQL)
Grails is the way to go if you like to do the CRUD easily and create a quick prototype application, plays nice with Eclipse as well. Follow the 'Build your first Grails application' tutorial here http://grails.org/Tutorials and you can be up and running your own application in less than an hour.
You can give JRapid a try. Using Domain Driven Design you define your application and it generates the full stack for your web app. It uses known open source frameworks and generates a very nice and ready to use UI.
I haven't used it by AppFuse is designed to facilitate the nasty setup that comes with Java Web Development.
try Wavemaker http://wavemaker.com Free, easy to use. The learning curve to build great-looking Java applications with WaveMaker isjust a few weeks!
Castleframework
http://maven.castleframework.org/nexus/content/repositories/releases/
install using maven.
try Vaadin! Very simple and you'll be able to work the UI with ease as well! www.vaadin.com
I found a really light weight Java web framework the other day.
It's called Jodd and gives you many of the basics you'd expect from Spring, but in a really light package that's <1MB.
Also take a look at activeweb. its simple, lightweight and makes use of a few other things that i like (guice, maven...). Its controllers can serve anything you want including json, Html, plain text, pdfs, images... You can make restful controllers and even use annotations to determine which http methods(POST, GET, ...) a controller method accepts.
I would think to stick with JSP, servlets and JSTL After more than 12 years dealing with web frameworks in several companies I worked with, I always find my self go back to good old JSP. Yes there are some things you need to write yourself that some frameworks do automatically. But if you approach it correctly, and build some basic utils on top of your servlets, it gives the best flexibility and you can do what ever you want easily. I did not find real advantages to write in any of the frameworks. And I keep looking.
Looking at all the answers above also means that there is no real one framework that is good and rules.
Have you tried DWR? http://directwebremoting.org
Oracle ADF http://www.oracle.com/technology/products/jdev/index.html
Recently i found the AribaWeb Framework which looks very promising. It offers good functionality (even AJAX), good documentation. written in Groovy/Java and even includes a Tomcat-Server. Trying to get into Spring really made me mad.
참고URL : https://stackoverflow.com/questions/116978/can-anyone-recommend-a-simple-java-web-app-framework
'programing tip' 카테고리의 다른 글
확장자로 선택 가능한 파일 제한 (0) | 2020.11.16 |
---|---|
Git-파일을 추가하지 않습니까? (0) | 2020.11.16 |
PHPExcel 첫 번째 행을 굵게 만들기 (0) | 2020.11.16 |
Java에서 변수를 동기화하거나 잠그는 방법은 무엇입니까? (0) | 2020.11.16 |
Django Admin에서 삭제 링크를 비활성화하는 방법 (0) | 2020.11.16 |