Arquivo de etiquetas: java

Struts 2 under IntelliJ IDEA 8.0M1

If you like IDEA and use Struts 2 you can be happy to know that 8.0 release comes with a new Struts 2 plugin. There is a small tutorial on how to use it but it has some errors.
First the Action class should extend ActionSupport hand have proper setter methods:

package hello;
import com.opensymphony.xwork2.ActionSupport;
public class HelloWorld extends ActionSupport {
    private String username;
    private String message;
    public String getMessage(){
        return message;
    }
    public String execute(){
        message = "Hello, " + username + ".";
        return SUCCESS;
    }
    public String getUsername() {
        return username;
    }
    public void setUsername(String username) {
        this.username = username;
    }
}

Second the JSP file can have a proper action:

< %@ page contentType="text/html;charset=UTF-8" language="java" %>
< %@ taglib prefix="s" uri="/struts-tags" %>
<html>
  <head><title>Simple jsp page</title></head>
  <body>
		Struts 2 Message: <s :property value="message" default="Guest." />
		<s :form method="GET" action="HelloWorld">
			Enter your name:<s :textfield name="username" />
			<s :submit value="Submit" />
		</s>
  </body>
</html>

And finally struts.xml can have the Action declared without the ugly unRESTFUL .action:

< ?xml version="1.0" encoding="UTF-8"?>
 
< !DOCTYPE struts PUBLIC
  "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
  "http://struts.apache.org/dtds/struts-2.0.dtd">
 
<struts>
    <package name="/" extends="struts-default">
		<action name="HelloWorld" class="hello.HelloWorld">
			<result name="success">/index.jsp</result>
		</action>
	</package>
</struts>

I really like IDEA when it comes to Java codding, and I can live with the quirks of the Struts 2 support. But one thing that makes me steam is the fact that I have to un-deploy and deploy the application for each change I make. That steals me hours every week.

Assertion `c->xlib.lock’ failed

With XCB and java graphical applications on recent distributions one gets:

java: xcb_xlib.c:82: xcb_xlib_unlock: Assertion `c->xlib.lock’ failed.

This is very well documented (just google a bit). So this serves mostly as a mental note for the way to fix it.

$ sed -i ‘s/XINERAMA/FAKEEXTN/g’ /opt/sun-jdk-1.6.0.04/jre/lib/i386/xawt/libmawt.so

or the libawt.so of your JRE. Remember that many programs may come with they’re own JRE and not use the one provided by the system.