send arabic data in spring mvc form - spring

i have a spring form where i need to send some data in arabic so
i set the page encoding and the content type to UTF-8 like this :
<%# page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
...
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
when i display the data in the controller i get something like this ?¨???¦?³?±???§
i'm using spring 4 along with spring security, i don't know if this can be be the cause, but can it be the csrf added by spring security ?
thanks in advance

Related

One or more resources has the target of 'head' but not 'head' component has been defined within the view

I created a JSF page with PrimeFaces components. The project runs fine, but the PrimeFaces UI look and feel is completely missing. I'm only noticing below message in server log:
One or more resources has the target of 'head' but not 'head' component has been defined within the view
What does this mean and how can I fix the PrimeFaces UI styling?
This means that you're using plain HTML <head> instead of JSF <h:head> in your XHTML template. The JSF <h:head> allows automatic inclusion of CSS/JS resources in the generated HTML <head> via #ResourceDependency annotations. PrimeFaces as being a jQuery based JSF component library needs to auto-include some jQuery/UI JS/CSS files and this really requires a <h:head>.
So, search for a
<head>
<title>Some title</title>
...
</head>
in your templates and replace it by
<h:head>
<title>Some title</title>
...
</h:head>
See also:
What's the difference between <h:head> and <head> in Java Facelets?
Unable to understand <h:head> behaviour
How to programmatically add JS and CSS resources to <h:head>
How to include another XHTML in XHTML using JSF 2.0 Facelets?

Using Spring's theme resolvers and themes with a Thymeleaf template

I would like to use Spring theme resolvers' feature (see: here) in my Thymeleaf template.
What is the Thymeleaf's equivalent to the spring:theme JSP tag?
See JSP code sample below:
<%# taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<html>
<head>
<link rel="stylesheet" href="<spring:theme code='styleSheet'/>" type="text/css"/>
</head>
<body style="background=<spring:theme code='background'/>">
...
</body>
</html>
I don't think this was the case at the time that you asked your question, but the current version of thymeleaf-spring3 (2.0.18 as of this writing) has as part of the SpringStandard dialect a themes function, which can be used like this:
<body th:style="'background-color: ' + ${#themes.code('backgroundColor')}">

Spring form tag and HTML 5 still incompatible?

I am using a spring form tag
<%# taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<form:input path="name.lastName" cssClass="text" maxlength="30"/>
When I try to add the new required html5 attribute
<form:input path="name.lastName" required="required" cssClass="text" maxlength="30"/>
I get this error message when the jsp is converted to html
<pre>org.apache.jasper.JasperException: /WEB-INF/pages/admission/registration/patientForm.jsp(168,5) PWC6131: Attribute required invalid for tag input according to TLD
Are the springframework tags ready for html 5 ? If yes, how do i use them ?
I am using spring 2.5
Ok so I researched a bit more and I found out that I need to upgrade to spring mvc 3.

Spring Controller request parameter wrong encoding in one instance of Tomcat but not the others

I have a Spring MVC application which works fine in eclipse (local tomcat instance) and in a test environment where tomcat is installed as a service. But when I deploy the application in production the request parameters are not parsed correctly (Greek characters).
My server.xml configuration file in production (and in both local and test envirnonments) has the URIEncoding="utf-8" attribute on all connector elements.
I have set the CharacterEncodingFilter in web.xml.
My Jsp pages have all the
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
and
<%#page contentType="text/html" pageEncoding="UTF-8"%>
What else could be different between these Tomcat instances?
The only thing I can think off is the regional settings on windows but I hope this does not affect this?

Spring tags and facelets

Can I use Spring tags with facelets? I have one JSP page, and there is a directive:
<%# taglib prefix="s" uri="http://www.springframework.org/tags"%>
Then I can insert the tag <s:theme code='css' /> (I'm using theme resolver.) Now I need to use theme resolver in another project using facelets instead JSP. There is a namespace declaration instead the JSP directive, isn't?
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:em="http://java.sun.com/jsf/composite/emcomp"
xmlns:st="http://www.springframework.org/tags">
But in Eclipse the namespace is labeled with the warning marker and on server it does not work, because the tag library is missing, althought I have put the library Spring Web MVC in the lib directory of Eclipse Internal Glassfish server. The JAR really contains META-INF/spring.tld.
I'm unable to find, what's wrong.
No, unfortunately you cannot. Spring tags are based on a JSP taglib. Facelet taglibs are different from JSP taglibs. The reason you can use the old-fashioned jsp core tags (c:forEach etc) in facelets is because they have been ported to facelet taglibs. AFAIK, there has not been any port done yet of the Spring JSP taglib to a facelet taglib.

Resources