Building a Multi-Vendor Campus Food Sharing Platform with Java, SSM, and JSP

Technology Stack

Backend Framework: Spring

Spring provides a comprehensive programming and configuration model for Java-based enterprise applications. Its core features include dependency injection (DI) and aspect-oriented programming (AOP), which help in creating loosely coupled, testable, and maintainable code. The framework simplifies the development of complex applications by handling infrastructure concerns, allowing devleopers to focus on business logic.

Frontend Framework: JSP (JavaServer Pages)

JSP is a technology that enables the creation of dynamically generated web pages based on HTML, XML, or other document types. It allows Java code to be embedded directly into the HTML content, facilitating the separation of presentation and business logic. JSP pages are compiled into servlets, providing a powerful way to build server-side web applications.

Core Implementation Code

Application Entry Point

package com.platform;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.mybatis.spring.annotation.MapperScan;

@SpringBootApplication
@MapperScan("com.platform.mapper")
public class CampusFoodApp extends SpringBootServletInitializer {
    public static void main(String[] args) {
        SpringApplication.run(CampusFoodApp.class, args);
    }
}

User Management Controller

package com.platform.controller.user;

import com.platform.model.entity.User;
import com.platform.service.UserService;
import com.platform.utils.ResponseResult;
import com.platform.utils.AuthUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
@RequestMapping("/api/user")
public class UserController {
    @Autowired
    private UserService userService;

    @PostMapping("/authenticate")
    public ResponseResult authenticateUser(@RequestParam String loginId,
                                           @RequestParam String passKey,
                                           HttpServletRequest req) {
        User account = userService.findByLoginId(loginId);
        if (account == null || !account.getPassKey().equals(passKey)) {
            return ResponseResult.error("Invalid credentials provided.");
        }
        String authToken = AuthUtil.createToken(account.getId(), loginId, "user", "Regular User");
        return ResponseResult.success().put("authToken", authToken);
    }

    @PostMapping("/create")
    public ResponseResult createUser(@RequestBody User newUser) {
        User existing = userService.findByLoginId(newUser.getLoginId());
        if (existing != null) {
            return ResponseResult.error("User account already exists.");
        }
        newUser.setId(System.currentTimeMillis());
        userService.save(newUser);
        return ResponseResult.success();
    }

    @GetMapping("/profile/{userId}")
    public ResponseResult getUserProfile(@PathVariable("userId") Long userId) {
        User user = userService.findById(userId);
        return ResponseResult.success().put("userData", user);
    }

    @PutMapping("/update")
    public ResponseResult updateUser(@RequestBody User user) {
        userService.update(user);
        return ResponseResult.success();
    }

    @DeleteMapping("/remove")
    public ResponseResult removeUsers(@RequestBody Long[] ids) {
        userService.batchRemove(ids);
        return ResponseResult.success();
    }
}

System Testing

Testing Objectives

System testing validates that the integrated software meets specified requierments and identifies discrepancies. It is a critical phase to insure reliability, functionality, and user satisfaction before deployment. The process involves executing the system in various scenarios to uncover defects in logic, data handling, and user interface interactions.

Functional Testing Approach

Black-box testing techniques are applied to each functional module. Test cases are designed based on requirement specifications, focusing on input validation, boundary conditions, and workflow sequences. For instance, the authentication module is tested with valid/invalid credentials, locked accounts, and role-based access controls.

Testing Outcomes

After comprehensive testing, the system demonstrated correct behavior across all major use cases. Functional flows for user registration, vendor management, food posting, and review sharing operated as intended. Performance under typical load met the design criteria. The testing phase confirmed the platform's readiness for operational use.

Tags: java SSM Framework JSP Campus System Multi-Vendor Platform

Posted on Thu, 23 Jul 2026 16:43:33 +0000 by yousaf931