Compilation error in java for struts application.
Hello,
I'm a newbie in java and struts, i was trying a simple struts application given in "struts complete reference".This is my code of its Controller class(Action class):-
package com.jamesholmes.struts;
import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public final class SearchAction extends Action
{
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws Exception
{
EmployeeSearchService service = new EmployeeSearchService();
ArrayList results;
SearchForm searchForm = (SearchForm) form;
//Perform employee search based on what criteria was entered.
String name = searchForm.getName();
if(name != null && name.trim().length() > 0)
{
results = service.searchByName(name);
}
else
{
results = service.searchBySsNum(searchForm.getSsNum().trim());
}
//place search results in SearchForm for access by jsp.
searchForm.setResults(results);
//Forward control to this Action's input page.
return mapping.getInputForward();
}
}
Now problem is when i'm compiling this java file i'm getting error"can not resolve symbol" for the instances i'm creating for SearchForm(view class) and EmployeeSearchService(model class).can any one help me how to resolve this error. I've tried importing those classes explicitly also, but error gets increased this way.
[1802 byte] By [
Garva] at [2007-11-27 4:56:45]

# 4
Tht problem is solved, it was a mistake frm my side in compilation precedure.Anyway, now the real error-After i compiled and created the war file of application, i was running it in tomcat and got this Error, it is i guess a server sprcific error which i am unable to understand., can any one now help me solving this out?Error is this :-
HTTP Status 500 -
--
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NullPointerException
org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:521)
org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:436)
org.apache.struts.taglib.html.LinkTag.calculateURL(LinkTag.java:495)
org.apache.struts.taglib.html.LinkTag.doStartTag(LinkTag.java:353)
org.apache.jsp.index_jsp._jspx_meth_html_link_0(index_jsp.java:96)
org.apache.jsp.index_jsp._jspService(index_jsp.java:69)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.27 logs.
--
Apache Tomcat/5.0.27
Garva at 2007-7-12 10:11:59 >
