Announcement Announcement Module
Collapse
No announcement yet.
Using a form in a controller Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using a form in a controller

    Hi, i use a form to filter a result list.

    But i get this errors, but i don't know why and what to do ?[/b]

    Code:
    Thread [http-8080-Processor25] (Suspended (exception NotReadablePropertyException))
    	BeanWrapperImpl.getPropertyValue(String, String, String) line: 545
    	BeanWrapperImpl.getPropertyValue(String) line: 539
    	BeanWrapperImpl.isWritableProperty(String) line: 1035
    	BeanWrapperImpl.setPropertyValue(String, String, String, Object) line: 698
    	BeanWrapperImpl.setPropertyValue(String, Object) line: 624
    	BeanWrapperImpl.setPropertyValue(PropertyValue) line: 755
    	BeanWrapperImpl.setPropertyValues(PropertyValues, boolean) line: 782
    	ServletRequestDataBinder(DataBinder).bind(PropertyValues) line: 241
    	ServletRequestDataBinder.bind(ServletRequest) line: 173
    	ListeDesOffresController(BaseCommandController).bindAndValidate(HttpServletRequest, Object) line: 293
    	ListeDesOffresController(AbstractFormController).handleRequestInternal(HttpServletRequest, HttpServletResponse) line: 236
    	ListeDesOffresController(AbstractController).handleRequest(HttpServletRequest, HttpServletResponse) line: 121
    Here is my controller :
    Code:
    	<bean name="listeDesOffresController" class="org.astre.sig.web.controller.ListeDesOffresController">
    		<property name="formView"><value>listeDesOffresBourseFretView</value></property>
    		<property name="successView"><value>listeDesOffresBourseFret.html</value></property>
    		<property name="commandName"><value>form</value></property>
    		<property name="commandClass"><value>org.astre.sig.web.dataForm.ListeDesOffresForm</value></property>
    		<property name="bourseManager"> 
    			<ref bean="bourseManager"/> 
    		</property>
    		<property name="localisationManager"> 
    			<ref bean="localisationManager"/> 
    		</property>
    	</bean>
    Here is my Form :


    Code:
    public class ListeDesOffresForm extends BaseForm&#123;
    
    	private static Log log = LogFactory.getLog&#40;ListeDesOffresForm.class&#41;;
    	
    	//Liste des offres
    	private int maxOffresParPage;
    	private int numPage;
    	private int maxPage;
    	private int nbTotalOffresActives;
    	private int nbOffresResultantRecherche;
    	private List liste;
    
    	//Formulaire de recherche
    	private int idModeleRecherche;
    	private Pays pays;
    	
    	private List listePays;
    
    	private List listeRegionsEnlevement;
    	private List listeDepartementsEnlevement;
    
    	private List listeRegionsLivraison;
    	private List listeDepartementsLivraison;
    
    	private String idPaysEnlevement;
    	private String idPaysLivraison;
    	
    	private String idRegionEnlevement;
    	private String idRegionLivraison;
    	
    	private String idDepartementEnlevement;
    	private String idDepartementLivraison;
    
    	private ModeleRecherche modeleRechercheActive;	
    	private List RecherchesFret;
    	
    	public ListeDesOffresForm&#40;&#41; &#123;
    		numPage=1;
    		maxOffresParPage = 2;
    		nbTotalOffresActives=0;
    		nbOffresResultantRecherche=0;		
    		idModeleRecherche=-1;
    		idPaysEnlevement="-1";
    		idPaysLivraison="-1";
    		idRegionEnlevement="-1";
    		idRegionLivraison="-1";
    		idDepartementEnlevement="-1";
    		idDepartementLivraison="-1";	
    	&#125;
    ..//... Getter and Setters
    &#125;
    Jsp code :
    Code:
    		<spring&#58;bind path="form.listePays">			
    		  <select name="$&#123;form.idPaysEnlevement&#125;"  onchange="javascript&#58;rafraichir&#40;&#41;">			
    				<c&#58;forEach var="pays" items="$&#123;status.value&#125;">			
    		        <option <c&#58;if test="$&#123;pays.id==form.idPaysEnlevement&#125;" >selected</c&#58;if> value="<c&#58;out value="$&#123;pays.id&#125;"/>"><c&#58;out value="$&#123;pays.libelle&#125;"/></OPTION>
    		    </c&#58;forEach>
    		  </select>
    		</spring&#58;bind>
    Anyone an idea ?

  • #2
    Hi,
    I think it's your jsp code. You have to bind the selected option:

    Code:
    <spring&#58;bind path="form.idPaysEnlevement">         
    <select name="$&#123;status.expression&#125;" onchange="javascript&#58;rafraichir&#40;&#41;">         
                <c&#58;forEach var="pays" items="$&#123;form.listePays">         
                  <option <c&#58;if test="$&#123;pays.id==form.idPaysEnlevement&#125;" >selected</c&#58;if> value="<c&#58;out value="$&#123;pays.id&#125;"/>"><c&#58;out value="$&#123;pays.libelle&#125;"/></OPTION>
              </c&#58;forEach>
            </select>
    </spring&#58;bind>
    After submit you should find in 'idPaysEnlevement' the chosen value...

    Hope that helps,
    Markus

    Comment

    Working...
    X