Hi Lance, setting the variables to null resolved my issue. Not sure what I
was doing last night that wouldn't allow it to work. Anyhow Lance, would you
take a look at my code below and tell me if I'm using the RequestParameters
properly now? Also, how do you typically handle spaces in the URL
parameters, example 
Aston Martin is being converted to Aston$0020Martin rather than
Aston_Martin. 

Code sample using request parameters. Once again guys, I really appreciate
all your help. 

    <t:Form t:id="searchForm">        
        <t:Select t:id="searchYear" value="vehicleYear"
model="yearSearchModel"/><br/>
        <t:Select t:id="searchMake" zone="searchModelZone"
value="vehicleMake" model="makeSearchModel"/>
        <t:Zone t:id="searchModelZone">
            <t:Select t:id="searchModel" value="vehicleModel"
model="modelSearchModel"/>
        </t:Zone>
        <t:Submit/>
    </t:Form>


public class Used_Cars_For_SaleIndex {
    
    @Component(id = "searchForm")
    @Property
    private Form form;    
    @Inject
    private Session session;
    
    private String year;
    private String make;
    private String model;
    
    @Property
    private Vehicle vehicle;
    @Property
    private VehicleYear vehicleYear;
    @Property
    private VehicleMake vehicleMake;
    @Property
    private VehicleModel vehicleModel;
    
    @Inject
    private YearDAO yearDAO;
    @Inject
    private MakeDAO makeDAO;
    @Inject
    private ModelDAO modelDAO;
    @Inject
    private VehicleConfigurationDAO vehicleConfigurationDAO;
    
    @Property
    private SelectModel modelSearchModel;
    @Inject
    private SelectModelFactory selectModelFactory;
    
    @Inject
    private PageRenderLinkSource pageRenderLinkSource;
    @InjectComponent
    private Zone searchModelZone;
    @Inject
    private PageRenderLinkSource linkSource;
    
    void onActivate(@RequestParameter(value="year", allowBlank = true)
String year,
            @RequestParameter(value="make", allowBlank = true) String make,
            @RequestParameter(value="model", allowBlank = true) String
model) {
        this.year = year;
        this.make = make;
        this.model = model;
    }

    void onPrepareForRenderFromSearchForm() {  
        this.modelSearchModel =
this.selectModelFactory.create(this.vehicleConfigurationDAO.getModels(this.makeDAO.find(this.make)),
"name");
    }
    
    void onPrepareFromSearchForm() {       
        this.vehicleYear = this.yearDAO.find(year);
        this.vehicleMake = this.makeDAO.find(make);
        this.vehicleModel = this.modelDAO.find(model);        
    }

    Link onSuccess() {     
        Link link =
linkSource.createPageRenderLink(Used_Cars_For_SaleIndex.class);       
        if(vehicleYear != null) link.addParameterValue("year",
vehicleYear.getName());
        if(vehicleMake != null) link.addParameterValue("make",
vehicleMake.getName());
        if(vehicleModel != null) link.addParameterValue("model",
vehicleModel.getName());
        return link;
    }

    public List<Vehicle> getVehicles() {
        Criteria criteria = this.session.createCriteria(Vehicle.class);
        criteria.createAlias("vehicleYear", "vehicleYear");
        criteria.createAlias("vehicleMake", "vehicleMake");
        criteria.createAlias("vehicleModel", "vehicleModel");

        if (year != null) criteria.add(Restrictions.eq("vehicleYear.name",
year));        
        if (make != null) criteria.add(Restrictions.eq("vehicleMake.name",
make).ignoreCase());       
        if (model != null) criteria.add(Restrictions.eq("vehicleModel.name",
model).ignoreCase());        

        return criteria.list();
    }

    public SelectModel getYearSearchModel() {
        return this.selectModelFactory.create(this.yearDAO.findAll(),
"name");
    }

    public SelectModel getMakeSearchModel() {
        return this.selectModelFactory.create(this.makeDAO.findAll(),
"name");
    }
    
    public Object onValueChangedFromSearchMake(VehicleMake make) {
        this.modelSearchModel =
this.selectModelFactory.create(this.vehicleConfigurationDAO.getModels(make),
"name");
        return searchModelZone.getBody();
    }
}




--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/How-to-remove-query-parmeter-from-url-string-tp5716922p5716985.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to