开发者

Are there any plugins or modules like Django flatpages for Java in Spring?

开发者 https://www.devze.com 2023-03-20 23:04 出处:网络
Current I use Django and Python for web development. I know Java, Spring, and Hibernate but not to an advance开发者_开发知识库d level.

Current I use Django and Python for web development.

I know Java, Spring, and Hibernate but not to an advance开发者_开发知识库d level.

My main aim is to build a website with user registration and some static pages.

Now in Django, the flat pages modules are best for static pages and this is most commonly used.

Is there anything like that which I can use in Java with Spring? So that I don't have to code. Because I find it very hard to code the whole administration section for simple websites.


A simple way to serve up static pages would be to create a simple Controller that has a basic ReqestMapping which takes a PathVariable. Create static pages for each identifier and let the Controller serve them up. As follows:

@Controller
public class StaticPagesController {
  @RequestMapping("/static/{id}/view.do")
  public String subscribersListingHandler(@PathVariable String id) {
     return id;
  }
}

In the above, id is the name of the JSP file. Example call: http://myapp.com/static/about/view.do.

0

精彩评论

暂无评论...
验证码 换一张
取 消