Showing posts with label struts. Show all posts
Showing posts with label struts. Show all posts

Monday, December 21, 2015

Struts 1.2 in WebLogic 12.1.3, german characters encoding issue

"As of WebLogic Server 12.1.3, the default value of the encoding element for the jsp-descriptor element in weblogic.xml is UTF-8 for JSP pages. Prior to WebLogic Server 12.1.3, the default value for JSP encoding was ISO-8859-1."
If you have issues
1) Add <%@ page contentType="text/html;charset=UTF-8" %> line on top of every jsp page. 

 2) Add 
 <properties>
 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
 </properties>

 In pom.xml  

 3) Add 
 <filter>
 <filter-name>struts2</filter-name>
 <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
 </filter>
 <mime-mapping>
 <extension>jsp</extension>
 <mime-type>text/html;charset=UTF-8</mime-type>
 </mime-mapping>
 In web.xml 

 4) Add 
 <jsp-config>
 <jsp-property-group > 
 <url-pattern>*.jsp</url-pattern>
 <page-encoding>UTF-8</page-encoding>
 </jsp-property-group>
 </jsp-config> in web.xml – 

5) Add <constant name="struts.i18n.encoding" value="UTF-8"/> In struts-config.xml 


 6) change text encoding to UTF-8 in the properties file. 

7) Add the below to your weblogic.xml.

<charset-params>
 <input-charset>
   <resource-path>/*</resource-path>
   <java-charset-name>ISO8859-1</java-charset-name>
 </input-charset>
</charset-params> 


(see oracle Support "Default JSP Encoding Changed to UTF-8 (Doc ID 2053210.1)" )

(it should be ISO8859-1, not ISO8859_1)

Also, to determine which encoding you are actually using, check in your html for "<meta http-equiv="content-type" content="text/html; charset=utf-8" /> " . And in the browser (IE in my case) you have a menu "view-encoding"...



Tuesday, March 29, 2011

Struts Royally Sucks

I have heard that 100s of times, and I have vague memories of myself struggling, some 7 years ago, against Struts quirks and all those HORRIBLE tag libraries (writing code in XML? Noooooo way.).

I have even hoped to be able to mock Struts, instead of having to deploy in container,
using this http://strutstestcase.sourceforge.net/ framework...

I use MockStrutsTestCase in a very basic setup and I get this:


java.lang.UnsupportedOperationException: getPathTranslated operation is not supported!
at servletunit.HttpServletRequestSimulator.getPathTranslated(HttpServletRequestSimulator.java:635)



no matter what I try...

So I am switching to MockRunner which so far seems to work.

There are also plugins for JUnit and Maven:
http://struts.apache.org/2.2.1/docs/struts-2-junit-plugin-tutorial.html
http://struts.apache.org/2.0.14/docs/testng-plugin.html


This framework is THE BLACK WIDOW MAKER of Front End Developers.


My advice: just throw Struts in the toilet and flush, you will immediately feel an intense relief. Then implement your Front End in Spring MVC or Vaadin.





Here more reasons why Struts sucks.

Wednesday, February 2, 2011

Web Frameworks comparison

here a brilliant and thorough research on the topic

http://raibledesigns.com/rd/date/20101118

read slide 7 (or 8?) on Struts...