关于struts2-jquery-showcase-3.6.0.war部署

关于struts2-jquery-showcase-3.6.0.war部署,struts2,struts2-jquery,Struts2,Struts2 Jquery,是否有人尝试部署struts2-jquery-showcase-3.6.0.war 我从 并在eclipse和 也从sources jar的同一链接获取了源代码 目前,应用程序已启动并运行良好,但 当我对申请进行演练时,我发现了一个观察结果: 项目结构 web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app id="struts2-jquery-showcase" version="2.4" xmlns="http

是否有人尝试部署struts2-jquery-showcase-3.6.0.war 我从

并在eclipse和 也从sources jar的同一链接获取了源代码

目前,应用程序已启动并运行良好,但

当我对申请进行演练时,我发现了一个观察结果:

项目结构

web.xml

  <?xml version="1.0" encoding="UTF-8"?>
<web-app id="struts2-jquery-showcase" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

    <display-name>Struts jQuery Plugin - Showcase</display-name>

    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

</web-app>

Struts jQuery插件-Showcase
支柱2
org.apache.struts2.dispatcher.ng.filter.strutspreadexecutefilter
支柱2
/*
index.jsp
index.jsp

<% response.sendRedirect("index.action"); %>

ShowCase.java

    /*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package com.jgeppert.struts2.jquery.showcase;

import java.util.HashMap;
import java.util.Map;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;

import com.opensymphony.xwork2.ActionSupport;

public class ShowCase extends ActionSupport {

    private static final long serialVersionUID = -7133848243722723891L;
    private String theme = "showcase";
    private boolean google = false;
    private boolean ajaxhistory = false;
    private Map<String, String> themes;

    @Action(value = "/index", results = { @Result(location = "index.jsp", name = "success") })

    public String execute() throws Exception {

        System.out.println("in showcase action.......");

        themes = new HashMap<String, String>();

    themes.put("cupertino", "The cupertino Theme");
    themes.put("ui-darkness", "The darkness Theme");
    themes.put("ui-lightness", "The lightness Theme");
    themes.put("redmond", "The redmond Theme");
    themes.put("smoothness", "The smoothness Theme");
    themes.put("black-tie", "The black-tie Theme");
    themes.put("blitzer", "The blitzer Theme");
    themes.put("dark-hive", "The dark-hive Theme");
    themes.put("dot-luv", "The dot-luv Theme");
    themes.put("eggplant", "The eggplant Theme");
    themes.put("excite-bike", "The excite-bike Theme");
    themes.put("flick", "The flick Theme");
    themes.put("hot-sneaks", "The hot-sneaks Theme");
    themes.put("humanity", "The humanity Theme");
    themes.put("le-frog", "The le-frog Theme");
    themes.put("mint-choc", "The mint-choc Theme");
    themes.put("overcast", "The overcast Theme");
    themes.put("pepper-grinder", "The pepper-grinder Theme");
    themes.put("south-street", "The south-street Theme");
    themes.put("start", "The start Theme");
    themes.put("sunny", "The sunny Theme");
    themes.put("swanky-purse", "The swanky-purse Theme");
    themes.put("trontastic", "The trontastic Theme");
    themes.put("vader", "The vader Theme");

    themes.put("showcase", "The custom Showcase Theme");

    return SUCCESS;
    }

    public String getTheme() {
    return theme;
    }

    public void setTheme(String theme) {
    this.theme = theme;
    }

    public Map<String, String> getThemes() {
    return themes;
    }

    public boolean isGoogle() {
    return google;
    }

    public void setGoogle(boolean google) {
    this.google = google;
    }

    public boolean isAjaxhistory() {
    return ajaxhistory;
    }

    public void setAjaxhistory(boolean ajaxhistory) {
    this.ajaxhistory = ajaxhistory;
    }
}
/*
*向Apache软件基金会(ASF)授权
*一个或多个参与者许可协议。见通知文件
*与此工作一起分发以获取更多信息
*关于版权所有权。ASF许可此文件
*根据Apache许可证,版本2.0(
*“许可证”);除非符合规定,否则您不得使用此文件
*带着执照。您可以通过以下方式获得许可证副本:
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*除非适用法律要求或书面同意,
*根据许可证分发的软件在
*“按原样”的基础上,没有任何
*种类,无论是明示的还是暗示的。请参阅许可证以获取详细信息
*管理权限和限制的特定语言
*根据许可证。
*/
包com.jgeppert.struts2.jquery.showcase;
导入java.util.HashMap;
导入java.util.Map;
导入org.apache.struts2.convention.annotation.Action;
导入org.apache.struts2.convention.annotation.Result;
导入com.opensymphony.xwork2.ActionSupport;
公共类ShowCase扩展了ActionSupport{
私有静态最终长serialVersionUID=-7133848243722723891L;
私有字符串主题=“showcase”;
私有布尔google=false;
私有布尔值ajaxhistory=false;
私人地图主题;
@操作(value=“/index”,results={@Result(location=“index.jsp”,name=“success”)})
公共字符串execute()引发异常{
System.out.println(“展示中的动作……);
主题=新的HashMap();
主题。put(“库比蒂诺”,“库比蒂诺主题”);
主题。放置(“ui黑暗”,“黑暗主题”);
主题。放置(“ui轻”、“轻主题”);
主题。放置(“雷蒙德”,“雷蒙德主题”);
主题。放置(“平滑”,“平滑主题”);
主题。放置(“黑领带”、“黑领带主题”);
主题。放置(“闪电战”,“闪电战主题”);
主题。放置(“黑暗蜂巢”、“黑暗蜂巢主题”);
主题。put(“点luv”,“点luv主题”);
主题。放置(“茄子”、“茄子主题”);
主题。放置(“激励自行车”,“激励自行车主题”);
主题。放置(“flick”,“flick主题”);
主题。放置(“热溜”,“热溜主题”);
主题。put(“人性”、“人性主题”);
主题。放置(“乐蛙”,“乐蛙主题”);
主题。放置(“薄荷巧克力”,“薄荷巧克力主题”);
主题。放置(“阴天”、“阴天主题”);
主题。放置(“胡椒研磨机”,“胡椒研磨机主题”);
主题。put(“南街”、“南街主题”);
主题。放置(“开始”,“开始主题”);
主题。放置(“阳光”、“阳光主题”);
主题。放置(“时髦钱包”,“时髦钱包主题”);
主题。put(“trontastic”,“trontastic主题”);
主题。放置(“维德”,“维德主题”);
主题。放置(“showcase”,“自定义showcase主题”);
回归成功;
}
公共字符串getTheme(){
回归主题;
}
公共void集合主题(字符串主题){
this.theme=主题;
}
公共地图获取主题(){
返回主题;
}
公共布尔值isGoogle(){
返回谷歌;
}
公共void setGoogle(布尔google){
this.google=google;
}
公共布尔值isAjaxhistory(){
返回历史记录;
}
公共无效setAjaxhistory(布尔ajaxhistory){
this.ajaxhistory=ajaxhistory;
}
}
struts.xml

    <?xml version="1.0" encoding="UTF-8" ?>
<!--
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
-->

<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
    "http://struts.apache.org/dtds/struts-2.3.dtd">

<struts>
    <constant name="struts.enable.DynamicMethodInvocation" value="false" />
    <constant name="struts.devMode" value="true" />
    <constant name="struts.convention.action.packages" value="com.jgeppert.struts2.jquery.showcase"/>
    <constant name="struts.convention.default.parent.package" value="json-default"/>
    <constant name="struts.custom.i18n.resources" value="messages" />


    <!-- Settings for CKEditor Image Upload -->
    <constant name="struts.ckeditor.allowUploads" value="true" /> <!-- default is false -->
    <constant name="struts.ckeditor.allowedFileExtensions" value="jpg,jpeg,png" />
    <constant name="sstruts.ckeditor.uploadFolder" value="/imageUploads" />

    <!-- include file="showcase.xml" / -->
</struts>

现在,当结果“success”呈现时,它将重定向到文件夹“content”中名为“index.jsp”的页面,即层次结构路径“WEB-INF/content/index.jsp”

我的问题是 当结果的位置属性中未提及内容时,如何将其重定向到内容文件夹内的页面?

当我让项目在调试模式下运行时,我开始了解content/index.jsp。
我搜索了整个项目,但找不到“内容”的痕迹

WAR项目包括
struts2-convention-plugin-2.3.14.2.jar
插件

此插件允许您使用
约定
消除XML配置。要使其工作,JSP页面必须放在
WEB-INF/
文件夹中

这就是struts.xml和showcase.xml不定义动作映射的原因

有关更多信息,请参阅

你可以阅读:


默认情况下,约定插件假定所有结果都存储在WEB-INF/content中。可以通过将struts属性文件中的属性struts.convention.result.path设置为新位置来更改此设置。

是否检查了
struts.xml
文件?@CristianMeneses:是的,老板。。。很抱歉,我没有粘贴struts.xml代码..我知道。。但在WEB-INF/“content”文件夹之后应该有什么东西吗。这就像我们不能给任何其他文件夹。是吗?\如果我将“content”的名称更改为“content1”,则会出现404错误。约定插件在
WEB-INF/content
中搜索JSP。检查我给你的URL,部分
结果和结果代码
:)树/网格文件夹的情况也是如此?你可以看到树和网格
WEB-INF/content/
文件夹在src/packages(
com.jgeppert.struts2.jquery.showcase.tree)中有对应关系