[Open Source] bsf. mvc spingboot extension, bsf. mvcspingboot

Source: Internet
Author: User

[Open Source] bsf. mvc spingboot extension, bsf. mvcspingboot

The springboot extension makes springboot development easier. It forms a demo template and makes development easier in the future.

Open Source Address: https://gitee.com/chejiangyi/bsf.mvc/tree/master/

1. Automatic requestmapping (no configuration required.
2. freemarker java extension implementation makes freemarker easier to use.
3. The request parameter is case-insensitive.
The date parameter is compatible and supports automatic public ing between objects and public fields.
4. the url is case-sensitive.
5. Provides default page control.
6. Support for. net mvc.

1. Automatic requestmapping (no configuration required.
1/*** sprinboot extension implementation, automatic requestmapping (public, return value: ModelAndView type/or subclass) method 3 */4 public class SpringMvcDemoController extends SpringMvcController {5 public ModelAndView index (Integer a, String B) 6 {7 return this. pageVisit (m-> {8 // page control implementation description 9 new Pager1 ). setPageSize (10 ). out (); 10}); 11} 12 13 14 public ModelAndView index2 () 15 {16 return new ModelAndView (); 17} 18}
Configuration in the application. properties file to accelerate automatic ing startup.
# Bsf. mvc automatic requestmapping injection package path, separated by commas
Bsf. mvcpackage = com. bsf. mvc. webdemo. controller
 
2. freemarker java extension implementation makes freemarker easier to use.
Freemarker page
$ {Html. s ("pagetitle", "Edit category") }$ {Html. g ("pagetitle") }$ {Html. p (model. createtime) }$ {Html. w (c. selected, "selected = 'selected '","")}

Background code

/*** TemplateProvider Abbreviation: extended, so that the page template can be inherited, constant expansion */public class SimpleTemplateProvider extends TemplateProvider {/*** getattr method abbreviation */public Object g (String key) {return getattr (key );} /*** setattr method abbreviation */public void s (String key, Object value) {setattr (key, value );} /*** where abbreviation */public Object w (boolean istrue, Object trueObj, Object falseObj) {return where (istrue, trueObj, falseObj );} /*** print abbreviation */public String p (Object o) {return print (o );}}

5. Provides default page control.

Freemaker

<# Macro _ pager formid = "searchForm" >$ {pagehtml !} <Script type = "text/javascript">
// Js paging callback function pagerfunction (pageindex) {$ ("#$ {formid }"). prepend ("<input type = 'den den 'name = 'pageindex' value ='" + pageindex + "'/>"); $ ("#$ {formid }"). prepend ("<input type = 'den den 'name = 'pagesize' value ='" + '$ {pagesize !} '+ "'/>"); $ ("#$ {Formid}"). submit () ;}</script> </# macro>

Background code

new Pager1(pageindex,count).setPageSize(10).out();
 
6. Support for. net mvc.
 
/*** Extended springboot simulation. net mvc syntax * must inherit from NetController */public class NetMvcDemoController extends NetMvcController {public ActionResult index (Integer a, String B) {// page control implementation description new Pager1 ). setPageSize (10 ). out (); return view ();} public ActionResult index2 () {List a = new ArrayList <String> (); return view ("/netmvcdemo/index2 ", a) ;}public ActionResult json () {List a = new ArrayList <String> (); return json ();}}
 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.