facebook

JSF Editor shows invalid error/warning

  1. MyEclipse Archived
  2.  > 
  3. Bugs
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #256064 Reply

    visu5678
    Member

    JSF Editor shows an invalid error/warning when I used h:selectManyListbox with a value assigned to a String array. When I deployed the code it works fine but the JSF editor shows it as an error/warning with comment “EL expression does not evaluate to expected types for this attrribute”.

    #256105 Reply

    Riyad Kalla
    Member

    Can you give me a sample JSP page to test with, also are you using JSF 1.1 or 1.2?

    #256152 Reply

    visu5678
    Member

    My environment is – Eclipse 3.2 and MyEclipse5.0, JDK1.4, JSF1.1 (Sun reference Impl)

    How can I use JSF1.2? Do MyEclipse has support for JSF1.2? I created a MyEclipse Web Project and when I right click to add JSF capabilities, i can only found JSF1.1.

    Ok. here the sample code –

    JSF –

    <%@ page language=”java” pageEncoding=”ISO-8859-1″%>
    <%@ taglib uri=”http://java.sun.com/jsf/html&#8221; prefix=”h”%>
    <%@ taglib uri=”http://java.sun.com/jsf/core&#8221; prefix=”f”%>

    <%
    String path = request.getContextPath();
    String basePath = request.getScheme() + “://”
    + request.getServerName() + “:” + request.getServerPort()
    + path + “/”;
    %>

    <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
    <html>
    <head>
    <base href=”<%=basePath%>”>

    <title>My JSP ‘MyJsp.jsp’ starting page</title>

    <meta http-equiv=”pragma” content=”no-cache”>
    <meta http-equiv=”cache-control” content=”no-cache”>
    <meta http-equiv=”expires” content=”0″>
    <meta http-equiv=”keywords” content=”keyword1,keyword2,keyword3″>
    <meta http-equiv=”description” content=”This is my page”>
    <!–
    <link rel=”stylesheet” type=”text/css” href=”styles.css”>
    –>

    </head>

    <body>
    <f:view>

    <h:form>
    <table border=”0″ cellpadding=”10″>
    <tr>
    <td>

    <h:selectManyListbox value=”#{UserBean.firstSelectedList}”
    rendered=”true” required=”false” size=”20″> <f:selectItems value=”#{UserBean.firstList}” />
    </h:selectManyListbox>
    </td>
    <td align=”center”>

    <h:commandButton value=”>” rendered=”true”
    action=”#{UserBean.doButton1}” />
    <br>
    <h:commandButton value=”>>” rendered=”true”
    action=”#{UserBean.doButton2}” />
    <br>
    <h:commandButton value=”Remove” rendered=”true” action=”#{UserBean.doButton3}” />
    <br>
    <h:commandButton value=”RemoveAll” rendered=”true” action=”#{UserBean.doButton4}” />

    </td>
    <td>
    <h:selectManyListbox value=”#{UserBean.secondSelectedList}”
    rendered=”true” required=”false” size=”20″>
    <f:selectItems value=”#{UserBean.secondList}” />
    </h:selectManyListbox>
    </td>
    </tr>
    </table>
    </h:form>
    </f:view>
    </body>
    </html>

    and the Managed Bean –

    /**
    *
    */
    package com.mastercard;

    import java.util.ArrayList;
    import java.util.List;

    import javax.faces.model.SelectItem;

    /**
    * @author e023881
    *
    */
    public final class UserBean extends Object {

    /**
    *
    */
    private String password;
    /**
    *
    */
    private String name;

    private List firstList;
    private String[] firstSelectedList;

    private List secondList;
    private String[] secondSelectedList;

    /**
    * @return the firstList
    */
    public List getFirstList() {

    if(firstList == null)
    {
    firstList=new ArrayList();

    CMSelectedItem item1=new CMSelectedItem(“685663528525″,”685663528525”);
    CMSelectedItem item2=new CMSelectedItem(“685663528524″,”685663528524”);

    firstList.add(item1);
    firstList.add(item2);
    }

    return firstList;
    }
    /**
    * @param firstList the firstList to set
    */
    public void setFirstList(List firstList) {
    this.firstList = firstList;
    }

    /**
    * @return the secondList
    */
    public List getSecondList() {

    if(secondList == null)
    secondList = new ArrayList();

    return secondList;
    }
    /**
    * @param secondList the secondList to set
    */
    public void setSecondList(List secondList) {
    this.secondList = secondList;
    }

    /**
    * @return the firstSelectedList
    */
    public String[] getFirstSelectedList() {
    return firstSelectedList;
    }
    /**
    * @param firstSelectedList the firstSelectedList to set
    */
    public void setFirstSelectedList(String[] firstSelectedList) {
    this.firstSelectedList = firstSelectedList;
    }
    /**
    * @return the secondSelectedList
    */
    public String[] getSecondSelectedList() {
    return secondSelectedList;
    }
    /**
    * @param secondSelectedList the secondSelectedList to set
    */
    public void setSecondSelectedList(String[] secondSelectedList) {
    this.secondSelectedList = secondSelectedList;
    }

    /**
    * @return the password
    */
    public String getPassword() {
    return password;
    }
    /**
    * @param password the password to set
    */
    public void setPassword(String password) {
    this.password = password;
    }
    /**
    * @return the name
    */
    public String getName() {
    return name;
    }
    /**
    * @param name the name to set
    */
    public void setName(String name) {
    this.name = name;
    }

    public String loginUser() {
    if(“myeclipse”.equals(getName()) && “myeclipse”.equals(getPassword()))
    return “success”;

    // FacesContext facesContext = FacesContext.getCurrentInstance();
    // FacesMessage facesMessage = new FacesMessage(
    // “You have entered an invalid user name and/or password”);
    // facesContext.addMessage(“loginForm”, facesMessage);

    return “failure”;
    }

    public String doButton1()
    {

    String[] selected=getFirstSelectedList();

    if(selected != null)
    {
    for(int i=0;i<selected.length;i++)
    {
    CMSelectedItem item1=new CMSelectedItem(selected[i],selected[i]);

    if(!getSecondList().contains(item1))
    secondList.add(item1);

    }

    }

    return null;
    }

    public String doButton2()
    {
    setSecondList(firstList);

    return null;
    }

    public String doButton3()
    {
    String[] selected=getSecondSelectedList();

    if(selected != null)
    {
    for(int i=0;i<selected.length;i++)
    {
    CMSelectedItem item1=new CMSelectedItem(selected[i],selected[i]);

    if(getSecondList().contains(item1))
    secondList.remove(item1);

    }

    }
    return null;
    }
    public String doButton4()
    {
    secondList = new ArrayList();

    return null;
    }

    }

    #256755 Reply

    paulspencer
    Member

    Has this been declared a bug?

    I am seeing the same behavior, except the “value” is of type List instead of String[].

    Paul Spencer

    #256903 Reply

    paulspencer
    Member

    This appears to have been resolved in 5.0GA or 5.0.1

    #256912 Reply

    Thanks for checking.

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: JSF Editor shows invalid error/warning

You must be logged in to post in the forum log in