Google App Engine for JavaでSlim3を試してみました。
とりあえずは、slim3-read-onlyをSubversionから落としてきて、IndexとAddだけ動くようにと。
JSPで日本語が文字化けるとの事でしたけど、エラーメッセージはちゃんと日本語で出るんですよね。
また、Javaコードで日本語を書いてみると、これも表示されました。
JSPに直接日本語を書いたら文字化けるようです。
なもんで、application_ja.propertiesに画面に出すような日本語を定義してあげて、
ひょっとしたらここ数日で対応したんかも知らんけども、一応ね。
http://muneodoll.appspot.com/add/ (いつまであるかわかんないけど)
コードはこんな感じ
AddController.java
public class AddController { @Required @IntegerType public String arg1; @Required @IntegerType public String arg2; public String hoge; public String fuga; public Integer result; @Execute(validate = false) public ActionForward index() { hoge = "日本語は?"; fuga = ""; return new ActionForward("index.jsp"); } @Execute(input = "index.jsp") public ActionForward submit() { fuga = hoge; result = Integer.valueOf(arg1) + Integer.valueOf(arg2); return new ActionForward("index.jsp"); } }
add/index.jsp
<%@page pageEncoding="UTF-8"%> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> <%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> <%@taglib prefix="html" uri="http://struts.apache.org/tags-html"%> <%@taglib prefix="bean" uri="http://struts.apache.org/tags-bean"%> <%@taglib prefix="tiles" uri="http://jakarta.apache.org/struts/tags-tiles"%> <%@taglib prefix="s" uri="http://www.slim3.org/tags"%> <%@taglib prefix="f" uri="http://www.slim3.org/functions"%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title><bean:message key="messages.add.title" /></title> <link rel="stylesheet" type="text/css" href="../css/global.css" /> </head> <body> <h1><bean:message key="messages.add.title" /></h1> <html:errors/> <s:form> <html:text property="hoge" />${f:h(fuga)} <br /> <html:text property="arg1"/> + <html:text property="arg2"/> = ${f:h(result)}<br /> <input type="submit" name="submit" value="<bean:message key="messages.add.submit" />"/> </s:form> </body> </html>
application_ja.properties
messages.add.title=足し算+α messages.add.submit=サブミット