Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Struts and the fly likes Error on Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Error on "Execute","respose" and on "comma" on Action file." Watch "Error on "Execute","respose" and on "comma" on Action file." New topic
Author

Error on "Execute","respose" and on "comma" on Action file.

divya sharma
Ranch Hand

Joined: Jan 25, 2007
Posts: 87
Hello,

I am writting a program for HR application using struts 1.2.

It's a Action file.. but when every I wrote :
"public class SearchAction extends Action{
{
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response ) throws Exception "

It's shows and error on "execute","response " and for comma(",") IDE say's ";" semicolon is required.

here is my full Action file. Plese help me to resolve it.
package com.jamesholemes.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 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;

String name = searchForm.getName();
if(name!=null && name.trim().length() >0)
{
result=service.searchByName(name);
}
else
{
result = service.searchBySsNum(searchForm.getSsNum().trim());
}
searchForm.setResult(results);

return mapping.getInputForward();
}


}

}

Thanks


Divya
Bhaskar Reddy
Ranch Hand

Joined: Dec 17, 2002
Posts: 52
Please check the syntax in your code and change the bold ones appropriately...

public class SearchAction extends Action{
{
public ActionForward execute(ActionMapping mapping;
ActionForm form;
HttpServletRequest request;
HttpServletResponse response ) throws Exception
divya sharma
Ranch Hand

Joined: Jan 25, 2007
Posts: 87
Hi,

Thanks for reply!!

Well for "Execute" it says "Illegal modifier for parameter execute; only final is permitted"
and for "Respose" it says "Syntax error, insert ";" to complete LocalVariableDeclarationStatement"

Thanks
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You have an extra curly brace ({) at the beginning of the class and another at the end. Remove them.


Merrill
Consultant, Sima Solutions
divya sharma
Ranch Hand

Joined: Jan 25, 2007
Posts: 87
Thanks a ton!!!
 
jQuery in Action, 2nd edition
 
subject: Error on "Execute","respose" and on "comma" on Action file.