Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Other Application Frameworks and the fly likes Struts Spring Integration problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Struts Spring Integration problem" Watch "Struts Spring Integration problem" New topic

Struts Spring Integration problem

waqas shahwar

Joined: Sep 17, 2003
Posts: 19
I have copied web.xml file and in that file I have also attached code that is copied from from struts-config.xml and applicationcontext.xml and Action Class.

But I still get that error message HTTP 404 Servlet Action is not available
Could any one can help

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="" xmlns:xsi="" xsi:schemaLocation="">



/*************************(Spring Struts Configuration)ApplicationContext.xml**************************************

- <bean name="/login" class="sunny.pages.LoginAction" lazy-init="default" autowire="default" dependency-check="default">
- <property name="sunnyService">
<ref bean="sunnyService" />
<!-- <bean name="/login" scope="prototype" autowire="auto"

- <!-- <action name="LoginForm" path="/login" scope="request" type="sunny.pages.LoginAction" validate="false">
<forward name="success" path="/WEB-INF/success.jsp"/>
<forward name="failure" path="/login.jsp"/>
- <action path="/login" type="org.springframework.web.struts.DelegatingActionProxy" name="LoginForm" scope="request" validate="false" parameter="method">
<forward name="success" path="/WEB-INF/success.jsp" />
<forward name="failure" path="/login.jsp" />

/**************************Action Class***************************************/

public class LoginAction extends ActionSupport

/* forward name="success" path="" */
private final static String SUCCESS = "success";
private final static String FAILURE = "failure";
final Logger LOG = Logger.getLogger(SunnyServiceImpl.class);
* This is the action called from the Struts framework.
* @param mapping The ActionMapping used to select this instance.
* @param form The optional ActionForm bean for this request.
* @param request The HTTP Request we are processing.
* @param response The HTTP Response we are processing.
* @throws java.lang.Exception
* @return
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception
LoginForm formBean = (LoginForm)form;
String name = formBean.getName();
String email = formBean.getEmail();

// perform validation
if ((name == null) || // name parameter does not exist
email == null || // email parameter does not exist
name.equals("") || // name parameter is empty
email.indexOf("@") == -1)
{ // email lacks '@'

return mapping.findForward(FAILURE);

ApplicationContext ctxt=getWebApplicationContext();
SunnyService service=(SunnyService) ctxt.getBean("sunnyService");
ProductType obj=new ProductType("try1");
LOG.debug("Product Type Added: " +obj );
return mapping.findForward(SUCCESS);


Many thanks>
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Well first the applicationContext.xml files should not have a URL mapping in it, just your service beans. I don't see the sunnyService configured in your applicationContext.xml


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: Struts Spring Integration problem
It's not a secret anymore!