-
1. Re: Validation of h:selectOneMenu component populated dynamically
nbelaevski Apr 26, 2010 5:43 PM (in response to lenyas66)Hi Leonid,
In JSF all selects are validated against bean model and if there are submitted items that are not present in the model, validation fails due to security reasons. If you are absolutely sure that it's ok, then just build up select model from submitted data.
-
2. Re: Validation of h:selectOneMenu component populated dynamically
lenyas66 Apr 26, 2010 5:50 PM (in response to nbelaevski)Hi Nick,
The problem here is that we are not supposed to know what should be the values obtained from Sharepoint.
They are meant to be really dynamic and all communication should be handled by the client. There are actually some security problems in accessing SP from the server that runs on Linux. It is much easier to do in Javascript in the browser.
So, how could I pass them back to the server to build up select model? Could you provide some example?
Or maybe JSF just not needed here and I should build a simple jsp page, which wouldn't communicate to the server at all.
What do you think?
Leonid
-
3. Re: Validation of h:selectOneMenu component populated dynamically
harut Apr 27, 2010 3:10 AM (in response to lenyas66)1 of 1 people found this helpfulHi Leonid,
Whether JSF needed or not depends on current project business requirement specification...
So, how could I pass them back to the server to build up select model? Could you provide some example?
You can create afj:jsFunction, and call it in you javascript method (where you have a functionality of getting filenames...), by passing needed data as method param, e.g. you can construct any String with specified format (delimetered by commas "filename1, filename2,....") and further get separated filenames in server side business logic....
Here is similar functional from one of my projects:
<a4j:jsFunction name="showMonth"
reRender="fusMonthChrt"
actionListener="#{metricsController.initMonthlyChart}"
oncomplete="changeWindowPosition();">
<a4j:actionparam id="reportYearParam" name="reportYear"/>
<a4j:actionparam id="reportTypeParam" name="reportType"/></a4j:jsFunction>
.................................
function showChartByGivenParams(year, type)
{..............
showMonth(year, type);
}................................
/**
* Action Listener method, called when user clicks on
* any column in yearly Fusion Chart.
* @param event
*/
public void initMonthlyChart(ActionEvent event) {............................
FacesContext.getCurrentInstance().getExternalContext().getRequest().getParameter("reportType");
..............................
}