저는 JSTL 세계에 처음 왔기 때문에 제게 친절하게 말하십시오. 이미 읽고 있었지만이 문제에 대한 해결책을 찾을 수 없었습니다.입력 상자를 잘라내어 컨텍스트에 추가 JSTL
입력 상자의 시작과 끝 모두에서 공백을 자르려고하므로 사용자가 전송 버튼을 클릭하면 내 컨트롤러는 공백없이 문자열을받습니다.
내가 이미이 문제를 겪고 있기 때문에 다른 프레임 워크를 사용하도록 제안하지 마십시오. 마스터 할 때 다음 단계로 넘어갑니다.
여기 내 JSP 코드가 있는데, 이것을 시도했지만 작동하지 않습니다. 문맥이 지나가는 값을 유지하지 못하는 것 같습니다.
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<LINK REL=StyleSheet HREF="resources/index-style.css" TYPE="text/css">
<title>Submit a new academic!</title>
</head>
<div class="home">
<a href="index"><img src="resources/home.png" /></a>
</div>
<div class="list">
<h1>This is the place where you register a new Academic on the
system!</h1>
</div>
<p></p>
<div class="list">
<form action="addAcademicAction" method="post">
<p>Submit your name:</p>
<input type="text" name="academicName"><br>
<p>Level of education</p>
<input type="radio" name="educationLevel" value="student" checked>Student<br>
<input type="radio" name="educationLevel" value="csstudent">Computer
Science Student<br> <input type="radio" name="educationLevel"
value="professor">Professor<br> <br>
<button name="submit" type="submit" value="HTML">Add
Academic!</button>
</form>
</div>
<c:if test="${context.request.method=='POST'}">
<c:set var="academicName" value="${fn:trim(param.academicName)}"/>
</c:if>
<body>
</body>
</html>
저는 이것이 그게 어렵다고 생각하지 않습니다 ... – Cristian