Using Eclispe behind a proxy

November 19th, 2009

this link might be helpful: wiki.eclispe.org

by the way: you don’t need to store your username and password as plain text info in the ini file! For security reasons I think you should leave it out, because Eclipse will ask you for it later.

tail -f with highlighting

October 5th, 2009

Use

tail -f /path/to/my.log | perl -p -e 's/(KEYWORD_1|KEYWORD_2)/\033[7;1m$1\033[0m/g;'

to highlight all occurences of KEYWORD_1 and KEYWORD_2 in tail -f.

h:outputText in facelets

August 19th, 2009

With facelets you can omit the h:outputText tags. Instead of

    <h:outputText value="#{msg.editEmployee_name}" />

you can just write

    value="#{msg.editEmployee_name}"

Eclipse code formatting and cvs comments

July 29th, 2009

I sometimes hat the problem that the auto formatting of eclipse destroyed my cvs comments.

unordered cvs comments

But the solution is very easy. You just have to use

/*-

instead of

/*

to start the comment . That’s it and eclipse will not format your cvs comments any more.

ordered cvs comments

JSF and Enums

July 28th, 2009

Reading on the web, I found a lot of approaches to use Enums with JSF. But to be honest, I found most of them quite overdone. People are working a lot with own converters, et cetera.

But on my try, it went all without that. What I did:

- just refer to the Enum type property in the bean/object

	<h:outputText value="Art des Projekts" />
	<h:selectOneMenu value="#{projectsBean.selectedObject.type}"
		styleClass="inputfield">
		<f:selectItem itemLabel="-- not assigned --" />
		<f:selectItem itemLabel="------------" />
		<f:selectItems	value="#{optionProvider.typeOptions}" />
	</h:selectOneMenu>

- and provide al list of Enum values

	public final List getTypeOptions() {
		List typeOptions = new ArrayList();
		for (ProjectType pt : ProjectType.values()) {
			typeOptions.add(new SelectItem(pt, pt.toString().toLowerCase()));
		}
		return typeOptions;
	}

That’s it – working without any problem.

But now I am wondering, what the reason is, why all the other people make so much effort? Did I miss something? Or is my case just to trivial?

message-bundles with facelets

July 23rd, 2009

When using message bundles with facelets first, the texts did not show.

The problem is, that you need to bring the

<f:loadBundle basename="de.your.package.messageBundle.MessageResources" var="msg" />

into the right place.

If you use it inside your .jsp, you must place it inside ><ui:define>. Or you could place it into the template file. (I prefer to place it in the template.)

jboss rich faces and eclipse (url-pattern config)

July 11th, 2009

After installing the rich face libs the first time, Faces Servlet threw a null pointer exception:

11.07.2009 12:18:55 org.apache.catalina.core.StandardWrapperValve invoke
SCHWERWIEGEND: Servlet.service() for servlet Faces Servlet threw exception
java.lang.NullPointerException
	at java.lang.String.startsWith(String.java:1252)
	at java.lang.String.startsWith(String.java:1281)
	at org.ajax4jsf.webapp.WebXml.getFacesResourceKey(WebXml.java:189)
	at org.ajax4jsf.webapp.WebXml.getFacesResourceKey(WebXml.java:222)
	at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:139)
	at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:500)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	at java.lang.Thread.run(Thread.java:613)

This seems to happen, if you create a new dynamic web project with eclipse ganymede 3.4, because if you add jsf support with two url-mappings (e.g. *.jsf and /pages/*) to the project, eclipse creates the web.xml with the following servlet mapping:

    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>

This does not work with rf. You must define the url patterns separately:

    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>

This works now well for me.