>From: "stephan opitz" <[EMAIL PROTECTED]> 
>
> ok using the f:param makes it possible to submit value by commandLink... 
> 

[snippet]

> 
> problem is -> if i want to prepare data for view - like data list, 
> depending on submitted value - how is it possible to do this? in the 
> jsp or html file the value is given by an other class - how can i use 
> my submitted one? 
> 

The Shale ViewController is designed to help solve this problem.
http://shale.apache.org/features-view-controller.html


> but the actionlistener method is called before the view will built up? 
> 
> and trying to use ActionEvent event to read out works only fine in teh 
> actionlistener or fault is by me? 
> 
> UIParameter component = (UIParameter) 
> event.getComponent().findComponent("categoryId"); 
> long categoryId = Long.parseLong(component.getValue().toString()); 
> 

I'll point you to a couple examples that might be helpful.  The first is an 
example
of using the init() call back method on a ViewController.  It pulls the request 
parameter using the implicit el map, #{param}.  There are a bunch of ways to 
handle this.  You can also access params from the faces context.

http://svn.apache.org/viewvc/shale/trunk/shale-apps/shale-clay-usecases/src/main/java/org/apache/shale/usecases/symbols/RegistrationForm.java?view=markup

This next example uses an action binding and managed bean setter injection.  
The changeTab method is bound to an commandLink, [EMAIL PROTECTED]  The command 
link has a tabIndex parameter that is extracted by delivering a managed bean.

QueryParam paramObj = (QueryParam) getBean("queryParam");
String tabIndex = paramObj.getTabIndex();

The "queryParam" bean is populated with the request parameters and also cached 
in request scope.

 <managed-bean>
  <description>
   This class simulates the classic Struts FormBean where
   request parameters are populated in a POJO object.
  </description>
  <managed-bean-name>queryParam</managed-bean-name>
  <managed-bean-class>
   org.apache.shale.usecases.rolodex.QueryParam
  </managed-bean-class>
  <managed-bean-scope>request</managed-bean-scope>
  <managed-property>
   <property-name>tabIndex</property-name>
   <value>#{param.tabIndex}</value>
  </managed-property>
  <managed-property>
   <property-name>selectedName</property-name>
   <value>#{param.selectedName}</value>
  </managed-property>
 </managed-bean>


http://svn.apache.org/viewvc/shale/trunk/shale-apps/shale-clay-usecases/src/main/java/org/apache/shale/usecases/rolodex/Rolodex.java?revision=419348&view=markup


Gary


> 
> stephan 
> 
> 2006/7/13, stephan opitz : 
> > first - is it possible to log all submited params in to file or output 
> > of servers log? 
> > 
> > second: 
> > how i built input sides with command button is no problem... 
> > 
> > but if i have a commandlink, which should go to a side and has an 
> > hidden value, from which the sides generate output :-/ 
> > 
> > 
> > 
> > 
> > > value="#{categories.showCats}" /> 
> > 
> > 
> > 
> > 
> > > value="category_id" /> 
> > > value="#{node.identifier}" /> 
> > 
> > 
> > 
> > 
> > 
> > > value="#{node.description}" /> 
> > > value="nodeFolder" /> 
> > 
> > 
> > 
> > 
> > the commandlink links to another side... the method showCats will be 
> > called, but how i also submit the category_id and ist it usefull to 
> > use some kind of the new functions like init() to prebuilt output data 
> > from db for the given category_id 
> > 
> > stephan 
> > 

Reply via email to