-
1. Re: Actionparam passed by a modalPanel is null on submit pro
ilya_shaikovsky Nov 21, 2007 8:16 AM (in response to rhancke)you should use form elements inside you MP to send requests. and be carefull to avoid nested forms.
-
2. Re: Actionparam passed by a modalPanel is null on submit pro
rhancke Nov 22, 2007 4:29 PM (in response to rhancke)Thanks for you reply ilya_shaikovsky.
The same problem is happening when I try to use suggestionbox component.
Maybe I'm not definining some property to preserve the state of all fields renderized by ajax's reRender property.
1) The name is found by suggestionbox
2) The description input is populated by ajax(through actionListener)
3) When I submit the form, and some business rule is wrong, the form is showed again, but all fields populated by ajax before are null/blank. All fields that weren't populated by ajax are showed.
4) No exceptions or errors are showed
Could you give me some help ?
Follow below the jsp code:<html> <table> <form jsfc="h:form"> <tr> <td> <table> <tr> <td>Description:</td> <td> <input type="text" jsfc="h:inputText" id="description" value="#{bean.description}" size="41" maxlength="50" /> </td> </tr> <tr> <td>Name:</td> <td> <a4j:region> <input type="text" jsfc="h:inputText" id="name" value="#{bean.name}" size="41" maxlength="125"/> <rich:suggestionbox for="name" suggestionAction="#{bean.autoComplete}" var="beanPO" minChars="3"> <a4j:support event="onselect" actionListener="#{bean.onSelect}" reRender="description"/> <h:column> <h:outputText value="#{beanPO.name}"/> </h:column> </rich:suggestionbox> </a4j:region> </td> </tr> <tr> <td> <input type="submit" jsfc="h:commandButton" id="save" value="Save" action="#{bean.save}" /> </td> </tr> </table> </td> </tr> </form> </table> </html>
"ilya_shaikovsky" wrote:
you should use form elements inside you MP to send requests. and be carefull to avoid nested forms. -
3. Re: Actionparam passed by a modalPanel is null on submit pro
ilya_shaikovsky Nov 23, 2007 5:36 AM (in response to rhancke)please send me full working case directly.. I'll answer there under exploration.
-
4. Re: Actionparam passed by a modalPanel is null on submit pro
rhancke Nov 23, 2007 8:24 AM (in response to rhancke)ilya_shaikovsky,
I sent you an email with the attached project file.
Thx"ilya_shaikovsky" wrote:
please send me full working case directly.. I'll answer there under exploration. -
5. Re: Actionparam passed by a modalPanel is null on submit pro
ilya_shaikovsky Nov 23, 2007 10:02 AM (in response to rhancke)Xm.. seems like you send me incomplete or not a last working code. Parameters population doesn't work at this example.
For the parameters setting I could reccomend you to read: http://labs.jboss.com/wiki/RichFacesSuggestionGettingAdditionalProperties
And if you use request scoped beans - it will be usefull for you to learn about a4j:keepAlive component,
I think it should help you. Please inform us if this will not help. -
6. Re: Actionparam passed by a modalPanel is null on submit pro
rhancke Nov 23, 2007 11:19 AM (in response to rhancke)ilya_shaikovsky,
I sent you the project in a zip file without libs....
Well, I've followed your instructions about use <a4j:keepAlive> and all works perfect!
Thanks a lot"ilya_shaikovsky" wrote:
Xm.. seems like you send me incomplete or not a last working code. Parameters population doesn't work at this example.
For the parameters setting I could reccomend you to read: http://labs.jboss.com/wiki/RichFacesSuggestionGettingAdditionalProperties
And if you use request scoped beans - it will be usefull for you to learn about a4j:keepAlive component,
I think it should help you. Please inform us if this will not help. -
7. "Keeping alive" selectOneMenu value after form submit
rhancke Nov 26, 2007 2:47 PM (in response to rhancke)ilya_shaikovsky,
Using <a4j:keepAlive>, I've got other problem ... It doesn't "keep alive" h:selectOneMenu value after form submit.
Could you help me if there is solution for this problem?
Thx"rhancke" wrote:
ilya_shaikovsky,
I sent you the project in a zip file without libs....
Well, I've followed your instructions about use <a4j:keepAlive> and all works perfect!
Thanks a lot"ilya_shaikovsky" wrote:
Xm.. seems like you send me incomplete or not a last working code. Parameters population doesn't work at this example.
For the parameters setting I could reccomend you to read: http://labs.jboss.com/wiki/RichFacesSuggestionGettingAdditionalProperties
And if you use request scoped beans - it will be usefull for you to learn about a4j:keepAlive component,
I think it should help you. Please inform us if this will not help. -
8. Re:
rhancke Nov 26, 2007 2:52 PM (in response to rhancke)ilya_shaikovsky,
I forgot an important information about this new problem...
This problem happens only for h:selectOneMenu field that is reRender by ajax."rhancke" wrote:
ilya_shaikovsky,
Using <a4j:keepAlive>, I've got other problem ... It doesn't "keep alive" h:selectOneMenu value after form submit.
Could you help me if there is solution for this problem?
Thx"rhancke" wrote:
ilya_shaikovsky,
I sent you the project in a zip file without libs....
Well, I've followed your instructions about use <a4j:keepAlive> and all works perfect!
Thanks a lot"ilya_shaikovsky" wrote:
Xm.. seems like you send me incomplete or not a last working code. Parameters population doesn't work at this example.
For the parameters setting I could reccomend you to read: http://labs.jboss.com/wiki/RichFacesSuggestionGettingAdditionalProperties
And if you use request scoped beans - it will be usefull for you to learn about a4j:keepAlive component,
I think it should help you. Please inform us if this will not help. -
9. Re: Actionparam passed by a modalPanel is null on submit pro
ilya_shaikovsky Nov 27, 2007 4:18 AM (in response to rhancke)may be your select just outside submitted region? And its value just not applied?
-
10. Re: Actionparam passed by a modalPanel is null on submit pro
rhancke Nov 27, 2007 6:59 AM (in response to rhancke)ilya_shaikovsky,
Sorry, I didn't understand what to do according to your answer ...
Follow jsp and bean code for more details ...
Thx for your help.## form.jsp ## <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j"> <table> <form jsfc="h:form"> <a4j:keepAlive beanName="myBean" /> <tr> <td> <table> <tr> <td>Choose:</td> <td> <select jsfc="h:selectOneMenu" id="option" value="#{myBean.option}" label="Choose:"> <f:selectItem itemLabel="select ..." itemValue="0"/> <f:selectItem itemLabel="Option1" itemValue="1" /> <f:selectItem itemLabel="Option2" itemValue="2" /> <f:selectItem itemLabel="Option3" itemValue="3" /> <a4j:support event="onchange" reRender="city" /> </select> </td> </tr> <tr> <td>Cities:</td> <td> <select jsfc="h:selectOneMenu" id="city" value="#{myBean.city}" label="City:"> <f:selectItems value="#{myBean.citiesAsSelectItem}" /> </select> </td> </tr> <tr> <td> <input type="submit" jsfc="h:commandButton" id="save" value="Save" action="#{myBean.save}" /> </td> </tr> </table> </td> </tr> </form> </table> </html> ## MyBean.java ## public class MyBean implements Serializable { private ArrayList<CityVO> cities; private String city, option; private static final String[] names = { "Abba", "Abbeville", "Acworth", "Adairsville", "Adel", "Adrian", "Ailey", "Alamo", "Alapaha", "Albany", "Allenhurst", "Alma", "Alpharetta", "Alston", "Amboy", "Ambrose", "Americus", "Appling", "Arlington", "Ashburn", "Athens", "Athens-Clarke County", "Atkinson", "Atlanta", "Attapulgus", "Auburn", "Augusta", "Augusta-Richmond County", "Austell", "Avondale Estates", "Axson" }; public MyBean() { setCities(loadCities()); } public ArrayList<CityVO> loadCities() { ArrayList<CityVO> result = new ArrayList<CityVO>(names.length); for (int i = 0; i < names.length; i++) { result.add(new CityVO(String.valueOf(i + 1), names)); } return result; } public ArrayList<CityVO> getCities() { return this.cities; } public void setCities(ArrayList<CityVO> cities) { this.cities = cities; } public List<SelectItem> getCitiesAsSelectItem() { List<SelectItem> items = new ArrayList<SelectItem>(names.length); if ((getOption() != null) && (!"0".equals(getOption()))) { for (CityVO cityVO : getCities()) { items.add(new SelectItem(cityVO.getId(), cityVO.getName())); } } return items; } public String save() { String message = "Business Error"; FacesContext facesContext = FacesContext.getCurrentInstance(); facesContext.addMessage(null, new FacesMessage( FacesMessage.SEVERITY_ERROR, message, null)); return "failure"; } public String getCity() { return this.city; } public void setCity(String city) { this.city = city; } public String getOption() { return this.option; } public void setOption(String option) { this.option = option; } } ## faces-config.xml ## <faces-config> <application> <view-handler>com.sun.facelets.FaceletViewHandler</view-handler> </application> <managed-bean> <managed-bean-name>myBean</managed-bean-name> <managed-bean-class>org.myapp.bean.MyBean</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> </managed-bean> <navigation-rule> <navigation-case> <from-outcome>failure</from-outcome> <to-view-id>/outputPanel.jsp</to-view-id> </navigation-case> </navigation-rule> </faces-config>
"ilya_shaikovsky" wrote:
may be your select just outside submitted region? And its value just not applied?