Reputation: 65
Greetings for the day. i have a jsp page which contains two text areas inside two separate form tags. i want to submit unicode date in one textarea and display it in another. But nothing is working for me. i have to show basically all Indian Languages and english as well. kindly help me. here is the code of it :
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ page pageEncoding="UTF-8" %>
<%@ page language="java" %>
<!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=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
alert("गुजरात के प्राइमरी और हाई स्कूलों में अब वही ");
</script>
</head>
<body>
<div>
<%@ include file="navigator.jsp" %>
<s:form action="content.action" method="post" >
<%request.setCharacterEncoding("UTF-8"); %>
<s:textarea name="contentBean.data" rows="10" cols="100" />
<s:submit id="submitButton" method="execute" onclick="pressed();" />
</s:form>
</div>
<div>
<form action="formAction.jsp" method="GET">
Please enter your text:
<BR>
<TEXTAREA NAME="textarea1" ROWS="10" cols="100"><s:property value="contentBean.data" /></TEXTAREA>
<BR>
<INPUT TYPE="SUBMIT" VALUE="Submit">
</form>
</div>
</body>
</html>
Upvotes: 2
Views: 6861
Reputation: 2856
Step 1 : Remove the first line
<%@ page contentType="text/html; charset=UTF-8"%> // remove this line
and put following line in your head tag
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
...
</head>
Step 2 : Make sure your jsp page's encoding is UTF-8
, right click jsp
page, properties and select UTF-8
as encoding.
Step 3: [Optional if you are not using database] If you are using database, make sure the database's collation is utf-8
, otherwise database will not store your non English data.
Upvotes: 6