struts2 获取FCK值问题
题目: 所属省份: 河南省北京 标签: 所属科目政治高数英语 板块: 普通高校民办高校
来源: 来源URL:
信息发布

Issue.action类 :cry:
import java.util.Map;
import org.apache.struts2.interceptor.SessionAware;
import com.all.dao.AdminDao;
import com.all.dao.TopicDao;
import com.all.entity.TopicEntity;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;

public class IssueAction extends ActionSupport implements SessionAware{
/**
* 文章发表 Action
*/
private static final long serialVersionUID = -3238385317493022591L;
TopicDao td = new TopicDao();
AdminDao ad=new AdminDao();
private TopicEntity topic;
@SuppressWarnings("unchecked")
private Map session;
public TopicEntity getTopic() {
return topic;
}
public void setTopic(TopicEntity topic) {
this.topic = topic;
}

public String execute() throws Exception {
    //topic.setSaid(ad.getId((String)session.get("adminName")));
    //topic.setSaid(1);
    System.out.print(session.get("adminName"));
    if (td.insertTopic(topic) == 1) {
        return Action.SUCCESS;
    } else {
        //System.out.println(ad.getId((String)session.get("adminName")));
        return Action.ERROR;
    }
}
@SuppressWarnings("unchecked")
public void setSession(Map session) {
    this.session=session;
}

}

提示错误:
Action class [cn.cstp.org.action.LoginAction] not found - action - file:/E:/Program%20Files/Apache%20Software%20Foundation/Tomcat%206.0/webapps/test-scope/WEB-INF/classes/struts.xml:7:67
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:374)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:329)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:429)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:239)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:152)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)
at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:201)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:108)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3693)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:761)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:741)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1023)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1015)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

9个回答

异常信息中的“包名”都没有楼主所定义的,是配置的问题,请检查struts.xml

检查你的配置文件 test-scope/WEB-INF/classes/struts.xml

你首先看下出错提示 Action class cn.cstp.org.action.LoginAction not found 你看下发布后的文件 和 发布前你项目编译的文件 是不是没有编译? FCK 可以设置 id 属性
在JSP页面中你可以这样获取
<%
String content = request.getParameter("content");
out.print(content);
%>

[quote]Action class [cn.cstp.org.action.LoginAction] not found - action [/quote]

在struts.xml配置的cn.cstp.org.action.LoginAction类存在么?

[quote]E:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/test-scope/WEB-INF/classes/struts.xml:7:67 [/quote]

首先检查你的配置文件struts.xml文件中第7行第67列,是什么东西?看看是不是这个地方配置文件写错了。

如果是cn.cstp.org.action.LoginAction,检查包名是否和你的Action中的包名一致,如果一致,检查你的tomcat中/webapps/test-scope/WEB-INF/classes/cn/cstp/org/action/LoginAction.class 这个class文件是否存在,如果不存在,说明你的Action没有编译,需要手工编译。

然后再重新发布,启动tomcat,再试试!

这种错误一看就明白了。
自己肯定能解决的 :D

明显的配置问题

[b]struts.xml配置文件文件错误![/b]

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问