aspose file tools*
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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!!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error on "Execute","respose" and on "comma" on Action file.