0% found this document useful (0 votes)
27 views2 pages

Spring MVC Content List Example

The document outlines a simple Spring MVC application with two main components: ContentController and ContentService. The ContentController handles HTTP requests and returns a list of categories, while the ContentService manages the creation and retrieval of course and category data. The application demonstrates basic dependency injection and RESTful service implementation in Spring.

Uploaded by

Dhanashree G
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views2 pages

Spring MVC Content List Example

The document outlines a simple Spring MVC application with two main components: ContentController and ContentService. The ContentController handles HTTP requests and returns a list of categories, while the ContentService manages the creation and retrieval of course and category data. The application demonstrates basic dependency injection and RESTful service implementation in Spring.

Uploaded by

Dhanashree G
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Welcome to Print the contents of list along with the subList.

My first Spring MVC Application(30 min)

3.1 File Name: [Link]

package [Link];

import [Link];

import [Link];

import [Link];
import [Link];

@RestController

public class ContentController {

//Put your code here.

@Autowired

private ContentService NB;

@RequestMapping("/")

public List<Category> getContentList(){

List<Category> nb = [Link]();

return nb;

3.2 File Name: [Link]

package [Link];

import [Link];

import [Link];

import [Link];
import [Link];
@Service

public class ContentService {

public List<Category> NBcategories = new ArrayList<>();


//put your code here.

public List<Category> getAllContent() {

List<Course> NBcourse = new ArrayList<>();

[Link](new Course(1,"NotesBureau",200,200,1001));

[Link](new Course(1,"NotesBureau",200,200,1001));

[Link](new Course(1,"NotesBureau",200,200,1001));

List<Category> NBategories = new ArrayList<>();

[Link](new Category(1001,"NotesBureau","Lets teach and learn",NBcourse));


[Link](new Category(1001,"NotesBureau","Lets teach and learn",NBcourse));

[Link](new Category(1001,"NotesBureau","Lets teach and learn",NBcourse));

return NBategories;

You might also like