在GAE(google appengine)中应用sitemesh

阅读更多

http://groups.google.com/group/google-appengine-java/browse_thread/thread/1e3868a6a2661585首先参考这篇文章,修改一下sitemesh中的Factory.class。然后将修改后的包加入到gae项目中就可以啦。

下面是我的配置文件

 

web.xml文件,注意红色部门直接写“*”, 不用加"/"

  




	
		sitemesh
		com.opensymphony.module.sitemesh.filter.PageFilter
	

	
		sitemesh
		*
	


	
		dispatcher
		org.springframework.web.servlet.DispatcherServlet
		1
	
	
		dispatcher
		*.htm
	
	
		index.jsp
	


 

 

接下来在WEB-INF/下面新建一个decorators文件加,里面写个main.jsp

decorators.xml文件 注意红色字体,路径要写正确

/WEB-INF/decorators">
	
		/*
	

 

 

main.jsp 文件,很简单。

<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator"
	prefix="decorator"%>
<%@ taglib uri="http://www.opensymphony.com/sitemesh/page" prefix="page"%>





<span style="color: #ff0000;"><decorator:title default="这里随便放什么都行" /></span>main



纵贯线北京演唱会


没有票真可惜

 

 

sitemesh.xml文件


	
		
		
		
	

	
		
			
		
	
 

 

补充两个;

1 中文页面上传乱码问题可以参考这篇文章

http://www.jxva.com/blog/personal-diary/change-the-google-app-engine's-javac-compiler-encoding.html

上面无法访问的也可以看这个javaeye网友转载http://struts.iteye.com/blog/367952

 

2 上传出错问题,根据我这几天上传出错的经验 下面这个错误90%以上是jsp页面错误引起的

!MESSAGE Unable to upload app: Failed to compile java files.

See the Eclipse error log for more details
!STACK 0
com.google.appengine.tools.admin.AdminException: Unable to upload app: Failed to compile java files.
	at com.google.appengine.tools.admin.AppAdminImpl.update(AppAdminImpl.java:47)
	at com.google.appengine.eclipse.core.proxy.AppEngineBridgeImpl.deploy(AppEngineBridgeImpl.java:203)
	at com.google.appengine.eclipse.core.deploy.DeployProjectJob.runInWorkspace(DeployProjectJob.java:97)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.lang.RuntimeException: Failed to compile java files.
	at com.google.appengine.tools.admin.Application.compileJavaFiles(Application.java:363)
	at com.google.appengine.tools.admin.Application.compileJsps(Application.java:326)
	at com.google.appengine.tools.admin.Application.createStagingDirectory(Application.java:235)
	at com.google.appengine.tools.admin.AppAdminImpl.update(AppAdminImpl.java:39)
	... 4 more

 

ps 今天特地学习的sitemesh,网上一搜,99%的中文文章都是重复的,天下文章一大抄啊。

你可能感兴趣的:(Google,GAE,Java,Eclipse,Servlet)