2013年12月18日星期三

In jsp page, how to get the box with jstl tag behind the Chinese characters ? ( 1 , how to get value ; 2 , how to solve the garbage problem occurs when jsp page display )

In the index.jsp page, with a form form :




China




Britain




U.S.




France




Germany








The question now is :
I want checkbox.jsp page, by jstl tag , "China ", "British ", " America ", " France " , "Germany" , however , I use $ {paramValues.country}, get results are:

china
english
ç ¾?? å?? ½
æ ³?? å?? ½
å ¾ · å?? ½

1, did not get the string " China ", and got the string "china"
2, how to solve the garbage problem occurs when jsp page display

how to solve these two problems , please advise , thank you ! Points is not enough , you can add points.




------ Solution ------------------------------------ -------- body content
checkbox.jsp : To introduce <% @ taglib prefix = "fmt" uri = "http://java.sun.com/ jsp / jstl / fmt "%>
<body>
  <fmt:requestEncoding value="utf-8" />
  <c:forEach items="${paramValues.country}" var="pic">
   <c:if test="${pic=='china'}">
<c:out value="中国" ></c:out>
</c:if>
<c:if test="${pic=='english'}">
<c:out value="英国" ></c:out>
</c:if>
<c:if test="${pic!='english' && pic!='china'}">
<c:out value="${pic }" ></c:out>
</c:if>
  </c:forEach>
  </body>
pageEncoding this case as the case is utf-8 , and you look at your first line of his jsp coded as much , if also utf-8 and I wrote on the same line , if not the same < fmt: requestEncoding value = "utf-8" /> the value will change what encoding on the line
------ For reference only ------------- --------------------------
China coupled with hidden labels like then take .
------ For reference only ------------------------------------ ---
extra points if you can , I have too many oh. . Oh
------ For reference only ------------------------------------- -
extra points if you can , I have too many oh. . Oh  

Thank you , Oh, I'm a novice user , just to give you extra points , you can prompted " extra points failed, not enough points available , currently available points : 0 ," I do not know what is the reason ?

This first 40 points to you, so after more than a minute , give you , huh.


------ For reference only ---------------------------------- -----
extra points if you can , I have too many oh. . Oh          
  
Thank you , Oh, I'm a novice user , just to give you extra points , you can prompted " extra points failed, not enough points available , currently available points : 0 ," I do not know what is the reason ?   
  
This first 40 points to you, so after more than a minute , give you , huh.   
  
  Oh , joke, helpfulness Mo

没有评论:

发表评论