Jsf and submit()

I have the following jsf page.
<html>
     <%@ taglib uri="http://java.sun.com/jsf/core" prefix ="f" %>
     <%@ taglib uri="http://java.sun.com/jsf/html" prefix ="h" %>
     <f:view>
          <head>
               <jsp:scriptlet>
                    String path = request.getContextPath() +"/css/styles.css";               
               </jsp:scriptlet>
               <link  href ="<jsp:expression>path</jsp:expression>" rel="stylesheet" type="text/css">
               <f:loadBundle basename="bundle.messages" var="msgs"/>
               <title><h:outputText value="#{msgs.windowTitleDeletingRows}"/></title>
          </head>
          <body>
               <h:form>
                    <h:dataTable value="#{tableData.names}" var="name"
                         styleClass="names"
                         headerClass="namesHeader" columnClasses="last, first">
                         <h:column rendered="#{tableData.editable}">
                              <f:facet name="header">
                                   <h:outputText value="#{msgs.deleteColumnHeader}"/>
                              </f:facet>
                              <h:selectBooleanCheckbox value="#{name.markedForDeletion}"
                                   onchange="submit()"/>
                         </h:column>
                         <h:column>
                              <f:facet name="header">
                                   <h:outputText value="#{msgs.lastColumnHeader}"/>
                              </f:facet>
                              <h:outputText value="#{name.last}"/>
                              <f:verbatim>,</f:verbatim>
                         </h:column>
                         <h:column>
                              <f:facet name="header">
                                   <h:outputText value="#{msgs.firstColumnHeader}"/>
                              </f:facet>
                              <h:outputText value="#{name.first}"/>
                         </h:column>                         
                    </h:dataTable>
                    <p>
                    <h:outputText value="#{msgs.editPrompt}"/>
                    <h:selectBooleanCheckbox onchange="submit()" value="#{tableData.editable}"/>
                    <h:commandButton value="#{msgs.deleteButtonText}" rendered="#{tableData.editable}"
                         action="#{tableData.deleteNames}" disabled="#{not tableData.anyNamesMarkedForDeletion}"/>
               </h:form>
          </body>
     </f:view>
</html>          It contains a number of names that gets them form a bean named TableData. It includes a checkbox that when it is activated a series of checkboxes is diplayed next to the names. So when a user checks a checkbox a button named .delete selected names is activated.
I've taken this example from a tutorial. I want to ask two questions.
1.In this line :
<h:selectBooleanCheckbox onchange="submit()" value="#{tableData.editable}"/> how the page understands that is should be submitted in the TableData bean? I mean I have nowhere a javascript function submit()
2.The example works when I remove from the commandButton
<h:commandButton value="#{msgs.deleteButtonText}" rendered="#{tableData.editable}"
                         action="#{tableData.deleteNames}" disabled="#{not tableData.anyNamesMarkedForDeletion}"/> the rendered attribute. If this attribute is present then the method deleteNames is never invoked.Can someone explain me why is this happening?
Thanking you in advance

Not necessarily. A request scoped bean is destroyed at the end of the request. So the request occurs, the server responds, the bean is destroyed. You submit the form, but the request bean is destroyed. It recreates the necessary bean with default values (I'm guessing that rendered defaults to false).
You'd probably be ok if you moved just the rendered attribute into the session scope.
To be honest though, I'm not the best person to ask about the intricacies of the request scope. It's frustrated me a number of times as well. I think what happens, is that it doesn't quite work like people expect. The request bean from the page the user was just viewing is already destroyed by the time JSF will allow you to get at it. You know, while you're formulating your response to the input from the page. Which is generally when you need the data in the request scope (to formulate a good response).
You have to think of it opposite though. It's not, "what is the user telling the server." It's "what is the server telling the user" and you don't care what the user tells the server (cause it doesn't exist anymore). If you want the user to tell the server to do something, you will have to (at least) temporarily put that data in the session.
That's been my experience at least. I'm totally open to anyone correcting me (in fact, I'd like to hear it).
CowKing
Message was edited by:
IamCowKing

Similar Messages

  • Working with Non JSF and JSF Pages

    Hi ALL,
    I wanted to know wheter it is possible or not
    Here is scenario
    I have 2 pages. First one is JSF Page and second one is JSP Page
    I wanted to submit the JSF Page contents to JSP Page. Is it possible??
    Below is by Navigation Rule for it where postJob is JSF and postJobDetails is JSP Page
    <navigation-rule>
            <from-view-id>/consumer/postJob.jsp</from-view-id>
            <navigation-case>
                <from-outcome>postJobDetails</from-outcome>
                <to-view-id>/consumer/postjobDetails.jsp</to-view-id>
            </navigation-case>
        </navigation-rule>And in my button action I am doing like this
    public String btnContinue_action()
            return "postJobDetails";
        }And I am not able to submit JSF contents to JSP Page.
    Thanks
    Sudhakar

    You should be able to do this with a HyperLink component.

  • Clarrification about JSF and JBoss Seam

    Hi ,
    i have just started a couple of hours ago reading about JSF and JBoss Seam and it seems interesting ......
    here is my question :
    i have a form ( registration form ) written in jsp and a congratulation page (jsp page too)
    is right what i am saying ?
    JSF form ( input values) are sent to Seam to be validated under hibernate rules and then it( Seam ) responses to the JSF the entity bean .
    again JSF form asks Seam to resolve the variable Register ( the value of the submit button in the form) and Seam returns the RegisterACtion
    After that the same jsp page invoke the register method of the RegisterAction stateless session beam .inside the register method it redirect the user to congratulation jsp page .
    do you think its correct
    sorry folks for my english
    Best reagrds
    yacine fandi

    or maybe if you can give a link of a good tutorial I�ll be greatfull
    cheers yacine
    Message was edited by:
    fandi_yacine

  • JSF and JSTL integration

    Can anyone tell me how to access JSF objects from JSTL tags?
    I want to set a requestScope flag in my changeListener
    ... context.getExternalContext().getRequestMap().put("xxx","ok"); ... and render output depending on existance of this flag:
    ...<c:if test="${requestScope.xxx!=null}" > .... .
    This examplecode doesn't work, JSTL tags cannot access this var! How can I do that?
    What I realy want is to reload another frame when user changed a specific input field.
    Above code should add a JavaScript to reload the frame if this is true .
    I can't do this on submit because the other framepage uses the stored/modified data.
    Maybe there's a better approach for this anyway?
    Thanks for your help!

    Thanks for your help - I found it was my own mistake why it didn't work. Now it does, as you said.
    But in the meentime I ran into another Problem mixing JSTL und JSF:
    I want to build a SelectOneMenu and populate it with data from a database, but with selectItemValue
    other than selectItemLabel (value should be numeric DB-ID, label a readable name).
    Since "selectItems" allows only one dimensional Arrays (?) as parameter, I must use "selectItem" for
    each row. So I wrote following code:
    <h:selectOneMenu id="m1" value="#{worktime.employee}">
       <sql:query var="employees" dataSource="jdbc/WebOfficeDB">
           select oid,displayname from employees order by displayname asc
        </sql:query>
        <c:forEach var="row" items="${employees.rows}" >
           <f:selectItem itemValue="#{row.oid}" itemLabel="#{row.displayname}" />
        </c:forEach>
    </h:selectOneMenu>This doesn't work, I get NullPointer Exceptions from selectItem.setValue().
    I think because JSF "#" references another context than JSTL "$" - is this correct?
    So I tried to set a JSTL variable inside the forEach loop to access the datarow
    <c:set var="data" value="${row}" scope="request"/>
    <f:selectItem itemValue="#{requestScope.data.oid}" itemLabel="#{requestScope.data.displayname}" />
    ...The effect is that all lines of the selectOneMenu have the same content (from the last datarecord)!?
    Since this is my first project in JSTL and JSF and should stay a small one I don't want to go into building
    CustomComponents and so on for such a simple Task.
    I would be very very happy for some tips and hints, since I think this mixing of JSTL and JSF Context
    will be a very common problem within my project.
    Thanks

  • JSF and HTTPS

    Hit a bit of a show stopper here and wondered if anybody else has had to face this same problem.
    I have been developing an application using JSF for the presentation layer.
    Everything is fine until I decide to use HTTPS for login, signup, account maintenance etc.
    I cannot find any literature anywhere about how to have an action in a backing bean forward to a URL using SSL.
    Anybody got any suggestions?

    You could have a go at writing your own ViewHandler. By intercepting the getActionURL method and converting the returned URIs to the equivalent HTTPS URL for the appropriate views you should be able to get JSF to submit forms via SSL.

  • How do I create forms that people can complete in more than one sitting i.e. save and submit?

    Hi,
    I have just bought formscentral and need advice to achieve my objectives:
    Required:
    Customer can part fill form, save and complete later on and submit for us to capture the data.
    Customer can save or can access their completed form, as we need them to print it out, and physically sign a version for us for legal reasons
    Several different people within the customer's business need to fill out different areas of the form, so they may need to e-mail the form bwtween each other or each logon and complete their section.
    Are the above achievable? If so can I do as a web form or pdf? Are there any settings I need to apply to the form before or during creation? Are there only certain methods of distribution that will work?
    Other concerns:
    Our end customers are small traders that are not that computer literate and I worry that they won't have the latest adobe reader or the form won't be compatible with their Mac or firewalls etc and will struggle to be able to fill out, save and submit the forms for technical reasons. Are these concerns justified? If so, are there ways to minimise these issues?
    Any guidance is much appreciated. The package also mentions it includes one to one support from Adobe - how do I access this support?
    Thank you,
    Rob

    If a requirement is that the form be passed around to several users, I think that the PDF option is your only hope. It will indeed be a problem if users don't have Reader or some other forms-capable PDF viewer. You don't have to do anything special apart from enabling it with FormsCentral. This allows users with Reader versions prior to 11 to save the filled-in form. You'll just have to try to educate the users to use Reader (and NOT to use Preview on a Mac).

  • Building a Simple JSF and Web Services App in JDeveloper 10.1.3 Preview

    Hi
    I was trying out this example of JSF and webservices at:
    http://www.oracle.com/technology/products/jdev/101/howtos/jsfws/index.html
    Has anyone tried it before? I'm getting the following error:
    calling http://216.200.21.157:9090/soap
    WARNING: Unable to connect to URL: http://216.200.21.157:9090/soap due to java.security.PrivilegedActionException: oracle.j2ee.ws.saaj.ContentTypeException: Not a valid SOAP Content-Type: text/html
    java.rmi.RemoteException: ; nested exception is:
         HTTP transport error: javax.xml.soap.SOAPException: java.security.PrivilegedActionException: oracle.j2ee.ws.saaj.ContentTypeException: Not a valid SOAP Content-Type: text/html
         at com.minc.ws.stockquery.proxy.runtime.NetXmethodsServicesStockquoteStockQuoteBinding_Stub.getQuote(NetXmethodsServicesStockquoteStockQuoteBinding_Stub.java:96)
         at com.minc.ws.stockquery.proxy.NetXmethodsServicesStockquoteStockQuotePortClient.getQuote(NetXmethodsServicesStockquoteStockQuotePortClient.java:40)
         at com.minc.ws.stockquery.proxy.NetXmethodsServicesStockquoteStockQuotePortClient.main(NetXmethodsServicesStockquoteStockQuotePortClient.java:29)
    Caused by: HTTP transport error: javax.xml.soap.SOAPException: java.security.PrivilegedActionException: oracle.j2ee.ws.saaj.ContentTypeException: Not a valid SOAP Content-Type: text/html
         at oracle.j2ee.ws.client.http.HttpClientTransport.invokeImpl(HttpClientTransport.java:142)
         at oracle.j2ee.ws.client.http.HttpClientTransport.invoke(HttpClientTransport.java:118)
         at oracle.j2ee.ws.client.StreamingSender._sendImpl(StreamingSender.java:175)
         at oracle.j2ee.ws.client.StreamingSender._send(StreamingSender.java:112)
         at com.minc.ws.stockquery.proxy.runtime.NetXmethodsServicesStockquoteStockQuoteBinding_Stub.getQuote(NetXmethodsServicesStockquoteStockQuoteBinding_Stub.java:79)
         ... 2 more
    Any ideas?
    Thanks
    Alex

    I'm not using 10.1.3 preview. I was using 10.1.3.1 production. I just copied the title of the tutorial as my subject. sorry for the confusion!! :)
    I used the HTTP analyzer and this is what I got in the header:
    <HTML><HEAD><TITLE>TCP Packet Monitor Error</TITLE></HEAD><BODY>JDeveloper TCP Packet Monitor encountered an error retrieving<P><pre>POST http://216.200.21.157:9090/soap HTTP/1.1
    Host: 216.200.21.157:9090
    Proxy-Connection: Keep-Alive
    Connection: TE
    TE: trailers, deflate, gzip, compress
    User-Agent: Oracle HTTPClient Version 10h
    SOAPAction: "urn:xmethods-delayed-quotes#getQuote"
    Accept-Encoding: gzip, x-gzip, compress, x-compress
    Content-type: text/xml; charset=UTF-8
    Content-length: 680
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="urn:xmethods-delayed-quotes"><env:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" env:mustUnderstand="1"/></env:Header><env:Body><ns0:getQuote env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><symbol xsi:type="xsd:string">orcl</symbol></ns0:getQuote></env:Body></env:Envelope></pre><P>The error was :<P><pre>IOException retrieving the response: java.net.ConnectException: Connection refused: connect</pre><P></HTML>
    It looks like I'm getting connection refused error... Hmmm.. wonder why?
    I'll download 10.1.3.2 and see if that helps..
    Thanks for looking into this!
    Alex

  • Can I make a PDF form and submit to CF?

    Hi.
    I'm wonder that can I make this.
    I'd like to design a form like Purchase Order sample from
    LifeCycle Designer. And want to submit it like a POST method to a
    ColdFusion backend. Think like a HTML form submission.
    Could it be possible? Or I've to have LifeCycle ES for this
    kind of task.
    PDF form generated from CF and submit to CF -> Database
    seems like an attraction to me. No hassle to fix CSS bug.

    Read documentation on CF8 : "Although forms created in
    LiveCycle Designer allow several types of submission, including XDP
    and XML, ColdFusion 8 can extract data from HTTP post and PDF
    submissions only".

  • JSF and Double Byte Character

    Hi,
    I wanted to know how to handle <h:outputText> with chinese character or double byte character.
    See sample code below :
    <%@ page language="java" contentType="text/html; charset=UTF-8"      pageEncoding="UTF-8"%>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <h:form styleClass="form" id="form1">
    <% request.setCharacterEncoding("UTF-8"); %>
    <h:inputText styleClass="inputText" id="text1"></h:inputText>
    <hx:commandExButton type="submit" value="Submit" styleClass="commandExButton" id="button1"      action="#{pc_SubmitTest.doButton1Action}"></hx:commandExButton>
    <h:outputText styleClass="outputText" id="text2"></h:outputText>
    </h:form>
    When you input with double byte character and submit,
    the output screen value did not render properly .
    I tried this similiar code at JSP, it work fine.
    Anybody know how to solve this problem ?
    Anything need to do at pagecode level ?
    Thank you.
    Reinardy

    Problem was due to the fact that I was trying to generate the excel file in char stream instead of byte stream

  • Jsf and tiles

    hi all.
    i'm developing an application using jsf and tiles.
    i've some problem in the general layout page.
    how can I refer to images and files,if I don't know where the page will be used?
    with struts i've used <html:rewrite page=" ... " /> but it doesn't work with jsf.
    I only use the TilesServlet.
    any suggestion?
    i've also try to define the url like "/css/mycss.css" but in local dosn't work.
    thank a lot for any reply!

    hi all.
    i'm developing an application using jsf and tiles.
    i've some problem in the general layout page.
    how can I refer to images and files,if I don't know where the page will be used?
    with struts i've used <html:rewrite page=" ... " /> but it doesn't work with jsf.
    I only use the TilesServlet.
    any suggestion?
    i've also try to define the url like "/css/mycss.css" but in local dosn't work.
    thank a lot for any reply!

  • Jsf and tiles via myfaces

    Greetings:
    Please either confirm and/or correct following proposed solution for Myfaces tiles.
    Issue: isert a tile definition and attribute in a pure jsf page.
    First passed solution: A hybrid of Jsp programming and Jsf. I was able to create a tile page layout in pure jsf except in the portal columns i used old fashion jsp programming to insert a list of portletDefinitions which is extracted from jsf ValueBinding of its managed beans.
    The problem with the above approach is that it works well only with html portlet fragments. When a portlet fragment has some jsf elements, the page rendering has conflict of simultaneous rendering between jsf and jsp. The portlet fragments are rendered in a woring place.
    Proposed solution: use <h:dataTable ...> to render the portletList and extract the item portletDefinition as following:
    <h:dataTable var="portlet"
    value="#{portalTabbedBean.selectedPane.serviceListL}" >
    <f:verbatim>
    <h:outputText
    value="<tiles:insert name=#{portlet.portletDefinition} flush='false' /> " />
    </f:verbatim>
    </h:dataTable>
    Note on the name of tiles:insert element, which i just extracted the definition as a jsp variable to make it work in the first hybrid solution:
    <tiles:insert name="<%=portletDefinition%>" flush="false" />
    Thanks
    BaTien
    DBGROUPS

    I reply this myself. Jsf and Jsp programming either via Jstl or while loop do not go together under current version.
    I solve the problem by using Jsp programming and insert the portlet tile fragment directly rather than though a portlet template with different tile content attribute. The portlet tile is created as <h:panelGrid ...> and observe the set rules to make Jsf and jsp working together. Hopefully Jsf and Jsp will be able to work together nicely in their next specifications.

  • JSF And Struts Integration

    Can any body give some info on integration of JSF to existing struts application

    I describe the main differences between JSF and Struts in this sample Chapter from my JSF book:
    http://www.oreilly.com/catalog/jsvrfaces/chapter/ch01.pdf
    Hope that helps.

  • Using JSF and JavaMail to send Automated Email

    Hi All,
    Can any one please suggest I can use JSF and JavaMail to send automated email messages i.e after a person has successfully completed a form , a message is sent to his/her email address confirming that he has succesfully registered or completed a form. I have succesfull implemeted the use of javamail for sending email meassages in a JSF web application but cant seem to figure out how i can achieve automated sending of emails in JSF. Please any ideas, tutorials or source code would be very much appreciated.
    Thanks.

    I don't understand your problem:
    You have already been able to send e-mails from a JSF webapplication, but you are not capable of sending e-mails from a JSF webapplication?!
    Automated sending of e-mails will be exactly the same as non-automated.

  • Using JSF and tiles

    Hi Friends,
    I'm trying to combine JSF and tiles as follows:
    Template file:
    <f:subview id="content">
    <tiles:insert attribute="content" flush="false"/>
    </f:subview>
    content file:
    <tiles:insert definition="userSpecific">
    <tiles:put name="content" type="string" >
    <h:outputText value="aaaa"/>
    </tiles:put>
    </tiles:insert>
    I get the following error when loading the content file:
    2007-06-20 10:14:10,578 [http-8080-Processor23] ERROR org.apache.myfaces.shared_impl.taglib.UIComponentTagUtils - Component javax.faces.component.UIViewRoot is no ValueHolder, cannot set value.
    I tried putting the template content in a verbatim tag and then it works
    but the content page is not displayed in correct place in the template...
    Thanks a lot in advance!

    Are you dead set on using tiles? I can see tiles including JSF but JSF including tiles? Not sure if that will work.
    My suggestion is to use Trinidad. It has the concept of Regions which is very "tiles" like and you will be far more successful.

  • JSF and Struts - differences and integration goal.

    I am a newbie J2EE developer and I am not clear about main differences between JSF and Struts also I saw couple of articles describing integration between JSF and Struts. Could someone give me an explanation, what the main conceptual differences between those technologies and what's the goal of integration both of them?

    I describe the main differences between JSF and Struts in this sample Chapter from my JSF book:
    http://www.oreilly.com/catalog/jsvrfaces/chapter/ch01.pdf
    Hope that helps.

Maybe you are looking for

  • Multiple Users accessing the same core set of queried data

    Hi. We have a small call center and we want to build an app where the users can query the same core set of data and use it to initiate calls to study participants. The trick is that they will also need to update each record with information from the

  • Report to identify Inactive objects

    Hi, I faced some issues after Upgrade, where there were certain transactions that gave dump saying that a particular field or table doesnt exist. but when I went thru SE11 I did find those fields and tables in Active Mode, but even showing it Active,

  • "cfajaximport" Not found in currently active versions

    Dear all First I want to say I am very begginning. My problem is when I want to use some RIA sample appliaction (from adobe site) which is using some AJAX feature I have unknown runtime error during data saving. I have information that "The tag name:

  • Attaching library docs to email

    Gw 6.5--Long time DMS user and this question arose today--no one never noticed before. When a library doc is attached to a document, a static copy is attached--fine. Does that static copy of the doc go to the trash folder after the email is sent? Use

  • How do you Invert signed numbers?

    Hi there. A simple question: How can I invert the sign of an integer? ie) convert -12 to +12? No doubt there is a really simple way to do this, but I'm stumped, I cannot find anything and I've been working on this program all day. I'll be very gratef