日期:2014-05-19  浏览次数:20591 次

大侠们,小弟有问题请教,为什么我ssh配好后不能进action,jsp也要通过WEBROOT进
我的web.xml配置<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
  <display-name></display-name>
  <welcome-file-list>
  <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  
  <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>
  <listener>
  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
  <context-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>classpath:beans.xml</param-value>
  </context-param>

<context-param> 
  <param-name>log4jConfigLocation</param-name> 
  <param-value>classpath:log4j.properties</param-value> 
  </context-param> 
 <listener> 
  <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> 
 </listener>
  
</web-app>
UserAction配置package com.jj.register.actions;

import javax.annotation.Resource;
import javax.faces.application.Application;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Scope;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Component;

import com.jj.register.model.User;
import com.jj.register.service.UserManager;

import com.opensymphony.xwork2.ActionSupport;
@Component("user")
@Scope("prototype")
public class UserAction extends ActionSupport{

UserManager um;
String username;
String password;
String passwordcomform;

@Override
public String execute() throws Exception {
// TODO Auto-generated method stub
User u=new User();
u.setName(username);
u.setPassword(password);
if(um.isExits(u))
{
return "failure";
}
um.add(u);
return SUCCESS;
}
public UserManager getUm() {
return um;
}
@Resource(name="usermanager")
public void setUm(UserManager um) {
this.um = um;
}
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;
}
public String getPasswordcomform() {
return passwordcomform;
}
public void setPasswordcomform(String passwordcomform)