wood burning stoves 2.0*
The moose likes Struts and the fly likes The import org.apache.struts cannot be resolved (ActionForm cannot be resolved to a type) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "The import org.apache.struts cannot be resolved (ActionForm cannot be resolved to a type)" Watch "The import org.apache.struts cannot be resolved (ActionForm cannot be resolved to a type)" New topic
Author

The import org.apache.struts cannot be resolved (ActionForm cannot be resolved to a type)

Rakesh Rajmohan
Greenhorn

Joined: Jul 09, 2009
Posts: 22
Hello.. When I run my web application from Eclipse, I get the above error. (But I have all library/.jar files needed, including struts.jar in my 'Web App Libraries' of Eclipse). Not sure what exactly is the problem.

I get exception the org.apache.jasper.JasperException: Exception in JSP: /loginPage.jsp:48

48: <html:form action="/login" type="inputforms.org.gov.csr.form.LoginForm" name="LoginForm" onsubmit="return loginvalidation(this);" scope="request">

and the below as root cause

root cause

javax.servlet.ServletException: Unresolved compilation problems:
The import org.apache.struts cannot be resolved
ActionForm cannot be resolved to a type

org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.loginPage_jsp._jspService(loginPage_jsp.java:523)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
inputforms.org.gov.csr.bd.LoginFilter.doFilter(LoginFilter.java:81)


root cause

java.lang.Error: Unresolved compilation problems:
The import org.apache.struts cannot be resolved
ActionForm cannot be resolved to a type

inputforms.org.gov.csr.form.LoginForm.<init>(LoginForm.java:3)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
java.lang.reflect.Constructor.newInstance(Unknown Source)
java.lang.Class.newInstance0(Unknown Source)
java.lang.Class.newInstance(Unknown Source)
org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:231)
org.apache.struts.taglib.html.FormTag.initFormBean(FormTag.java:542)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:520)
org.apache.jsp.loginPage_jsp._jspService(loginPage_jsp.java:138)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
inputforms.org.gov.csr.bd.LoginFilter.doFilter(LoginFilter.java:81)

(JRE - 1.5 Tomcat - 5.5) All the needed class files are in place.. Any help around this would be grateful. Thanks!
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Rakesh Rajmohan wrote:I get exception the org.apache.jasper.JasperException: Exception in JSP: /loginPage.jsp:48
48: <html:form action="/login" type="inputforms.org.gov.csr.form.LoginForm" name="LoginForm" onsubmit="return loginvalidation(this);" scope="request">

I'm afraid there is some property called "type" in html:form tag. Also html:form takes its bean form the action mapping, no need to defined "type".

HTH


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Rakesh Rajmohan
Greenhorn

Joined: Jul 09, 2009
Posts: 22
Hello.. This is my include directive..

<%@ taglib uri="/WEB-INF/struts-html" prefix="html" %>

Also the type mapping is for my actionForm and not for my action whose mapping is available in action mapping.

The important thing is, the same projects runs in other machine, but not in mine..

Not sure whats going wrong
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

*Something* is probably wrong with your deployment--for whatever reason the class isn't being found.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Rakesh Rajmohan wrote:Hello.. This is my include directive..
<%@ taglib uri="/WEB-INF/struts-html" prefix="html" %>


I didn't ask this, I pointed out the absence of "type" attribute in html:form tag, see the link I posted earlier.
Rakesh Rajmohan wrote:Also the type mapping is for my actionForm and not for my action whose mapping is available in action mapping.

Geerally, the html:form has an action whose "mapping" is given in struts-config.xml with associated Action Form "name". In you canse the entry for same action will be like this;



Rakesh Rajmohan wrote:The important thing is, the same projects runs in other machine, but not in mine..

I'm really clueless about this things
 
Don't get me started about those stupid light bulbs.
 
subject: The import org.apache.struts cannot be resolved (ActionForm cannot be resolved to a type)
 
Similar Threads
Unable to create form bean
Getting exception on deployment to Tomcat using JSF
javax.servlet.ServletException: Name java: is not bound in this Context
form page cannot find ActionMappings or ActionFormbeans
Newbie in JSF Question