• 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

messageNo action instance for path /aa could be created and Help for retrive data

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

i am new in struts
i jsp page for insert delete and update to database. insert work but i dont know how i can get data form database and delete it from there
when i delete i got error like"messageNo action instance for path /aa could be created"
here is my strts-config.xml for delete

<form-beans>
<form-bean name="DeleteActionForm" type="com.myapp.struts.DeleteActionForm"/>
</form-beans>
<action-mappings>
<action input="/Delete.jsp"
name="DeleteActionForm"
path="/aa"
scope="session"
type="com.myapp.struts.DeleteAction">
<forward name="success" path="/Dsuccess.jsp"/>
<forward name="fail" path="/Dnot.jsp"/>
</action>
</action-mappings>


and my action class is like

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class DeleteAction extends org.apache.struts.action.Action {

@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
String url = "jdbc:mysql://localhost:3306/";
String driverName = "com.mysql.jdbc.Driver";
String dataBase = "emp";
String userName = "root";
String password = "root";
Connection connection = null;
try {
//Connection and driver

Class.forName(driverName);
connection = DriverManager.getConnection(url + dataBase, userName, password);
connection.setAutoCommit(true);

} catch (Exception e) {
System.out.println(e.getMessage());
}

Statement stmt=connection.createStatement();
String Dbdelete =
"Delete from emp.delete where firstName='+firstName+' and lastName='+lastName+'";
int deleteData=stmt.executeUpdate(Dbdelete);

if(deleteData==0){
return mapping.findForward("fail");
}else{
return mapping.findForward("success");
}

}}

i dont knw where i make mistake..............

i also need to help for update also

i dont knw how i retrive that data and
and then call that in my jsp file
my action calss is like this
package com.myapp.struts.Employee_Dis.Action.Updata;
public class update_Action extends org.apache.struts.action.Action {
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
//Driver config
String url = "jdbc:mysql://localhost:3306/";
String driverName = "com.mysql.jdbc.Driver";
String dataBase = "emp";
String userName = "root";
String password = "root";
Connection connection = null;
try {
//Connection and driver
Class.forName(driverName);
connection = DriverManager.getConnection(url + dataBase, userName, password);
connection.setAutoCommit(true);
} catch (Exception e) {

System.out.println("connection not establish");
System.out.println(e.getMessage());

}
Statement stmt = connection.createStatement();

ResultSet update = stmt.executeQuery("SELECT * FROM emp.emp WHERE firstName = '+firstName+'");
while (update.next()) {
String firstName = update.getString("firstName");

String lastName = update.getString("lastName");
}
stmt.close();
connection.close();
if (update == null) {
return mapping.findForward("error_update");
} else {
return mapping.findForward("success_update");
}
}
}
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic