Is it possible to use page-scope beans in value expression ?

Is it possible to use page-scope beans in value expressions ?
For example,
<c:forEach items="${DataScreens.records}" var="record" status="status">
<tr>
  <td><h:command_link action="#{DataScreen.editRecord}">
                <h:output_text value="#{DataScreen.modifyLabel}" />
               <!----- PLEASE NOTE THAT status IS OF PAGE-SCOPE IN THE NEXT LINE -->
               <f:parameter name="id" value="#{status.count}" />
          </h:command>
  </td>
  <td>...</td>
  <td>...</td>
</tr>
</c:forEach>In my case, I want to use JSTL instead of <h:dataTable>, because of some special
requirements in this screen. Can someone please provide me with a workaround ?
I get the following error on execution..
12/26/03 16:36:23:734 JST] 59f0302f FacesArraySuf W com.sun.faces.el.ext.FacesA
rraySuffix Attempt to apply the "." operator to a null value
[12/26/03 16:36:23:736 JST] 59f0302f FacesArraySuf W com.sun.faces.el.ext.FacesA
rraySuffix Attempt to apply the "." operator to a null value
[12/26/03 16:36:23:756 JST] 59f0302f WebGroup E SRVE0026E: [Servlet Error]-
[Argument Error: One or more parameters are null.]: javax.servlet.jsp.JspExcepti
on: Argument Error: One or more parameters are null.
at com.sun.faces.taglib.BaseComponentTag.doEndTag(BaseComponentTag.java:
961)
at com.sun.faces.taglib.html_basic.Command_LinkTag.doEndTag(Command_Link
Tag.java:222)
at org.apache.jsp._meisaiJoho._jspService(_meisaiJoho.java:365)
at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.j
ava:89)
Thanks,
Ajay

Hello Ajay,
I cant really understand how a particular style can be applied to only an individual column.In the simplest case the attribut 'columnClasses' of data_table contains
the same number of style classes as you have columns in your table. These
classes are then applied one to one to the columns.
If there are fewer classes than columns then you can think of the classes
beeing repeated until there is one class for each column. In the extreme
case of only one class this means that this class is applied to all columns.
The following example shows the simplest case of three columns
and three classes. Just remove one or two classes from the columnClasses
attribute to see the 'repeating' behavior.
Wolfgang Oellinger
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<% session.setAttribute("PersonList", new foo.PersonList()); %>
<f:view>
<html>
<head>
    <title>Styled Data Table</title>
    <style>
     /* for the columns */
        .nameClass { width: 30em; color: red; }
        .birthdayClass { width: 12em; color: green; background-color: #ccc; }
        .heightClass { width: 5em; color: blue; }
     /* for the header */
        .yellowClass { background-color: yellow; }
    </style>
</head>
<body>
  <h:form>
  <h3>Styled Data Table</h3>
  <h:data_table columnClasses="nameClass,
                               birthdayClass,
                               heightClass"
                        style="border: 1px solid black;"
                  headerClass="yellowClass"
                        value="#{PersonList.members}"
                          var="person">
    <h:column>
      <f:facet name="header"><h:output_text value="Name"/></f:facet>
      <h:output_text value="#{person.name}"/>
    </h:column>
    <h:column>
      <f:facet name="header"><h:output_text  value="Birthday"/></f:facet>
      <h:output_text value="#{person.birthday}"/>
    </h:column>
    <h:column>
      <f:facet name="header"><h:output_text  value="Height"/></f:facet>
      <h:output_text value="#{person.height}"/>
    </h:column>
  </h:data_table>
  </h:form>
</body>
</html>
</f:view>

Similar Messages

  • Repost: Use Page-scope expressions in Value expressions

    Dear Adam Winer and expert group,
    I woud like to repost my problem. I had posted this in an earlier thread today. The issue that I would
    like to raise is regarding being able to use page-scoped beans in value expressions. I am trying to
    port some screens from Struts to JSF. Struts allows you to assign page-scoped beans to its input
    components. Adam Winer, you have been very helpful to me. I hope this issue can be solved.
    Thanks,
    Ajay
    Dear Adam Winer,
    I must admit that I am not able to understand your post properly. It is certainly because I have not
    properly understood the JSF architecture properly as yet.
    JSF automatically shows model bean values in the browser, and takes user input back into the model bean.
    But it would be nice to have the following scenario to work out....
    1. The JSP assigns the (initial) value to the JSF component.
    2. This value is displayed in the browser.
    3. When the user submits the form, the value goes to the model bean.
    Your post seems to indicate that the above is not possible. Could there not be any architectural
    workaround to make this possible ?
    Your post also seems to indicate that it is not possible to use an action from within a <c:forEach>.
    The following could also be perhaps ok (if it doesnt cause some other problem).
    <h:input_text initValue="#{pageScopeBean.someValue}" value="#{someBean.someValue}"><f:parameter initValue="#{status.count}" value="#{DataTable.selectedIndex}" />
    Perhaps, the expert team can come up with some brilliant solution. I am really keen.
    Ajay
    P.S ("Delayed execution", "Immediate execution", "does not exist on subsequent requests" are presently
    Greek and Latin to me.)
    No, that's not really possible, and it's not because
    we didn't try!
    "#{}" syntax means "evaluate this later". It has to
    mean that, for lots of reasons, including the need to
    evaluate these values on subsequent requests, and to
    evaluate these values repeatedly when a repeater
    component (like data_table) renders its output.
    Obviously, pageScope.status.count won't exist on
    subsequent requests, so that bit is hopeless. But it
    won't necessarily even work in the middle of the page,
    because there's no guarantee that the value of that
    <f:parameter> will only be used during the execution
    of <c:forEach>.
    We'd considered adding support for both delayed
    execution - "#{}" - and immediate execution - "${}" on
    JSF attributes, which would enable an example like
    this, but decided not to, for two reasons. First, it
    would be very confusing. Second, it actually opened a
    small security hole to do so that can't be solved
    without changes to the JSP EL architecture.
    -- Adam Winer (EG member)

    Dear Adam Winer,
    I read your post again and understood what you mean by "delayed execution" and "immediate execution".
    I am sorry, I think I read your post too quickly and hence didnt compherehend it.
    Please let me know if you think an alternative syntax such as
    <h:input_text initValue="#{pageScopeBean.someValue}" value="#{myBean.someValue}"/>Perhaps, this is not so different from the "#{}" and "${}" syntax that was discussed in the expert group.
    I am trying to imagine why a security loop-hole could be caused. If Struts doesnt have any problem
    getting values from a page-scoped bean, why does JSF have the problem ?
    Thanks for your help.
    Ajay
    We'd considered adding support for both delayed
    execution - "#{}" - and immediate execution - "${}" on
    JSF attributes, which would enable an example like
    this, but decided not to, for two reasons. First, it
    would be very confusing. Second, it actually opened a
    small security hole to do so that can't be solved
    without changes to the JSP EL architecture.

  • Possible to use pages as a "typewriter"?

    I have forms that I'd like to fill out with my printer essentially used as a typewriter.  Can Pages be used for this?

    Be interestingly awkward, be right up there with asking how to use your car as a steam locomotive.
    I presume the forms are not carbon backed duplicates?
    Nor simply available as a pdf file?
    You could scan the Form to find the positions to fill in the details and fit Texboxes to those, then delete the scan.
    The time it would take would be silly.
    You can't just fill this in by hand or go to a Salvos/Vinnies or Pawn Shop and pick up a cheap discarded typewriter?
    Peter

  • Is it possible to use Oracle Memebership Providers with Oracle Express

    I am using Oracle Express as development database and I was able to create the ORA_ASPNET_ tables and procedures but when I try to use Microsofts "ASP .NET Configuration" tool to create users and roles I get this error message: OracleConnection.ConnectionString is invalid
    When I use the connection string in code to connect to the database I am successful, I am able to open and close a connection to the Oracle Express database.
    This is the connection string I am using: <add name="OraAspNetConString2" connectionString="DATA SOURCE=localhost:1521/XE;ENLIST=false;METADATA POOLING=False;PASSWORD=CREDENTIALSMGR;PERSIST SECURITY INFO=True;STATEMENT CACHE PURGE=True;USER ID=CREDENTIALSMGR;" providerName="Oracle.DataAccess.Client"/>
    So I am wondering why when I run the application and the membership class tries to verify the user I get the error message: OracleConnection.ConnectionString is invalid
    I have been looking at this a couple of days now so not sure what the problem is, any help?

    I suggest that update your machine.config file under your
    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG.
    There is one following entry. You may try to update the
    connectionString with a valid string value.
    <add name="OraAspNetConString" connectionString=" " />

  • Cannot save beans in a session OR use the same beans in multiple pages

    Hi all I use these code to my jsp file to create a session and store a bean.
    Unfortunately, the session cannot store the beans so that I can use them in the next page.What did I omit? Regardless the session scope, can I use request scope beans and with jsp:forward use them in multiple page? (I have tried it but it doesn't work).
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@page session="true"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <%
    String nextPage = request.getParameter("np");
    if(nextPage.equalsIgnoreCase("checkDate")){
    %>
      <jsp:useBean id="checkDate" scope="request" class="essex.kkarad.beans.checkDateBean" />
      <jsp:setProperty name="checkDate" property="*"/>
    <%
        checkDate.validate();
    %>
    <jsp:forward page="Availability.jsp"></jsp:forward>
    <%
    } else if(nextPage.equalsIgnoreCase("checkRooms")) {
    %>
    <jsp:useBean id="checkRooms" scope="request" class="essex.kkarad.beans.checkRoomsBean" />
    <jsp:setProperty name="checkRooms" property="*"/>
    <%
       if(!checkRooms.validate()){
    %>
    <jsp:forward page="Availability.jsp"></jsp:forward>
    <%
    %>
    <%
    %>

    You should also be encoding the URL so that you don't have to worry about loosing the session if the user has cookies turned off:
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@page session="true"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <%
      String nextPage = request.getParameter("np");
      String availabilityPage = response.encodeURL("Availability.jsp");
      if(nextPage.equalsIgnoreCase("checkDate")){
    %>
      <jsp:useBean id="checkDate" scope="session" class="essex.kkarad.beans.checkDateBean" />
      <jsp:setProperty name="checkDate" property="*"/>
    <%
        checkDate.validate();
    %>
    <jsp:forward page="<%=availabilityPage%>"></jsp:forward>
    <%
      } else if(nextPage.equalsIgnoreCase("checkRooms")) {
    %>
    <jsp:useBean id="checkRooms" scope="session" class="essex.kkarad.beans.checkRoomsBean" />
    <jsp:setProperty name="checkRooms" property="*"/>
    <%
       if(!checkRooms.validate()){
    %>
    <jsp:forward page="<%=availabilityPage%>"></jsp:forward>
    <%
    %>
    <%
    %>

  • How to return a service method result to JSF Page w/ request-scope bean?

    From a .jspx page, I call a request-scoped backing bean which in turn calls an AM service method. The AM service method will return an object with multiple values. Based on the results, I will set the navigation case and then call another .jspx page.
    How can I pass the result values from the AM service method to the next .jspx page? Note I will only use request-scoped beans and do not want to use session-scope bean.
    Thanks.

    Ok - I can set a new processScope var in the backing bean and then reference it in the next .jspx page:
    backing bean:
    EL.setBCVal("#{processScope.newcustidhex}", svcresult);
    where EL is utility class
    public static void setBCVal(String expr, Object value) {
    FacesContext fc = FacesContext.getCurrentInstance();
    ValueBinding vb = fc.getApplication().createValueBinding(expr);
    vb.setValue(fc,value);
    return;
    }

  • Use Pages like a drawing program

    I'm on the trial version of pages right now, and before I purchase the program, becasue it seems really flexible, is is possible to use Pages like a drawing program, or as other page layout programs like Pagemaker or InDesign?
    iBook, iMac DV   Mac OS X (10.4.3)  

    Kyler,
    Welcome to Apple Discussions. Neither PageMaker, InDesign, nor Pages is a drawing program. Yes, there are some very rudimentary things you can do to insert lines and boxes, but that's a far cry from what Freehand will do. Steve Jobs introduced iWork by saying, "We're building the successor to AppleWorks." Many have inferred from that statement that Apple will eventually release all of the iWork apps that currently make up the AppleWorks suite: draw, database, and spreadsheet. But that's just speculation, although at least somewhat accurate. So, if you need a drawing program, Pages isn't going to get it done for you. But neither will PageMaker or InDesign.

  • How to scope beans for a JSF Confirmation Page

    I have a web form with corresponding backing bean for each input field. I have two buttons on the form. Here is some of the page:
    <h:inputText id="clientName" value="#{clientBean.company}" required="true"/>
    <h:inputText id="clientContact" value="#{clientBean.contact}"/>
    <h:commandButton id="btn_Submit" value="Submit" action="#clientBean.save}"/>
    <h:commandButton id="btn_Cancel" value="Cancel" immediate="true" action="cancel"/>
    Navigation rules display a confirmation page with the inputs the user has entered, and the cancel button brings them back to a simple menu screen (where they can click a link and re-visit this web form).
    IF THE MANAGED-BEAN-SCOPE for clientBean is set to REQUEST, I cannot use the bean attributes to populate outputText elements on a confirmation page (they are no longer in the current request). (I'm OK with this....)
    IF I SET THE MANAGED-BEAN-SCOPE for clientBean to SESSION, I can use the attributes of the managed-bean to drive the confirmation page, HOWEVER... if the user fills in the form and clicks CANCEL, then re-visits the web form, the values they entered prior to clicking Cancel are pre-populated in the web form.
    I've even gone as far as to have the Cancel button fire a cancel() method on the clientBean where I set all backing attributes to empty strings. That doesn't work either.
    Is there a way I can remove a managed-bean instance from the session scope entirely when the user clicks Cancel? Or is there a preferred method of ensuring that form values make it to the confirmation page using request scoped beans?

    I'd the same problem ever.
    It's not a good way to do these clear in the cancel button,
    for users maybe not click the cancel button, but click others links on the page
    and quit, after a while, then goto the form, there will be the previous data
    displayed as click back on the confirm page.
    at last i resolve the problem by adding a page before the form page.
    all links to the form page are linked to the new page,
    in the new page,
    1st, clear the state of the managed-ben(clientBean),
    there were a few ways to do this,
    (1), change all the properties of the clientbean to a default value.
    (2), remove the clientbean from the session(JSF will create an new instance when it remove from the session)
    2nd, redirect the request to the form page.
    You may write only one page (the clear-state and forword page) for all form in the application by passing the managed-bean to be cleared as a parameter.
    Hope be helpful for you.

  • "Message from Webpage (error) There was an error in the browser while setting properties into the page HTML, possibly due to invalid URLs or other values. Please try again or use different property values."

    I created a site column at the root of my site and I have publishing turned on.  I selected the Hyperlink with formatting and constraints for publishing.
    I went to my subsite and added the column.  The request was to have "Open in new tab" for their hyperlinks.  I was able to get the column to be added and yesterday we added items without a problem. 
    The problem arose when, today, a user told me that he could not edit the hyperlink.  He has modify / delete permissions on this list.
    He would edit the item, in a custom list, and click on the address "click to add a new hyperlink" and then he would get the error below after succesfully putting in the Selected URL (http://www.xxxxxx.com), Open
    Link in New Window checkbox, the Display Text, and Tooltip:
    "Message from Webpage  There was an error in the browser while setting properties into the page HTML, possibly due to invalid URLs or other values. Please try again or use different property values."
    We are on IE 9.0.8.1112 x86, Windows 7 SP1 Enterprise Edition x64
    The farm is running SharePoint 2010 SP2 Enterprise Edition August 2013 CU Mark 2, 14.0.7106.5002
    and I saw in another post, below with someone who had a similar problem and the IISreset fixed it, as did this problem.  I wonder if this is resolved in the latest updated CU of SharePoint, the April 2014 CU?
    Summary from this link below: Comment out, below, in AssetPickers.js
    //callbackThis.VerifyAnchorElement(HtmlElement, Config);
    perform IISReset
    This is referenced in the item below:
    http://social.technet.microsoft.com/Forums/en-US/d51a3899-e8ea-475e-89e9-770db550c06e/message-from-webpage-error-there-was-an-error-in-the-browser-while-setting?forum=sharepointgeneralprevious
    TThThis is possibly the same information that I saw, possibly from the above link as reference.
    http://seanshares.com/post/69022029652/having-problems-with-sharepoint-publishing-links-after
    Again, if I update my SharePoint 2010 farm to April 2014 CU is this going to resolve the issue I have?
    I don't mind changing the JS file, however I'd like to know / see if there is anything official regarding this instead of my having to change files.
    Thank you!
    Matt

    We had the same issue after applying the SP2 & August CU. we open the case with MSFT and get the same resolution as you mentioned.
    I blog about this issue and having the office reference.
    Later MSFT release the Hotfix for this on December 10, 2013 which i am 100% positive should be part of future CUs.
    So if you apply the April CU then you will be fine.
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

  • On my ipad, is it possible to use stylus or fingers to copy and paste a specific area on a document, PDF., web page, etc... It would be great to pull specific areas out of a PDF. And paste into a note app I'm thinking of downloading.  Thank you.

    On my ipad, is it possible to use a stylus or fingers to draw out a specific area to copy and paste;  I'm looking to copy from a word document, PDF., web page, etc... It would be great to pull specific areas out of a PDF. And paste into a note app I'm thinking of downloading.  Thank you.

    Yes. I do it using Adobe Reader for PDF files, Pages for Word files, I can copy from Safari or iCab Mobile and paste into another app. I use my finger even though I do have a stylus. I rarely use my stylus anymore, but yes it's possible.

  • Is it possible to use JSF file as as error page.

    I am using jsf file as an error page.It is working in fine in websphere. But if i am using that only the exception is raised it is not going to error page.
    In Web.XML file,
    <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>
    <error-page>
    <error-code>403</error-code>          <location>/faces/unauthorized.jsp</location>
    </error-page>
    jsf codings are placed under *.jsp files. In the time submitting form data to server a method throws NumberFormatException. This exception information is displayed in console. but blankpage is coming . It is not redirected to error.jsp fle which is under faces/error.jsp.
    If i am directly giving /error.jsp then it is giving Faces context is not created error.
    So i tried use simple jsp(pure jsp) file wihtin the folder and i set path like /pages/foo.jsp. It is working.
    Tell me is it possible to use jsf as error page.

    What would you hope to do with the reference?  The Mathscript node doesn't have a file reading capability.  You need to read the file and pass the data into the Mathscript node.
    EDIT: I stand corrected.  You need to use the fopen and fclose functions inside of the MathScript node to be able to read a file inside of it.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Help!  Creating a website using Pages... is it possible?!

    Hi,
    I'm created a document in Pages that I exported as HTML anticipating using it as a Website. The formating did not transfer and I'm wondering if it's possible to use this beautiful application to easily make a website. This is the first time I've tried creating a website so any other suggestions would be helpful. The news of our website being available has been published so I'm under the wire to complete it!
    BTW, I looked at the website/homepage option with .Mac but it's not as flexible and I need to use the website at school, not at my home.
    Any suggestions would be most appreciated.
    Robin

    It's possible, but not recommended by those who have tried it. Results have been disappointing, to say the least, as you have found.
    I use Freeway Express by Soft Press, but it is an additional expense. I have seen others suggest the free Nvu or Netscape Composer. Try Google, MacUpdate or VersionTracker to find them.
    Peggy

  • How to use the same bean from Jsp and Servlet

    I want to use the same bean instance from both the servlet and jsp.
    for eg. if a create a bean using the jsp:useBean in servlet and if a modify some values, that values should be reflected while i access the same bean from the servlet. But instead of that the servlet is creating a new instance of the bean.
    is it possible?
    Thanks in advance

    Hi,
    When you call jsp:useBean you inform a scope (session, request, page...)
    This means the bean instance will be stored in that scope.
    So, if the informed scope is session, then, in the servlet you could get the bean instance back from the session, this way:
    HttpSession session = request.getSession();
    Bean b = (Bean) session.getAttribute("bean_id");
    Regards,
    Filipe Fedalto

  • How to use a managed bean in a bounded task flow without definig it in adfc-config

    Dear all
    I create a bounded task flow without page fragments (the pages are jspx), i created a jspx page with a button that its action has bounded to a managed bean function.
    i defined the managed bean on the corresponding bounded task flow, but it does not work.
    But there is no problem when i define the managed bean in adfc-config.xml.
    can anybody help me with this problem.
    is it possible to use jspx page with backing bean in bounded task flows, without defining the beans on adfc-config?
    Thank you very much

    Dear Timo
    I use jDev 11.1.1.6 and the scope is Request.Although when i use task flow page fragment and create jsff pages, there is no problem.

  • Connecting to a database in JSP but using connection in bean

    I have a bean which connects to a database which is as follows:
    package MyPackage;
    import java.sql.*;
    public class DataSourceBean{
            public DataSourceBean(){
         public void setDriver(String driver) throws ClassNotFoundException {
              Class.forName(driver);
         public void setUrl(String aUrl){
              url=aUrl;
         public void setUsername(String aUsername){
              username=aUsername;
         public void setPassword(String aPassword){
              password=aPassword;
         public static Connection getConnection() throws SQLException{
              return DriverManager.getConnection(url, username, password);
         private static String url;
         private static String username;
         private static String password;
    }I then connect to a database through my JSP page:
    <jsp:useBean id="db" class="MyPackage.DataSourceBean" scope="application">
       <jsp:setProperty name="db" property="driver" value="sun.jdbc.odbc.JdbcOdbcDriver" />
       <jsp:setProperty name="db" property="url" value="jdbc:odbc:MyDB" />
    </jsp:useBean>This opens the database for the session, but I then want to allow people to login using a seperate bean.
    My question is how do I use the connection created in the JSP page above in my login bean?
    I have also tried connecting to a database in my LoginBean by using:
    DataSourceBean dsb=new DataSourceBean();
    yet it doesn't recognise DataSourceBean for some reason.
    BTW my book suggests opening up the database using scope="application" but to me it seems that keeping the database open is risky, is it OK to keep the database open for the whole session? do you have any other suggestions for accessing the database through my DataSourceBean?
    Thanks for any help.

    hi shock,
    there are a number of considerations when it comes to the database connections.
    first of all is the database server yours or are you buying a hosting scheme?
    if the database server is yours then you may consider building a database connection pool and keeping it in a session parameter. there's no harm in that because connections are opened as needed and closed when not needed. you can specify the minimum and maximum number of connections and connectio keep-alive times.
    if you purchase your database from a host they possibly would object to having a db connection pool as connections are valuable for them. but in this case there is no harm to create a connection to the database per request because creating database connections are costly only for the database server. your application will not slow down that much.
    for performance check sites: www.crystaltours.com or www.seckinkonaklar.com
    in both sites all connections are created per request and the complete content (including menus and application properties) comes from the database.
    my suggestion is that if you are writing a commercial application that will be hosted in a server that is not yours then create a connection per request (no pooling here).
    i also would suggest to put your database access code in a single class -not in a bean- for easy maintenance, you can use that class in your beans.
    i hope this was your answer.
    cem.

Maybe you are looking for