Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Rakesh Rajmohan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Rakesh Rajmohan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
*Something* is probably wrong with your deployment--for whatever reason the class isn't being found.
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic