Skip to content

Instantly share code, notes, and snippets.

@nazartm
nazartm / binding.xml
Created January 13, 2013 15:13
Binding file for customizing JAXB.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd"
version="2.1" jaxb:extensionBindingPrefixes="xjc">
<jaxb:globalBindings>
<!-- Use java.util.Calendar instead of javax.xml.datatype.XMLGregorianCalendar for xs:dateTime -->
<jaxb:javaType name="java.util.Calendar" xmlType="xs:dateTime"
@nazartm
nazartm / pom.xml
Last active December 11, 2015 01:38
Generating WSDL using the JAX-WS Maven plugin.
<build>
<plugins>
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<goals>
<goal>wsgen</goal>
@nazartm
nazartm / pom.xml
Last active December 11, 2015 01:38
Generating Java artifacts from a WSDL using JAX-WS Maven plugin.
<build>
<plugins>
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
@WebService
@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
public class MovieSearchServiceImpl implements MovieSearchService {
@WebMethod
@Override
public SearchResult search(Filter filter) {
throw new UnsupportedOperationException("Not supported yet.");
}
}
<!DOCTYPE html>
<ui:composition template="../templates/default.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<ui:define name="title">Template client page title</ui:define>
<ui:define name="content">
public void someaction(AjaxBehaviorEvent event) {
dosomething;
}
@nazartm
nazartm / MyBean.java
Created February 3, 2013 18:50
Simple datatable in JSF with a managed bean.
@ManagedBean
@RequestScoped
public class MyBean {
private List<Book> books;
@PostConstruct
public void init() {
//retrieve books.
}
@nazartm
nazartm / BasePage.html
Created February 10, 2013 12:47
Templating in Wicket
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org" lang="en">
<head>
<meta charset="utf-8"/>
<link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico"/>
</head>
<body>
<header>
<h1>
<img src="img/logo.png" id="logo"/>
@nazartm
nazartm / AjaxPage.java
Created February 10, 2013 13:08
Ajax example in Wicket
final Form form;
// form initialize
final TextField<String> messageField = new TextField<String>("messageField", Model.of(""));
messageField.add(new AjaxFormComponentUpdatingBehavior ("onkeyup") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
myListenerMethod();
target.addComponent(form);
}
});
@nazartm
nazartm / BookDataTable.java
Created February 10, 2013 13:37
Simple datatable in Wicket
final BookProvider userProvider = new BookProvider();
IColumn[] columns = new IColumn[3];
columns[0] = new PropertyColumn(new Model("Author"), "author", "author");
columns[1] = new PropertyColumn(new Model("Title"), "title", "title");
columns[2] = new PropertyColumn(new Model("Release date"), "releaseDate", "releaseDate");
DefaultDataTable table = new DefaultDataTable("datatable", columns, BookProvider, 10);
add(table);