2015-01-12 3 views
-1

PopUpUtil.showerrorMessagae ("this is helloWorld"+ "\" ""hai ");Java의 JDeveloper 문자열의 개행 문자

JDeveloper Java 코드를 사용하여 다음 행에서 hai를 인쇄하는 방법을 시도했습니다. "hai"가 같은 줄에 인쇄하는 것이 나를 위해 일하고 있습니다.

감사합니다.

답변

0

af : 메시지에서 "\ n"을 사용하여 새 줄을 지정할 수 없습니다. 이를 달성하려면 PopUpUtil.showerrorMessagae 메소드를 수정하여 각각의 새 행에 대해 새 FacesMessage을 갖도록해야합니다. 여러 메시지 팝업을 보여주는 코드는 다음과 같이 표시됩니다

FacesMessage fm = new FacesMessage("this is helloWorld"); 
FacesMessage fm2 = new FacesMessage("hai"); 
fm.setSeverity(FacesMessage.SEVERITY_ERROR);  
fm2.setSeverity(FacesMessage.SEVERITY_ERROR); 
FacesContext context = FacesContext.getCurrentInstance(); 
context.addMessage(null, fm); 
context.addMessage(null, fm2); 
+0

내가 팝업 무엇입니까 참조 점검은이

PopupUtil.showErrorMessage("<html><body>this is hello world<br/> hai</body></html>"); 

을 시도하지만 내가해야 할 것은 이것이다 "처럼 hello world "라는 줄이 있고 그 바로 아래에는"\ n "을 사용하여 새 줄의 텍스트를 얻는 방법과 같은"hai "가 필요합니다. –

+0

내가 지정한 코드를 사용해 보셨습니까? 그것은 당신에게 새로운 라인에 "하이"를 줄 것입니다. 그냥 PopUpUtil.showerrorMessagae ("this is helloWorld"+ "\ n"+ "hai")를 대체하십시오. 위의 코드로 – amishra