Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

JSF 2 with Tomcat 6

802518Oct 2 2010 — edited Oct 3 2010
Has anyone tried running JSF2 on Tomcat 6? I tried to do this but running into EL compatibility issues. Tried various combinations but nothing worked. I did the setup and test based on the following post.

http://weblogs.java.net/blog/cayhorstmann/archive/2009/12/29/jsf-20-and-tomcat

If anyone accomplished this, please post the following

1) list of libraries in tomcat lib
2) list of libraries in WEB-INF/lib
3) web.xml configuration

I have the following config and my sample page only displays plain HTML but not any JSF text box fields.

I added the following to tomcat lib

el-api-2.2.jar
el-impl-2.2.jar
jstl-api-1.2.jar
jstl-impl-1.2.jar

I have the following in WEB-INF/lib

jsf-api.jar
jsf-impl.jar
jstl-api-1.2.jar
jstl-impl-1.2.jar
weld-servlet.jar

My web.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID"
version="2.5">
<display-name>JsfTest</display-name>

<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>

<listener>
<listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
</listener>

<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>

</web-app>

I also have an empty beans.xml in my WEB-INF folder. This is required for Weld.

Anyone, plese help.

Comments

Answer

Stored procedures are implemented starting with ROracle 1.3.1.  This example does the following:

1. Creates a PL/SQL Procedure with one IN/OUT Parameter.

2. Executes the procedure.

3. Drops the procedure.

# Load the ROracle Library.

library(ROracle)

# Establish the connection with Oracle Database.

drv <- dbDriver("Oracle")

con <- dbConnect(drv, "username", "password")

# Define the data frame/attributes for capturing the results.

temp_output <-data.frame(emp_no = as.numeric(123), emp_name = as.character(NA), stringsAsFactors = FALSE)

attr(temp_output$emp_no,   "ora.parameter_name") <- "emp_no";

attr(temp_output$emp_no,   "ora.parameter_mode") <- "IN";

attr(temp_output$emp_name, "ora.parameter_name") <- "emp_name";

attr(temp_output$emp_name, "ora.parameter_mode") <- "OUT";

# Display the data frame.

temp_output

# Create a simple IN/OUT pl/sql procedure test_procedure1.

#INTEGER IN, VARCHAR2 OUT

dbGetQuery(con,"CREATE PROCEDURE test_procedure1

(emp_no IN INTEGER, emp_name OUT VARCHAR2)

IS

BEGIN

    SELECT first_name INTO emp_name  FROM employees WHERE employee_id=emp_no;

END;");

# Exeucte the procedure.

oracleProc(con,'BEGIN test_procedure1(:emp_no,:emp_name);END;',temp_output)

# Display the data frame.

temp_output

# Drop the procedure test_procedure1.

dbGetQuery(con,"DROP PROCEDURE test_procedure1")

# Disconnect

dbDisconnect(con)

dbUnloadDriver(drv)

Sherry

Marked as Answer by BG4GRAPH · Sep 27 2020
BG4GRAPH

Hi @"Sherry Lamonica-Oracle",

thanks for the detailed instructions. I noticed just one point: the output parameter is not transfered to temp_output, instead I called

res <- oracleProc(con,'BEGIN test_procedure1(:emp_no,:emp_name);END;',temp_output)

and the the dataframe "res" containes the output.

Yours, user8632123.

1 - 2
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Oct 31 2010
Added on Oct 2 2010
3 comments
2,543 views