struts2下在命令行编译Action类时报错---程序包com.opensymphony.xwork2不存在

inuyasha1 2014-11-23 01:38:18
我在命令行编译Action类的时候一直都是报错--程序包com.opensymphony.xwork2不存在,但是我是在WEB-INF/lib文件夹里面添加了struts的必要的几个这几个jar包的,这个问题困扰了我几天还是没有解决,希望大家可以帮我解决一下,谢谢啦。


package org.crazyit.app.action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
public class LoginAction extends ActionSupport
{
//定义封装请求参数的username和password属性
private String username;
private String password;

public String getUsername()
{
return username;
}
public void setUsername(String username)
{
this.username = username;
}

public String getPassword()
{
return password;
}
public void setPassword(String password)
{
this.password = password;
}
//定义处理用户请求的execute方法
public String execute() throws Exception
{
//当username为crazyit.org,password为leegang时即登录成功
if (getUsername().equals("crazyit.org")
&& getPassword().equals("leegang") )
{
ActionContext.getContext().getSession()
.put("user" , getUsername());
return SUCCESS;
}
else
{
return ERROR;
}
}
}

不知道是什么问题就是不能解决,导致LoginAction类无法编译,谢谢大家啦
...全文
1001 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
yige635337727 2015-12-03
  • 打赏
  • 举报
回复
提问楼主怎么解决的?该jar包我已经导入进去了啊。还是没法编译
inuyasha1 2014-11-23
  • 打赏
  • 举报
回复
引用 5 楼 magi1201 的回复:
[quote=引用 3 楼 inuyasha1 的回复:] 嗯嗯,就是通过doc编译的,我也把包添加到classpath了,但是还是不行诶,在classpath下添加的路径是“C:\Users\workspace\webDemo\WebContent\WEB-INF\lib”,编译的时候还是一样的提示没有包。
都做java ee 开发了,建议楼主不要使用dos窗口进行开发了。 快使用集成开发环境吧,像eclipse或者MyEclipse,这些集成开发环境智能的多 使用IDE,是开发效率事半功倍,尤其在编译,缺少jar包方面,直接指出缺少哪个jar包,缺少哪个类等错误。[/quote] 嗯嗯,亲。谢谢了。多谢你的提心我已经解决了,万分感谢啊
姜小白- 2014-11-23
  • 打赏
  • 举报
回复
引用 3 楼 inuyasha1 的回复:
嗯嗯,就是通过doc编译的,我也把包添加到classpath了,但是还是不行诶,在classpath下添加的路径是“C:\Users\workspace\webDemo\WebContent\WEB-INF\lib”,编译的时候还是一样的提示没有包。
都做java ee 开发了,建议楼主不要使用dos窗口进行开发了。 快使用集成开发环境吧,像eclipse或者MyEclipse,这些集成开发环境智能的多 使用IDE,是开发效率事半功倍,尤其在编译,缺少jar包方面,直接指出缺少哪个jar包,缺少哪个类等错误。
inuyasha1 2014-11-23
  • 打赏
  • 举报
回复
引用 2 楼 magi1201 的回复:
你是想通过dos窗口去使用javac 编译的吗? 那你将支撑jar放到WEB-INF/lib 下面是不起作用的,需要在编译时候添加classpath 指向你的WEB-INF/lib 然后 去编译 就可以了
请问除了在doc下面编译还可以在哪里编译呢?
inuyasha1 2014-11-23
  • 打赏
  • 举报
回复
引用 2 楼 magi1201 的回复:
你是想通过dos窗口去使用javac 编译的吗? 那你将支撑jar放到WEB-INF/lib 下面是不起作用的,需要在编译时候添加classpath 指向你的WEB-INF/lib 然后 去编译 就可以了
嗯嗯,就是通过doc编译的,我也把包添加到classpath了,但是还是不行诶,在classpath下添加的路径是“C:\Users\workspace\webDemo\WebContent\WEB-INF\lib”,编译的时候还是一样的提示没有包。
姜小白- 2014-11-23
  • 打赏
  • 举报
回复
你是想通过dos窗口去使用javac 编译的吗? 那你将支撑jar放到WEB-INF/lib 下面是不起作用的,需要在编译时候添加classpath 指向你的WEB-INF/lib 然后 去编译 就可以了
inuyasha1 2014-11-23
  • 打赏
  • 举报
回复
不要沉啊,亲们求帮忙啊
struts 2.3.4.1 最新英文版API =========================================================== 概览 程序包 类 使用 树 已过时 索引 帮助 上一个 下一个 框架 无框架 所有类 ----------------------------------------------------------- Struts 2.3.4.1 API 程序包 程序包 说明 ------------------------------------------------------------ com.opensymphony.xwork2 Main XWork interfaces and classes. com.opensymphony.xwork2.config Configuration core classes. com.opensymphony.xwork2.config.entities Configuration entity classes. com.opensymphony.xwork2.config.impl Configuration implementation classes. com.opensymphony.xwork2.config.providers Configuration provider classes. com.opensymphony.xwork2.conversion com.opensymphony.xwork2.conversion.annotations Type conversion annotations. com.opensymphony.xwork2.conversion.impl com.opensymphony.xwork2.conversion.metadata Type conversion meta data classes. com.opensymphony.xwork2.inject Guice (pronounced "juice"). com.opensymphony.xwork2.inject.util Guice util classes. com.opensymphony.xwork2.interceptor Interceptor classes. com.opensymphony.xwork2.interceptor.annotations Interceptor annotations. com.opensymphony.xwork2.mock XWork specific mock classes. com.opensymphony.xwork2.ognl com.opensymphony.xwork2.ognl.accessor com.opensymphony.xwork2.spring Spring ObjectFactory classes. com.opensymphony.xwork2.spring.interceptor Spring specific interceptor classes. com.opensymphony.xwork2.test com.opensymphony.xwork2.util XWork util classes. com.opensymphony.xwork2.util.classloader com.opensymphony.xwork2.util.finder com.opensymphony.xwork2.util.fs com.opensymphony.xwork2.util.location Classes and utilities used to track location information. com.opensymphony.xwork2.util.logging com.opensymphony.xwork2.util.logging.commons com.opensymphony.xwork2.util.logging.jdk com.opensymphony.xwork2.util.profiling Classes to enable profiling of action execution. com.opensymphony.xwork2.util.reflection com.opensymphony.xwork2.validator XWork validation subsystem. com.opensymphony.xwork2.validator.annotations Validator annotations. com.opensymphony.xwork2.validator.metadata Validator meta data classes. com.opensymphony.xwork2.validator.validators XWork default validator classes. org.apache.struts2 org.apache.struts2.components org.apache.struts2.components.template org.apache.struts2.config Classes for Struts configuration and property handling. org.apache.struts2.dispatcher Classes for action dispatching in Struts (the Controller part of MVC). org.apache.struts2.dispatcher.mapper org.apache.struts2.dispatcher.multipart Classes to help dispatch multipart HTTP requests. org.apache.struts2.dispatcher.ng This package contains a reimagining of the traditional Struts filter dispatchers. org.apache.struts2.dispatcher.ng.filter org.apache.struts2.dispatcher.ng.listener org.apache.struts2.dispatcher.ng.servlet org.apache.struts2.impl org.apache.struts2.interceptor org.apache.struts2.interceptor.debugging org.apache.struts2.interceptor.validation org.apache.struts2.servlet.interceptor org.apache.struts2.util org.apache.struts2.views org.apache.struts2.views.annotations org.apache.struts2.views.freemarker org.apache.struts2.views.freemarker.tags org.apache.struts2.views.jsp Struts's JSP tag library. org.apache.struts2.views.jsp.iterator org.apache.struts2.views.jsp.ui org.apache.struts2.views.util Miscellaneous helper classes for all views. org.apache.struts2.views.velocity Classes for views using Velocity. org.apache.struts2.views.velocity.components org.apache.struts2.views.xslt The new xslt view supports an extensible Java XML adapter framework that makes it easy to customize the XML rendering of objects and to incorporate structured XML text and arbitarary DOM fragments into the output. ------------------------------------------------------------ 概览 程序包 类 使用 树 已过时 索引 帮助
Quartz是OpenSymphony开源组织在Job scheduling领域又一个开源项目,它可以与J2EE与J2SE应用程序相结合也可以单独使用。Quartz可以用来创建简单或为运行十个,百个,甚至是好几万个Jobs这样复杂的程序。Jobs可以做成标准的Java组件或 EJBs。 Quartz的优势: 1、Quartz是一个任务调度框架(库),它几乎可以集成到任何应用系统中。 2、Quartz是非常灵活的,它让您能够以最“自然”的方式来编写您的项目的代码,实现您所期望的行为 3、Quartz是非常轻量级的,只需要非常少的配置 —— 它实际上可以被跳出框架来使用,如果你的需求是一些相对基本的简单的需求的话。 4、Quartz具有容错机制,并且可以在重启服务的时候持久化(”记忆”)你的定时任务,你的任务也不会丢失。 5、可以通过Quartz,封装成自己的分布式任务调度,实现强大的功能,成为自己的产品。6、有很多的互联网公司也都在使用Quartz。比如美团 Spring是一个很优秀的框架,它无缝的集成了Quartz,简单方便的让企业级应用更好的使用Quartz进行任务的调度。   课程说明:在我们的日常开发中,各种大型系统的开发少不了任务调度,简单的单机任务调度已经满足不了我们的系统需求,复杂的任务会让程序猿头疼, 所以急需一套专门的框架帮助我们去管理定时任务,并且可以在多台机器去执行我们的任务,还要可以管理我们的分布式定时任务。本课程从Quartz框架讲起,由浅到深,从使用到结构分析,再到源码分析,深入解析Quartz、Spring+Quartz,并且会讲解相关原理, 让大家充分的理解这个框架和框架的设计思想。由于互联网的复杂性,为了满足我们特定的需求,需要对Spring+Quartz进行二次开发,整个二次开发过程都会进行讲解。Spring被用在了越来越多的项目中, Quartz也被公认为是比较好用的定时器设置工具,学完这个课程后,不仅仅可以熟练掌握分布式定时任务,还可以深入理解大型框架的设计思想。

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧