Acegi and JSF

Hello,
I am using Acegi security system in my JSF app. Seems to working fine so far. However, I have a huge problem with securechannelfilter. Im not sure if that's a Acegi problem or JSF. So, I'm trying my luck in this forum first.
As in many web applications of today required, I as well want to secure certain pages by using a HTTPS connection (personal data and billing information pages). Acegi uses a filter to switch automatically between HTTP and HTTPS pages. Those pages are defined in the security configuration of Acegi. This seems to work "as designed". However, if the URL is http://www.myhost/mywebapp/myhttpspage.jsf it is changed into http://www.myhost/mywebapp/myhttpspage.jsp (notice .jsp instead of .jsf). Calling the latter URL will cause a FacesContext not found exception, which is rather logical. I already tried out to change the faces servlet's url pattern to something like "/faces/*" but that URL will also be change in to the absolute URL (without "/faces/") so the result is the exact same as with the .jsf extension.
So, I thought, I'm writing a filter, that catces all .jsp calls and redirects them into .jsf (as one should usually do anyways to prevent jsp's bein called directly). Also I check in this filter, if a https ressource has been requested so I forward them to the right URL. Now I'm ending up in an infite loop. My redirection in the filter to the right URL triggers the Acegi redirecting feature to https (don't know why since I already redirect to the correct URL), changing the jsf extension in the URL back to jsp. From there it goes back into the filter (because of the jsp extension) and so forth ...
It doesn't really seem to me that Acegi's securechannelfilter is made to be used in JSF applications. Did anybody here figure out, how to use this feature in a JSF application? For the time being, I'm going to try out to protect the pages via the web.xml.
Thanks for any reply in advance!
Cheers,
Joerg

Hello,
first of all, the Acegi Security Framework is now called Sping Security and you might want to look up information under that name. However, I've always had problems to find any proper documentation for Spring or Acegi. And I mean some useful information with WORKING examples. The Acegi guys refer to some examples but that doesn't really help. What really fed me up with Aceig is, that some examples don't really work on my machine/project and I have no clue why. In my project, I needed to have some pages secured with https and used the securechannelFilter of Acegi, which I never got to work. Sure, they have a message forum but you always depend on someone being nice enough to help you out with your problem. Anyways, to make a long story short: I ditched Acegi and wrote my own filter and request wrapper and I'm using JAAS for the security. At least I now know what's going on and I can blame myselfe if it doesn't work :)
The problems I ran into: You need Spring to setup Acegi, because it relies on it. Like Spring, Acegi is a XML configuration hell. The documentation is not made for beginners and (like Spring's) has many errors in it which drive you crazy because you assume the docs are correct. There is a JSF taglib for Acegi and that worked quite nice. However, Acegi is URL driven and sometimes, JSF does not show the actual URL of the page, that you are currently looking at. E.g. you have a main page with a login button. Click on the button and you are refered to the login page. However, your browser still shows the main page URL. This is where Acegi simply fails.
If you don't need https and you simply want to have authorization, I recommend that you use JAAS and an own realm. That's straight forward and (if you use Netbeans 6.x) fairly simple to configure in your project. The realm you can hook up to LDAP or a database that has user/role mappings in it. Google for "JAAS jdbc realm database" and you will find some easy to understand tutorials. Here's one using Glassfish and My-SQL:
http://blogs.sun.com/swchan/entry/jdbcrealm_in_glassfish_with_mysql
Hope, that helps!
Cheers,
Joerg

Similar Messages

  • I am trying to use java  file as Model layer and jsf as presentation layer

    I am trying to use java file as Model layer and jsf as presentation layer and need some help
    I successfully get the value of h:outputText from java file by doing simple binding operation but I am facing problems when I am trying to fill h:dataTable
    I create java file
    package oracle.model;
    import java.sql.;*
    import java.util.;*
    *public class TableBean {*
    Connection con ;
    Statement ps;
    ResultSet rs;
    private List perInfoAll = new ArrayList();
    *public List getperInfoAll() {*
    perInfoAll.add(0,new perInfo("name","username","blablabla"));
    return perInfoAll;
    *public class perInfo {*
    String uname;
    String firstName;
    String lastName;
    *public perInfo(String firstName,String lastName,String uname) {*
    this.uname = uname;
    this.firstName = firstName;
    this.lastName = lastName;
    *public String getUname() {*
    return uname;
    *public String getFirstName() {*
    return firstName;
    *public String getLastName() {*
    return lastName;
    right click on the file and choose 'create data control'
    then i wrote the jsf file:
    *<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>*
    *<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>*
    *<f:view>*
    *<h:dataTable id="dt1" value="#{bindings.perInfoAll}"*
    var="item" bgcolor="#F1F1F1" border="10"
    cellpadding="5" cellspacing="3" rows="4" width="50%"
    dir="LTR" frame="hsides" rules="all"
    *>*
    *<f:facet name="header">*
    *<h:outputText value="This is 'dataTable' demo" id="ot6"/>*
    *</f:facet>*
    *<h:column id="c2">*
    *<f:facet name="header">*
    *<h:outputText value="First Name" id="ot1"/>*
    *</f:facet>*
    *<h:outputText style="" value="#{item.firstName}"*
    id="ot2"/>
    *</h:column>*
    *<h:column id="c4">*
    *<f:facet name="header">*
    *<h:outputText value="Last Name" id="ot9"/>*
    *</f:facet>*
    *<h:outputText value="#{item.lastName}" id="ot8"/>*
    *</h:column>*
    *<h:column id="c3">*
    *<f:facet name="header">*
    *<h:outputText value="Username" id="ot7"/>*
    *</f:facet>*
    *<h:outputText value="#{item.uname}" id="ot4"/>*
    *</h:column>*
    *<f:facet name="footer">*
    *<h:outputText value="The End" id="ot3"/>*
    *</f:facet>*
    *</h:dataTable>*
    *</center>*
    *</af:document>*
    *</f:view>*
    but nothing is appear in my table
    I know that there is something wrong in calling the binding object
    I need help pls and where can i find some help to deal with another tag types
    thanks

    i dragged the "perInfoAll" from my "Data Controls" and choosed adf table (even I know that new table with adf tags well be generated and i want table with jsf tags)
    and this code is generated
    *<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"*
    *"http://www.w3.org/TR/html4/loose.dtd">*
    *<%@ page contentType="text/html;charset=UTF-8"%>*
    *<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>*
    *<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>*
    *<%@ taglib uri="http://xmlns.oracle.com/adf/faces/rich" prefix="af"%>*
    *<f:view>*
    *<af:document id="d1">*
    *<af:messages id="m1"/>*
    *<af:form id="f1">*
    *<af:table value="#{bindings.perInfoAll1.collectionModel}" var="row"*
    *rows="#{bindings.perInfoAll1.rangeSize}"*
    *emptyText="#{bindings.perInfoAll1.viewable ? 'No data to display.' : 'Access Denied.'}"*
    *fetchSize="#{bindings.perInfoAll1.rangeSize}"*
    *rowBandingInterval="0"*
    *selectionListener="#{bindings.perInfoAll1.collectionModel.makeCurrent}"*
    *rowSelection="multiple" id="t1">*
    *<af:column sortProperty="uname" sortable="false"*
    *headerText="#{bindings.perInfoAll1.hints.uname.label}"*
    *id="c1">*
    *<af:inputText value="#{row.bindings.uname.inputValue}"*
    *label="#{bindings.perInfoAll1.hints.uname.label}"*
    *required="#{bindings.perInfoAll1.hints.uname.mandatory}"*
    *columns="#{bindings.perInfoAll1.hints.uname.displayWidth}"*
    *maximumLength="#{bindings.perInfoAll1.hints.uname.precision}"*
    *shortDesc="#{bindings.perInfoAll1.hints.uname.tooltip}"*
    *id="it3">*
    *<f:validator binding="#{row.bindings.uname.validator}"/>*
    *</af:inputText>*
    *</af:column>*
    *<af:column sortProperty="firstName" sortable="false"*
    *headerText="#{bindings.perInfoAll1.hints.firstName.label}"*
    *id="c2">*
    *<af:inputText value="#{row.bindings.firstName.inputValue}"*
    *label="#{bindings.perInfoAll1.hints.firstName.label}"*
    *required="#{bindings.perInfoAll1.hints.firstName.mandatory}"*
    *columns="#{bindings.perInfoAll1.hints.firstName.displayWidth}"*
    *maximumLength="#{bindings.perInfoAll1.hints.firstName.precision}"*
    *shortDesc="#{bindings.perInfoAll1.hints.firstName.tooltip}"*
    *id="it2">*
    *<f:validator binding="#{row.bindings.firstName.validator}"/>*
    *</af:inputText>*
    *</af:column>*
    *<af:column sortProperty="lastName" sortable="false"*
    *headerText="#{bindings.perInfoAll1.hints.lastName.label}"*
    *id="c3">*
    *<af:inputText value="#{row.bindings.lastName.inputValue}"*
    *label="#{bindings.perInfoAll1.hints.lastName.label}"*
    *required="#{bindings.perInfoAll1.hints.lastName.mandatory}"*
    *columns="#{bindings.perInfoAll1.hints.lastName.displayWidth}"*
    *maximumLength="#{bindings.perInfoAll1.hints.lastName.precision}"*
    *shortDesc="#{bindings.perInfoAll1.hints.lastName.tooltip}"*
    *id="it1">*
    *<f:validator binding="#{row.bindings.lastName.validator}"/>*
    *</af:inputText>*
    *</af:column>*
    *</af:table>*
    *</af:form>*
    *</af:document>*
    *</f:view>*
    but when run it i see the following errors
    *Class oracle.adf.model.adapter.bean.BeanDataControl can not access a member of class nl.amis.hrm.EmpManager with modifiers "private"*
    *Object EmpManager of type DataControl is not found.*
    *java.lang.NullPointerException*
    *Class oracle.adf.model.adapter.bean.BeanDataControl can not access a member of class nl.amis.hrm.EmpManager with modifiers "private"*
    *Object EmpManager of type DataControl is not found.*
    *java.lang.NullPointerException*
    :(

  • How to integrate Single Sign-On and JSF?

    Hi all,
    We are going to develop a web application using Oracle technologies, including ADF and JSF.
    But we´ll need to secure our website using Oracle Identity Manager (Single Sign-On). I am having difficulties to find any resource explaining how to do that.
    Also, the IM (SSO) will run on a Oracle AS instance and our web app (ADF+JSF) will run on a separete OC4J instance, due to ADF version. Is this a problem?
    Thanks

    We too are in the process of implementing iStore with SSO features.
    And if you believe me it seems to me as nightmare.
    In our scenerio we are intgrating this SSO with Third party access control too (AD and Siteminder). I would request you to please respond me on the following mail id , so we can share our experince which will help us in our implementation
    [email protected]
    regards and thanks in advance
    Vikas Deep

  • Facelets and jsf-extensions problem.

    I'm fairly certain I've run into a problem between facelets and jsf-extensions. I'm working with JSF 1.2 RI, Woodstock, Facelets 1.1.13, on Tomcat 6.
    When trying to get Woodstock autoValidation to work I get a javascript error the "I has no properties". The error occurs in the com_sun_faces_ajax.js file in the jsf-extensions-dynamic-faces-0.1.jar (I've used both the RC4 and a build today ,10/18/07 from source with the same results). Here is the code snippet where it happens (with my comment).
    var I = G.getElementsByTagName("components")[0];
    var C = I.getElementsByTagName("render");
    for(var F = 0; F < C.length; F++) {
    In the second line there it looks like the variable I is null, but based on the post response below I don't know why.
    The response from the post looks like this:
    <partial-response><components><render id="PayableForm:vendorGci"><markup><![CDATA[{"valid":true,"id":"PayableForm:vendorGci"}]]></markup></render></components>
    However the server side code (validation method) never gets executed. I'm willing to do some digging and debug work, but I'd need to be pointed in the right direction.
    The following is more potentially useful code snippets.
    Here is the textField code:
    <w:form id="PayableForm">
    <w:textField style="display:none;" />
    <w:message for="vendorGci" />
    <w:label id="vendorGciLabel" for="vendorGci" text="Vendor: " />
    <w:textField id="vendorGci" autoValidate="true"
    text="${vendorBean.searchGci}" maxlength="8" required="true"
    validatorExpression="#{ vendorBean.validateVendor}" />
    Here is the javascript in the page (the init function is called from the body: onLoad="setTimeout('init();', 0);" , this does happen):
    <w:script type="text/javascript">
    function VendorListener(){
    function VendorNotify(props){
    alert("VendorNotify called!"); <--------------- I never see this alert message
    if ( props.id != "PayableForm:vendorGci") { return; }
    var field = document.getElementById("PayableForm:vendorGciLabel");
    field.setProps({
    valid: props.valid
    VendorListener.prototype.notify = VendorNotify;
    function initAccountRows(){
    var table = document.getElementById("PayableForm:vendorAccountTable");
    table.initAllRows();
    function init(){
    initAccountRows();
    var listener = new VendorListener();
    dojo.subscribe(
    webui.suntheme.widget.textField.event.validation.endTopic ,
    listener, listener.notify);
    Here is the validator method. It currently doesn't do anything, just trying to get something to work. I never see the output, and I never hit the breakpoint in the method.
    public void validateVendor(FacesContext context, UIComponent comp, Object value){
    System.out.println("**********************************");
    System.out.println("validateVendor called");
    System.out.println(value);
    System.out.println("**********************************");
    }

    Actually I don't need a global variable. I need to refer in my included template the actual backing bean used in the current page. As all my backing bean extends a abstract class I could bind my component to a property of the current backing bean, no matters which one. Just like a polymorphic call but without the parameter. Let's imagine I could get this object of the facesContext object I would be able to do:
    <rich:datascroller renderIfSinglePage="false" align="right" for="listagem" maxPages="12" fastStep="10"
    pageIndexVar="pageIndex" pagesVar="pages" stepControls="show" fastControls="hide" boundaryControls="show"
    inactiveStyleClass="paginacaoInativa" selectedStyleClass="paginacaoSelecionada"
    styleClass="paginacao" tableStyleClass="paginacaoTabela"
    binding="#{facesContext.currentBackingbean.formDataScroller}" id="paginacao">
    Instead of pass the backing bean to the ui:param of this template... Dou you get the point?

  • What's the difference between jsp and jsf?

    who can tell me what's the difference between jsp and jsf?
    I'm puzzled when I found some of the technology in jsp is so similar to the ones in jsp( javaserver page)

    Hi,
    Find the difference between JSP and JSF
    1. A developer has more control with JSP, but (should) get easier development with JSF
    2. Event handling is done differently in JSP (HTTP) and JSF (Java)
    3. The UI is designed differently (or should be at least) with JSP (markup) and JSF (components).
    4. The end product should also be defined differently - JSP page versus a JSF application.
    Is this the only thing that is need to make a decision for either or? Probably not. There are other pieces that need to be taken in account when deciding which technology to use - tools support, enough components, type of application etc.... At this point there are not enough JSF components (although there are some interesting projects underway - Ajaxfaces, Myfaces, ADF Faces, and WebChart 3d) and enterprise tools support is still limited to a few tools vendor. Looking at our ADF Faces components they are currently available as early access (not production) and demands for these components are stacking up, literally, outside my office doorstep. Although I would love to make them production - now! - it is not a viable solution since we are still checking features and fixing critical bugs.
    All this combined - not enough enterprise level components in production, lacking tools support etc... - leave customers in a vacuum where the decision is either to continue with JSP, since it is mature and has a wide developer base, or move forward with JSF not sure if the support, or the developers will be there. This is particularly sensitive to customers that need to get started now and be production by summer.
    If you are in this vacuum here are some key points promoting JSF:
    1. Fundamental unit is the Component
    2. Built in event and state management
    3. Component sets can be provided by any vendor
    4. Closer to ASP.Net or Swing development
    5. Choice of UI technology
    6. Scale up (rich clients)
    7. Scale down (mobile devices)
    8. Built into J2EE containers in J2EE 5.0 (tentative)

  • Tomcat 6.0.9 and jsf 1.2 and jstl 1.2 using *.tag file error

    I using :tomcat 6.0.9 and jsf 1.2 and jstl 1.2
    My web.xml is at version 2.5 and I am using a custom tag (with the .tag extension). I am trying to use the http://java.sun.com/jsf/html library and values from my attribute. I'm new to this so I figure I must just me missing something.
    I am run http://192.168.1.1/test.jsf laster,view:
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP:
    Stacktrace:
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
         org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:415)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
         org.apache.jasper.servlet.JspServletWrapper.loadTagFile(JspServletWrapper.java:212)
         org.apache.jasper.compiler.TagFileProcessor.loadTagFile(TagFileProcessor.java:576)
         org.apache.jasper.compiler.TagFileProcessor.access$000(TagFileProcessor.java:50)
         org.apache.jasper.compiler.TagFileProcessor$TagFileLoaderVisitor.visit(TagFileProcessor.java:627)
         org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1507)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2386)
         org.apache.jasper.compiler.TagFileProcessor$TagFileLoaderVisitor.visit(TagFileProcessor.java:631)
         org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1507)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2386)
         org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2392)
         org.apache.jasper.compiler.Node$Root.accept(Node.java:489)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)
         org.apache.jasper.compiler.TagFileProcessor.loadTagFiles(TagFileProcessor.java:645)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:190)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:306)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:414)
         com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:455)
         com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:139)
         com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:108)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:266)
         com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:159)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
    note The full stack trace of the root cause is available in the Apache Tomcat/6.0.9 logs.
    if go to /WEB-INF/tags/test.tag ,delete line: <h:outputText id="test" value="hello!" />
    run http://192.168.1.1/test.jsf is OK!(no error),So I guess error for "<h:outputText id="test" value="hello!" />" line ,why in test.tag file do can't use the "http://java.sun.com/jsf/html " library,please help me.......
    Here is file WEB-INF/web.xml content:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements. See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License. You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
    -->
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd"
    version="2.5">
    <display-name>Welcome to Tomcat</display-name>
    <description>
    Welcome to Tomcat
    </description>
    <!-- Faces Servlet -->
    <servlet>
         <servlet-name>Faces Servlet</servlet-name>
         <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
         <load-on-startup> 1 </load-on-startup>
    </servlet>
    <!-- Faces Servlet Mapping -->
    <servlet-mapping>
         <servlet-name>Faces Servlet</servlet-name>
         <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    </web-app>
    Here is file /test.jsp code:
    <%@ page contentType="text/html;charset=UTF-8" %>
    <%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <f:view>
    <html>
    <head>
    <title>test</title>
    </head>
    <body>
    <!-- body start -->
    <h:outputText id="myinfo" value="test success" />
    <tags:test/>
    <!-- body end -->
    </body>
    </html>
    </f:view>
    Here is file /WEB-INF/tags/test.tag code:
    <%@tag pageEncoding="UTF-8"%>
    <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
    <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
    <h:outputText id="test" value="hello!" />
    Thanks for any help.

    Don't know if it's important, but there is no schema avaiable at: http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd
    I found the right one at: http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd
    /perty
    Message was edited by:
    perajonsson

  • Struts and JSF Integration in OPDk-java based portlet

    Hi,
    thanks in advance for your help.
    I'm developing a PDK java based portlet. For some reasons I cannot use the JSF bridge but I would like to integrate Struts and Jsf in my portlet, using Struts to manage actions and navigation and JSF (with ADF Faces components) for the view. I'm using the Strus-Faces library.
    When I try to submit my portlet form, I receive the error "request URL not found on this server". I'm posting some exstracts of my code.
    It's made of three pages: the main one "Integration1ShowPage", "error" and "result". The MainAction.java displays my mainPage, where there's a form. To keep it easy, when the user submits this form, the ActionName returns "success" and the "result" page should be displayed.
    The MainAction works properly: the portlet is displayed but when I tried to submit the form I receive
    The requested URL /provaDeploy/htdocs/integration1/integration1ShowPage.do was not found on this server.Could you please suggest me something?
    Many many thanks,
    B.
    <struts-config>
    <action-mappings>
      <action path = "/mainAction" type = "strutsjsfintegration1.MainAction">
        <forward name = "success" path = "/faces/htdocs/integration1/integration1ShowPage.faces"/>
      </action>
      <action path = "/nameAction" name = "nameForm"
      input = "/faces/htdocs/integration1/integration1ShowPage.faces" scope = "request"
      type = "strutsjsfintegration1.NameAction">
        <forward name = "success" path = "/faces/htdocs/integration1/result.faces"/>
        <forward name = "failure" path = "/faces/htdocs/integration1/error.faces"/>
        <forward name = "again" path = "faces/htdocs/integration1/integration1ShowPage.faces"/>
      </action>
    </action-mappings>
    <controller>
      <set-property property = "processorClass"
       value="org.apache.struts.faces.application.FacesRequestProcessor"/>
       </controller>
    <message-resources parameter="definitiveStrutsPortlet.ApplicationResources"/>
    </struts-config>

    Hi,
    have a look at this whitepaper for how to use JavaScript in ADF.
    http://www.oracle.com/technetwork/developer-tools/jdev/1-2011-javascript-302460.pdf
    This link here (http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html --> see sample 71) shows an integration sample between a Java Applet and ADF. Its a similar use case to yours
    Frank

  • Can Struts and JSF coexist?

    I have a Struts based application and now I want to build an additional module on top of that using pure JSF. My question is, can Struts and JSF co-exist in the same application? If yes, what are the cons of that approach? What are the places I need to tweak in the configuration files so that they work together?
    thanks,

    Hi,
    Yes they can coexist. Actually that's the approach recommended by Craig McClanahan. I have developed a full enterprise application (80% completed) which uses JSF in front and Struts in the back using Struts-Faces integration library (developed by Apache).
    So far I haven't faced any major issues with this approach. However, I haven't try using Struts validator on JSF objects.
    Read the article below on how to integrate JSF w/ Struts.
    http://www.oracle.com/technology/pub/articles/masterj2ee/j2ee_wk8.html

  • JSF datatable - any difference with JSF 1.1 and JSF 1.2

    Hi All,
    In my project there are lot of Datatables, which retrieve data from the database and display it to the user. For each datatable, the columns are not fixed. I want to create some kind of component that can be reusable.
    It is basically a JSF portlet. Now i have to use RAD 6. RAD 6 supports only JSF1.1. I have to migrate this to RAD7 in the near future. Are there any differences between the Datatable in JSF 1.1 and JSF 1.2?
    I had this approach in mind.
    a) Create the datatable programmatically and put the contents to panelgrid. This way the jsp code will be minimized. Is it a good option.? Are the APIs same in both the versions?
    b) Is it possible to create a custom datatable which can take some key as input. Then based on the key the datatable can be populated with as many columns as desired.
    Please let me know if there are any other good options.
    ~Anitha.

    Hi guys,
    my code goes like this..
    for (int j = 0; j < size; j++) {
                   UIColumn column = new UIColumn();
                   dataTable.getChildren().add(column);
                   HtmlOutputText header = new HtmlOutputText();
                   header.setValue(periodHeader[j]);
                   column.setHeader(header);
                   HtmlOutputText output = new HtmlOutputText();
                   output.setValue(new Double(periodLiability[j]));
                   ValueBinding vb1 = FacesContext.getCurrentInstance()
                             .getApplication().createValueBinding(
                                       ("#{liability.periodLiability["+j+"]}"));
                   output.setValueBinding("value", vb1);
                   column.getChildren().add(output);
    this code gives me the number of headers i need. But, it doesnt render the columns. I have an array of Double (periodLiability) which stores few values of Double type. I want to show thesee values inthe dataTable Column.
    Please help me..

  • JSF Datatable - Any difference with JSF1.1 and JSF 1.2

    In my project there are lot of Datatables, which retrieve data from the database and display it to the user. For each datatable, the columns are not fixed. I want to create some kind of component that can be reusable.
    It is basically a JSF portlet. Now i have to use RAD 6. RAD 6 supports only JSF1.1. I have to migrate this to RAD7 in the near future. Are there any differences between the Datatable in JSF 1.1 and JSF 1.2?
    I had this approach in mind.
    a) Create the datatable programmatically and put the contents to panelgrid. This way the jsp code will be minimized. Is it a good option.? Are the APIs same in both the versions?
    b) Is it possible to create a custom datatable which can take some key as input. Then based on the key the datatable can be populated with as many columns as desired.
    Please let me know if there are any other good options.
    ~Anitha.

    Doublepost. Please don't use the back button to edit a topic, you're going to repost it. Use the edit button. Continue here: [http://forums.sun.com/thread.jspa?threadID=5336694].

  • J2EE, JSTL and JSF questions

    I am trying to learn J2EE/JSTL/JSF and have quite a few general questions. Any help on any of these is appreciated.
    1) Is there a way, just by using J2EE/Java to "manipulate" an XML file. Not just parse and read it's data but actually add nodes to the file?
    2) I've been reading quite a bit on JSTL and JSF recently. Is JSF supposed to be an alternative to Struts and JSTL an alternative to scriptlet coding?
    3) I am also working on creating a message board but throwing around a couple of ways to implement it. Either (a) using a database to store posts and a JSP interface or (b) using an XML document to store postings. Which of these two seem best or is there a better option?
    4) Is there an easy way to call Php from a Java program? I need to invoke a php program when a user clicks on a link on a JSP page I have.

    1) The SDK provides JAXP (Java API for XML Processing) in javax.xml package.
    2) I wouldn't call it 'alternative'.
    3) Your choice. I'd to use a RDBMS. Less overhead, better suited, (much) more functions and better performance.
    4) If that program is available on the web, then just invoke a HTTP request. If not, I'd rather to rewrite it to Java.

  • BlazeDS and JSF

    I have an existing JSF (really Oracle ADF) application that I'd like to connect to a Flex front-end rather than rewrite totally in Flex + JSPs for the back-end. BlazeDS will properly instantiate the managed beans through remote object requests, but the FacesContext references in my managed beans are null, as BlazeDS seems to have nothing to do with this context. Does anyone have experience connecting a Flex application to a JSF application properly, maybe through creating his/her own FacesContext factory?

    <div class=Section1><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'>Hi,<o:p></o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'><o:p> </o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'>It&#8217;s pretty easy to integrate blazeds into an existing application. <br />The war is just an example of how to configure and package blazeds.  BlazeDS<br />itself is just a servlet, with a collection of jars and some configuration<br />files.  You put the required jars into your WEB-INF/lib, the configuration files<br />into WEB-INF/flex (If I remember correctly), and then map the blazeds message<br />broker servlet in your web.xml file. You can open up the war file and see how it&#8217;s<br />configured there and base your configuration on that.  Depending on your needs<br />and your servlet container you may have to add a jar file to your container&#8217;s lib<br />or classpath.<o:p></o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'><o:p> </o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'>One of the benefits of blazeds is that if you&#8217;ve structured your<br />application so that you&#8217;ve abstracted the view then you can just plop bds right<br />in there and expose all your services through bds views.  It&#8217;s very powerful<br />that way.  <o:p></o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'><o:p> </o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'>If you&#8217;re still having trouble just write a response and I&#8217;ll<br />see what I can do.<o:p></o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'><o:p> </o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'>/r <o:p></o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'><o:p> </o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'><o:p> </o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'><o:p> </o:p></span></p><br /><br /><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";<br />color:#1F497D'><o:p> </o:p></span></p><br /><br /><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><br /><br /><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span<br />style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Larry Guros<br />[mailto:[email protected]] <br><br /><b>Sent:</b> Thursday, July 24, 2008 8:28 AM<br><br /><b>To:</b> [email protected]<br><br /><b>Subject:</b> Re: BlazeDS and JSF<o:p></o:p></span></p><br /><br /></div><br /><br /><p class=MsoNormal><o:p> </o:p></p><br /><br /><p class=MsoNormal style='margin-bottom:12.0pt'>A new message was posted by<br />Larry Guros in <br><br /><br><br /><b>General Discussion</b> --<br><br />  BlazeDS and JSF<br><br /><br><br />Ditto. I am guessing the answer is no one knows. <br><br /><br><br />Seems Blazeds is much better suited to flex-only applications and doesn't<br />integrate easily with other J2EE apps. <o:p></o:p></p><br /><br /><div class=MsoNormal><br /><br /><hr size=2 width=200 style='width:150.0pt' align=left><br /><br /></div><br /><br /><p class=MsoNormal style='margin-bottom:12.0pt'>View/reply at <a<br />href="http://www.adobeforums.com/webx?13@@.59b4b834/0">BlazeDS and JSF</a><br><br />Replies by email are OK.<br><br />Use the <a<br />href="http://www.adobeforums.com/webx?280@@.59b4b834!folder=.3c061a83">unsubscribe</a>< br />form to cancel your email subscription.<o:p></o:p></p><br /><br /></div>

  • Oc4j 9.0.4/10g R1 and JSF

    Hi,
    I'm having serious problems with the OC4J container 9.0.4 and JSF. I have tried several sample applications in addition to the one that I have created myself, but none of them will work in the 9.0.4 release of OC4J, even though they all work in R3 EA release, as well as in tomcat 4.x.
    In order for oc4j to compile jsp, I have added the following to server.xml:
    <java-compiler name="javac" in-process="false" encoding="ISO8859_1" bindir="c:\APPS\Java\j2sdk1.4.2_09\bin" extdirs="c:\APPS\Java\j2sdk1.4.2_09\lib\ext" />
    After doing this the example jsp files that comes with oc4j works.
    However, when trying to access my own application I get the following errors in global-application.log:
    05/10/04 10:22:03 web-0.1: jsp: init
    05/10/04 10:22:03 web-0.1: SpringContextServlet: init
    05/10/04 10:22:03 web-0.1: Loading Spring root WebApplicationContext
    05/10/04 10:22:03 web-0.1: Error initializing servlet
    java.lang.IllegalStateException: No Factories configured for this Application - typically this is because a context listener is not setup in your web.xml.
    A typical config looks like this;
    <listener>
    <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
    </listener>
         at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:84)
         at javax.faces.webapp.FacesServlet.init(FacesServlet.java:73)
         at com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.java:2094)
         at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4523)
         at com.evermind.server.http.HttpApplication.initPreloadServlets(HttpApplication.java:4617)
         at com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:765)
         at com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:497)
         at com.evermind.server.Application.getHttpApplication(Application.java:886)
         at com.evermind.server.http.HttpServer.getHttpApplication(HttpServer.java:688)
         at com.evermind.server.http.HttpSite.getApplication(HttpSite.java:420)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:422)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
         at java.lang.Thread.run(Unknown Source)
    05/10/04 10:22:03 web-0.1: Error preloading servlet
    javax.servlet.ServletException: Error initializing servlet
         at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4574)
         at com.evermind.server.http.HttpApplication.initPreloadServlets(HttpApplication.java:4617)
         at com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:765)
         at com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:497)
         at com.evermind.server.Application.getHttpApplication(Application.java:886)
         at com.evermind.server.http.HttpServer.getHttpApplication(HttpServer.java:688)
         at com.evermind.server.http.HttpSite.getApplication(HttpSite.java:420)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:422)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
         at java.lang.Thread.run(Unknown Source)
    I found an advice to not load the servlets on startup, but this does not help.
    Does anyone know what might be wrong here? Is there a bug in 9.0.4 since everything works fine in the latest release?

    This should not really work -- there is NO JMX support in 9.0.3.
    In addition to providing the JMX MBeanServer runtime and JSR77 objects, we needed to also instrument a bunch of our runtime classes so they can work with JMX. Copying over the JMX libs and the console libs won't really get you what you need.
    The earliest you may see some form of JMX is 9.0.4 -- and this is a completely unsupported (and incomplete and in fact hidden .... ) feature in that release.
    Our first official release which will provide visible JMX support is 10.0.3.
    Copying over JAR files like this from different versions is not a supported operation. Interesting from a learning perspective for sure ;-) -- but certainly something that support will baulk at if you ever call them about it.
    cheers
    -steve-

  • Difference between struts and jsf

    hi
    which one you have to prefer and why?
    Please helpon this
    Thanks,
    Vijay

    Hai Vijay.
    Struts is liek dosa and JSF is liek alooparantha.
    okey?Now I'm not making fun of our brown friends here, but
    can someone recast that explanation, using only items
    that can be purchased at a Kentucky Fried Chicken, so
    that I can understand it better?Brown friends? I prefer to think of myself as "melanin-enhanced" and others as "melanin-challenged." Nonetheless, Struts can be thought of a Kentucky Fried Chicken whereas JSF is one pound of fresh, boneless chicken and a bottle of barbeque sauce.
    How's that? ;-)

  • Struts and JSF

    I have an Action from Struts. This controls the data in the code behind bean.
    After I call submit, how do I go Back to the Struts actions? the JSF navagation does not allow navigating to a servlet.

    Hey Shay,
    We have quite a large application based entirely on Struts. There is a keen interest in migrating to JSF, but in an incremental fashion. I did a fair amount of googling and almost everything i came up with , was purely theory oriented, are there any resources online , which clearly give examples/tutorials for doing a step by step migration to JSF from Struts. Couple of other questions that i dont seem to find an answer to with regards to the Integration of struts and JSF
    1) I understand BC4J, struts and JSF can be integrated together, does the same hold for ADF ? there was a similar forum post back in 2005 , where they said this is yet to be done, do we have this integration with Jdev 10.1.3 ?
    2) If i were to use only the jsf UI component tags as a first step in my struts application , what is the equivalent for the page definition file of JSF in struts, as in how would i achieve the binding ?

Maybe you are looking for