0 Replies Latest reply on Sep 30, 2008 8:13 PM by Anton Polyakov

    Submitting page with params from javascript

    Anton Polyakov Newbie

      Hello all.


      Possibly, I'm using a wrong pattern, but please help me to make it right. The problem is:


      I want to be able to create and edit some objects (events). I have a bean called CalendarEventEditor for this. It should be able to either create a new object or to edit existing.
      When I'm creating the object I'm using simple JSF techniques like embedding this code into my custom component (events holder):


      htmlEditCreatingDetailsLink.setActionExpression(facesCtx.getApplication().getExpressionFactory()
                          .createMethodExpression(elContext, "#{CalendarEventEditor.editEvent}", String.class, new Class[0]));
      


      and declaration to redirect to edit.xhtml after editEvent method:


          <page view-id="/calendar/calendar.xhtml" 
                login-required="true">
              <navigation from-action="#{CalendarEventEditor.editEvent}">
                  <redirect view-id="/calendar/editEvent.xhtml"/>
              </navigation>
          </page>
      


      All perfect so far.


      But already created objects are displayed dynamically using Javascript Remoting (it's a custom component, so when holder component itself is rendered no events exist). How can I invoke the same method and redirect to edit page from these objects? (let's assume that each object has its ID, so distinguishing them is not a problem).


      Thank you!