Results 1 to 2 of 2

Thread: Using a form in a controller

Hybrid View

  1. #1

    Default 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. #2
    Join Date
    Aug 2004
    Location
    München/Germany
    Posts
    7

    Default

    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

Similar Threads

  1. Replies: 4
    Last Post: Sep 1st, 2010, 01:38 AM
  2. Replies: 3
    Last Post: Jun 8th, 2010, 03:27 AM
  3. Replies: 6
    Last Post: Jul 20th, 2007, 05:56 AM
  4. Replies: 0
    Last Post: Jun 10th, 2005, 08:22 AM
  5. Controller to Form Navigation?
    By cnelson in forum Web
    Replies: 1
    Last Post: Aug 20th, 2004, 06:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •