2017-02-02 1 views
0

제출할 때 양식의 모든 데이터를 전자 메일 작업에 게시 한 다음 일반 텍스트로 확인 전자 메일을 렌더링하는 연락처 양식이 있습니다. 데이터는 정상적으로 처리되지만 일부 줄은 줄 바꿈을 무시합니다.JSP 일반 텍스트 메일 줄 바꿈을 렌더링하지 않습니다.

JSP : 당신이 볼 수 있듯이

<%@ page language="java" contentType="text/plain;" %><%@ page import="com.shared.Configuration" %><%@ taglib uri="/WEB-INF/jstl-core.tld" prefix="c" %>Contact Us Form: ${issue} 

Name: ${name} 
Email Address: ${emailAddress} 
<c:if test="${not empty accessCode}">Access Code: ${accessCode}</c:if> 
<c:if test="${not empty itemId}">Inventory Number: ${itemId}</c:if> 
<c:if test="${not empty title}">Title: ${title}</c:if> 
<c:if test="${not empty device_active}">User Device: ${device}</c:if> 
<c:if test="${not empty os_active}">User Operating System/Version: ${operatingSystem}</c:if> 
<c:if test="${not empty browser_active}">User Web Browser/Version: ${webBrowser}</c:if> 
<c:if test="${hasError eq 'Y' or hasError eq 'N'}"><c:choose><c:when test="${hasError eq 'Y'}">Error Message: ${errorMessage}</c:when><c:otherwise>No Error message was present</c:otherwise></c:choose></c:if> 
<c:if test="${not empty otherDetails}">Other Details: ${otherDetails}</c:if> 
<c:if test="${not empty problemDetails}">Problem Details: ${problemDetails}</c:if>** 

는, IF 조건문이 많이 있습니다 사용자가 그 어떤 정보를 입력하지 않은 경우, 기본적으로, 사람들은, 공간 절약 등의 장소에 필드를 입력 한 다음 전자 메일에 넣지 마십시오.

Mac OS X Mail 클라이언트는 모든 웹 기반 클라이언트와 마찬가지로 메일을 잘 렌더링합니다. 전망이 좋은 재생되지 않는 유일한 사람이며, 같은 자사의 이메일을 렌더링 :

아웃룩 이메일 결과 : 라인은 사용자 OS, 사용자 브라우저, 오류 메시지 및 문제에서 휴식

Contact Us Form: Can't access the extra PlayBack+ features 

Name: me 
Email Address: [email protected] 
Access Code: aqwsedrftgyhuj87 
Inventory Number: 12345678 
Title:Title: this track 
User Device: Desktop 
User Operating System/Version: Mac OS 10.9.5 User Web Browser/Version: Chrome 55 Error Message: 
Other Details:no other details Problem Details: 
세부 정보가 제자리에 없습니다. 사무실의 아무도 해결책이 없습니다. 아무도 거기에 무슨 일이 일어나고 있는지 알아?

답변

0

나는 세 곳에서 문제를 검색 할 것입니다 :

1)

그것은 JSP의 새로운 라인에 대한 비 인쇄 문자에 문제가있을 수 있습니다.

<c:if ...></c:if>\r\n 
<c:if ...></c:if>\n 
<c:if ...></c:if>\r 

새로운 라인 코드는 다른 OS에 다릅니다
윈도우 : \r\n.
유닉스 : \n
상세 정보 : wikipedia

이 편집기에서 보이지 문자를 찾습니다. 예를 들어 메모장에서 ¶을 클릭하면 ++.
차이가있을 경우 통합하십시오.

2) EL 변수 개행 문자 그들의 값을 포함하는 경우

체크.
잘못된 구문 분석 또는 적절하게 삭제/정리 된 문자열을 사용하지 않아 발생할 수 있습니다.

EL 평가 방법 ${operatingSystem}? Mac OS 10.9.5\r
개행 문자가 있습니까? 예인 경우. 변수를 설정하기 전에 문자열을 다듬 으십시오. 이전의 2 가능성과

3)을 조합

는 trimDirectiveWhitespaces이 간섭하는 것도 가능하다.

배포 설명자 웹을 확인하십시오.XML은에 블록 비슷한 포함

<%@ page trimDirectiveWhitespaces="false"%> : 많은 경우에 적합한하게 trimDirectiveWhitespaces true로 설정하면

<jsp-config> 
    <jsp-property-group> 
    <url-pattern>*.jsp</url-pattern> 
    <trim-directive-whitespaces>true</trim-directive-whitespaces> 
    </jsp-property-group> 
</jsp-config> 

을, 당신은 JSP에 줄을 추가하여이 특별한 경우에 그것을 비활성화 할 수 있습니다 Remove Spacing between JSP variables

:

여기에 몇 가지 예를 봐

관련 문제