• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a ton!!!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic