JAVA - Introduce Line break in request


In the example bellow the recipe description had something like:

    100ml milk\r\n10g sugar

which in html corresponded to the following textarea contents:

    100ml milk
    10g sugar

    @RequestMapping("/submitRecipe")
    public String submitRecipe2(Model model, @ModelAttribute Recipe recipe, HttpServletRequest request) {
        model.addAttribute("recipe", recipe.getDescription().replace("\r\n", "%0A"));
        return "result2";
    }

Comments

Popular posts from this blog

Oracle - duplicate fields in RECORD,TABLE or argument list are not permitted

Oracle - ORA-29282: invalid file ID, ORA-06512: at "SYS.UTL_FILE"