📄 jworksvelocityresult.java
字号:
/**
* $RCSfile: JWorksVelocityResult.java,v $
* $Revision: 1.2 $
* $Date: 2004/08/26 11:10:26 $
*
* Copyright (C) 2002-2004 softme.org (Softme Studio). All rights reserved.
* ===================================================================
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL COOLSERVLETS INC. OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*/
package org.softme.jworks;
import org.apache.turbine.TurbineConstants;
import org.apache.turbine.services.resources.TurbineResources;
import org.apache.turbine.util.RunData;
import com.opensymphony.webwork.dispatcher.VelocityResult;
import com.opensymphony.xwork.ActionContext;
import com.opensymphony.xwork.ActionInvocation;
/**
* JWorks 的Velocity Result,将数据转换回Turbine RunData 以及Velocity Context
* @author <a href="mailto:brokendoor@sina.com">boon xiong</a>
* @version CVS $Revision: 1.2 $ $Date: 2004/08/26 11:10:26 $
*/
public class JWorksVelocityResult extends VelocityResult {
/**
* 根据操作的ActionContext返回 Turbine Velocity context,
* 设置Turbine的模板路径。
*
* @param finalLocation the location of the Velocity template
* @param invocation an encapsulation of the action execution state.
* @throws Exception if an error occurs when creating the Velocity context, loading or executing
* the template or writing output to the servlet response stream.
* @see com.opensymphony.webwork.dispatcher.WebWorkResultSupport#doExecute(java.lang.String, com.opensymphony.xwork.ActionInvocation)
*/
public void doExecute(String finalLocation, ActionInvocation invocation) throws Exception {
// TODO 处理 Turbine RunData 对象。
// Turbine 使用 data.getParameters().get("template") 获取 Page 对象
RunData data = (RunData) ActionContext.getContext().getContextMap().get(JWorksConstants.JWORKS_RUNDATA);
data.setScreenTemplate(finalLocation);
if (!data.hasScreen()) {
// BUGFIXED 设置默认的Screen类以便支持不需要Screen类的VM模板
data.setScreen(TurbineResources.getString(TurbineConstants.SCREEN_HOMEPAGE));
}
// 清除Action
data.setAction( null );
// super.doExecute(arg0, arg1);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -