Java 我必须为Struts 2中的BaseConroller类添加哪个jar文件?
我使用下面的代码 这是我在Struts 2中读到的,但我无法导入BasceCntoller类。谁能告诉我丢失了哪个jar文件Java 我必须为Struts 2中的BaseConroller类添加哪个jar文件?,java,struts2,tiles2,Java,Struts2,Tiles2,我使用下面的代码 这是我在Struts 2中读到的,但我无法导入BasceCntoller类。谁能告诉我丢失了哪个jar文件 请帮助我。提前谢谢。如果您刚刚开始使用Struts2,我建议您从Struts2主页下载并运行它们 这些示例应用程序附带必需的JAR,这些JAR至少应该存在,以便运行Struts2应用程序 或者,如果您可以继续使用maven,我建议您使用创建示例Struts2应用程序,并让maven下载并提供运行示例应用程序所需的所有依赖项。我还没有找到Struts2的BaseContr
请帮助我。提前谢谢。如果您刚刚开始使用Struts2,我建议您从Struts2主页下载并运行它们 这些示例应用程序附带必需的JAR,这些JAR至少应该存在,以便运行Struts2应用程序
或者,如果您可以继续使用maven,我建议您使用创建示例Struts2应用程序,并让maven下载并提供运行示例应用程序所需的所有依赖项。我还没有找到Struts2的BaseController,它看起来像是Spring MVC类。我没有使用过这个类,但是它是spring-webmvc.jar,它通常包含接口。S2iA的目标是Struts 2.0,一个非常旧的版本 无论如何:
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.ServletActionContext;
import org.apache.tiles.AttributeContext;
import org.apache.tiles.context.TilesRequestContext;
import org.apache.tiles.preparer.ViewPreparer;
import com.opensymphony.xwork2.util.ValueStack;
import com.strutsschool.db.DB;
public class BaseController implements ViewPreparer {
private Log log = LogFactory.getLog(this.getClass());
protected DB db;
private ValueStack stack;
public void execute(TilesRequestContext tilesContext,
AttributeContext attributeContext) {
stack = (ValueStack) tilesContext.getRequestScope().get(ServletActionContext.STRUTS_VALUESTACK_KEY);
}
public ValueStack getStack() {
return stack;
}
public DB getDb() {
return db;
}
public void setDb(DB db) {
this.db = db;
}
}
嗨,伙计,欢迎来到Stackoverflow!:)你应该在你的帖子中添加一些相关的代码,以防你的链接被破坏。因此,您将确保您的代码/内容可供未来的观众使用。thanx的建议,但您能告诉我为Tiles controller(preparer)BaseContoller类添加了哪个jar文件吗?公平地说,您正在查看六年前的S2文档--最好参考相关文档。@DaveNewton Thnx先生,我是Struts 2的新手,我希望使用更多的struts 2概念。你能给我推荐最新版本的链接吗。