Пользователь
Логин:
Пароль:
Забыли свой пароль?

Поиск по сайту
 

 Расширенный поиск
Реклама

 

Опрос


Погода

UI Rules

Форумы
Обновления
Поиск
Пользователи 
Правила
Помощь
Войти

Страницы: Пред. 1 2 3
UI Rules, Результат выполнения руля будет POST запрос?
Посмотрел ваершарком. Так и есть, от меня не уходит ответ (n_fields=0). фаерволов нет.
Вот код сервлета

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
int Result = 0;

try {
response.setContentType("text/html;charset=UTF-8");
// Получение из http-запроса значения параметра lasname
String lastname = request.getParameter("output_field_value_0");

CallableStatement proc = null;
//PrintWriter out = response.getWriter();
ServletOutputStream out = response.getOutputStream();

url = "jdbc:oracle:thin:@" + server + ":" + port + ":" + sid;
System.out.println(url);
Class.forName(driverName);
connection = DriverManager.getConnection(url, username, password);
//con = connectionPool.getConnection();
proc = connection.prepareCall("{ ? = call RT.oms_import_info_create(?, ?, ?) }");
proc.registerOutParameter(1, Types.INTEGER);
proc.setInt(2, 1);
proc.setInt(3, 120);
proc.setString(4, lastname);

proc.execute();
int age = proc.getInt(1);

//System.out.println("connecting: " + url);
if(connection.equals(null))
//isConnected = false;
Result = 0;
else
//isConnected = true;
Result = 1;
connection.close();
StringBuilder sb = new StringBuilder(1500);
sb.append("n_fields=0");
//out.write("n_fields=1&field_0=123");
out.write(sb.toString().getBytes("UTF8"));

//out.close();
}
catch (Exception ex) {
ex.printStackTrace();
throw new ServletException(ex);
}
//Return result;
}

Может кто-нить найдет ошибку? smile:cry:
Все получилось!!!
Ошибка была элементарная.
В сервлете нужно было описывать не doGet (ибо этот метод для GET-запросов, а SD формирует POST-запрос)

Ниже код сервлета запуска оракловой функции UI-рулём.

Всем, кто помогал огромнейшее спасибо!

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
int Result = 0;

try {
response.setContentType("text/html;charset=UTF-8");
// Получение из http-запроса значения параметра lasname
String lastname = request.getParameter("output_field_value_0");

CallableStatement proc = null;
//PrintWriter out = response.getWriter();
ServletOutputStream out = response.getOutputStream();

url = "jdbc:oracle:thin:@" + server + ":" + port + ":" + sid;
System.out.println(url);
Class.forName(driverName);
connection = DriverManager.getConnection(url, username, password);
//con = connectionPool.getConnection();
proc = connection.prepareCall("{ ? = call RT.oms_import_info_create(?, ?, ?) }");
proc.registerOutParameter(1, Types.INTEGER);
proc.setInt(2, 1);
proc.setInt(3, 120);
proc.setString(4, lastname);

proc.execute();
int age = proc.getInt(1);

//System.out.println("connecting: " + url);
if(connection.equals(null))
//isConnected = false;
Result = 0;
else
//isConnected = true;
Result = 1;
connection.close();
StringBuilder sb = new StringBuilder(1500);
sb.append("n_fields=0");
//out.write("n_fields=1&field_0=123");
out.write(sb.toString().getBytes("UTF8"));

//out.close();
}
catch (Exception ex) {
ex.printStackTrace();
throw new ServletException(ex);
}
//Return result;
}
Страницы: Пред. 1 2 3

Сегодня были (гостей: 1, пользователей: 0, из них скрытых: 0)