我编写了一个代码来将用户添加到DB中.当我们收到重复的条目时,我需要重定向到EmpInfo.jsp.我需要使用更多的例外,我也想知道如何重定向.
response.setContentType("text/html");
PrintWriter out = response.getWriter();
Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";
String dbName = "cervlet";
String driver = "com.mysql.jdbc.Driver";
String userName = "root";
String password = "1234";
int Empid =Integer.parseInt(request.getParameter("Empid").toString());
String Name = request.getParameter("Name").toString();
int Age =Integer.parseInt(request.getParameter("Age").toString());
int Salary =Integer.parseInt(request.getParameter("Salary").toString());
PreparedStatement stmt;
try {
Class.forName(driver).newInstance();
conn = DriverManager.getConnection(url+dbName,userName,password);
System.out.println("Connected to the database");
//ArrayList al=null;
//ArrayList userList =new ArrayList();
String query = "insert into employee set Empid='"+Empid+"',name='"+Name+"',Age='"+Age+"',Salary='"+Salary+"'";
stmt = (PreparedStatement) conn.prepareStatement(query);
int i = 0;
try {
i …Run Code Online (Sandbox Code Playgroud) 当我输入"python"时,它会显示:
ActivePython 2.6.5.14 (ActiveState Software Inc.)
based on Python 2.6.5 (r265:79063, Jul 4 2010, 21:05:58)
[MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Run Code Online (Sandbox Code Playgroud)
这是我在命令行得到的:
>>> python create-application.py
File "<stdin>", line 1
python create-application.py
^ SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)
我该怎么做才能在Qooxdoo工作.