File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
divya sharma
Ranch Hand
Posts: 87
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Bhaskar Reddy
Ranch Hand
Posts: 52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 87
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have an extra curly brace ({) at the beginning of the class and another at the end. Remove them.
 
divya sharma
Ranch Hand
Posts: 87
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a ton!!!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic