This discussion is archived
5 Replies Latest reply: May 17, 2012 1:52 PM by 879675 RSS

Accessing URL Parameters in Form

879675 Newbie
Currently Being Moderated
I hope I'm just a little confused or missing the obvious, as it seems like this isn't rocket science :)

Here's what I'm trying to do, but failing using OW 8.1.1.4.. At least this is the simple test case for what I'm trying to do.

1. Create JSP that someone external to OW calls with some different url parameters ( IE: http://locahost/idm/user/test.jsp?item1=value1)
2. The test.jsp then loads up a test form that simply displays the value from item1.

Seems no matter how i reference the parameters in the form I get null values. display.state also shows to be null in the trace.

Thanks for any help!

Here's my test.jsp and testform.xml:
-----
<%@ include file="../includes/headStartUser.jsp"%>

<%
     String pageTitle = "TESTING";
          String bodyAttributes = "onload=\"selectFirstEditField();\"";
          
          GenericEditForm formC = new GenericEditForm();
          
          try {
                              
          formC.setViewId("List");
          formC.setSessionAttribute("testform");
          formC.setAlwaysRefresh(true);
          formC.setOption("type", "WorkItem");
          formC.setOption("endUser", "true");
          formC.setOption("Form", "testform");
                                        
          formC.setNextURL(response.encodeURL("user/main.jsp"));
          formC.setCancelURL(response.encodeURL("user/main.jsp"));
          formC.setPostURL("user/workItemEdit.jsp?item1=" + com.waveset.util.URLUTF8Encoder.encode(req.getParameter("item1")));
          String url = formC.process(req);
          }
          catch (Throwable th) {
          formC.addError(th.getLocalizedMessage());
          %><%= com.waveset.util.Util.stackToHtmlComment(th) %><%
          }
          %>

          <%@ include file="userHeader.jsp" %>

<%= formC.generateHTML() %>

          <%@ include file="userFooter.jsp" %>
          
-----

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Configuration PUBLIC 'waveset.dtd' 'waveset.dtd'>
<!-- MemberObjectGroups="#ID#Top" extensionClass="Form" id="#ID#UserForm:testform"
     name="testform" -->
<Configuration id='#ID#testform' name='testform'     wstype='UserForm'>
     <Extension>
          <Form name='testform' noDefaultButtons='true' baseContext="variables" objectLocationID='objectType=UserForm&amp;objectName=testform&amp;objectPath=0&amp;isBegin=true'>
               <Display class='EditForm'>
<Property name='title' value=' '/>
<Property name='rowPolarity' value='false'/>
<Property name='noInlineFieldErrors'>
<Boolean>true</Boolean>
</Property>
<Property name='noTopFieldErrors' value='true'/>
<Property name='requiredMarkerLocation' value='none'/>
               </Display>
               
               <Field name='workItemId'>
                    <Default>
                    <block name='-----workItemId-----' trace='true'>
                    <invoke name='getParameter'>
<ref>:display.state</ref>
<s>item1</s>
</invoke>
<ref>item1</ref>
</block>
                    </Default>
               </Field>     

          </Form>
     </Extension>
     <MemberObjectGroups>
          <ObjectRef type='ObjectGroup' id='#ID#Top' name='Top' />
     </MemberObjectGroups>
</Configuration>
  • 1. Re: Accessing URL Parameters in Form
    801120 Explorer
    Currently Being Moderated
    try this code

    <invoke name='getAttribute'>
    <invoke name='getSession'>
    <invoke name='getRequest'>
    <ref>:display.state</ref>
    </invoke>
    </invoke>
    <s>attributeName</s> <!-- In your case item1-->
    </invoke>
  • 2. Re: Accessing URL Parameters in Form
    879675 Newbie
    Currently Being Moderated
    Unfortunately, :display.state is null, so it doesn't provide the results :(

    invoke name='getAttribute'>
    <invoke name='getSession'>
    <invoke name='getRequest'>
    <ref>:display.state</ref>Resolved display.state to null --> null
    </invoke> --> null
    </invoke> --> null
    <s>item1</s> --> item1
    </invoke> --> null
  • 3. Re: Accessing URL Parameters in Form
    879675 Newbie
    Currently Being Moderated
    I've also tried referencing the arguments in the form as op_item1, but that doesn't provide the value either :(
  • 4. Re: Accessing URL Parameters in Form
    labby Newbie
    Currently Being Moderated
    How did you reference it? This worked for me in the past.

    For example:

    /idm/user/anonEnrollment.jsp?id=endUserAnonymousEnrollment&op_m=TEST
    <Field name='organization'>
    <Display class='Label'>
    <Property name='title' value='Organization'/>
    </Display>
    <Expansion>
    <cond>
    <isnull>
    <ref>m</ref>
    </isnull>
    <s>TEST2</s>
    <ref>m</ref>
    </cond>
    </Expansion>
    </Field>
  • 5. Re: Accessing URL Parameters in Form
    879675 Newbie
    Currently Being Moderated
    I'm calling the url like this: http://localhost:9090/idm/user/test.jsp?item1=abc

    with this test.jsp:

    ----
    <%@ include file="../includes/headStartUser.jsp"%>

    <%
         String pageTitle = "TESTING";
              String bodyAttributes = "onload=\"selectFirstEditField();\"";
              
              GenericEditForm formC = new GenericEditForm();
              
              try {
                                  
              formC.setViewId("List");
              formC.setSessionAttribute("testform");
              formC.setAlwaysRefresh(true);
              formC.setOption("type", "WorkItem");
              formC.setOption("endUser", "true");
              formC.setOption("Form", "testform");
                                            
              formC.setNextURL(response.encodeURL("user/main.jsp"));
              formC.setCancelURL(response.encodeURL("user/main.jsp"));
              formC.setPostURL("user/workItemEdit.jsp?item1=abc");
              String url = formC.process(req);
              
              }
              catch (Throwable th) {
              formC.addError(th.getLocalizedMessage());
              %><%= com.waveset.util.Util.stackToHtmlComment(th) %><%
              }
              %>

              <%@ include file="userHeader.jsp" %>

    <%= formC.generateHTML() %>

              <%@ include file="userFooter.jsp" %>
    ----
    And this form:
              
    <?xml version='1.0' encoding='UTF-8'?>
    <!DOCTYPE Configuration PUBLIC 'waveset.dtd' 'waveset.dtd'>
    <!-- MemberObjectGroups="#ID#Top" extensionClass="Form" name="testform" -->
    <Configuration id='#ID#testform' name='testform' wstype='UserForm'>
         <Extension>
              <Form name='testform' noDefaultButtons='true'>
                   <Display class='EditForm'>
                        <Property name='title' value=' ' />
                        <Property name='rowPolarity' value='false' />
                        <Property name='noInlineFieldErrors'>
                             <Boolean>true</Boolean>
                        </Property>
                        <Property name='noTopFieldErrors' value='true' />
                        <Property name='requiredMarkerLocation' value='none' />
                   </Display>

                   <Field name='workItemId'>
                        <Default>
                             <block name='-----workItemId-----' trace='true'>
                                  <ref>display.state</ref>
                                  <invoke name='getParameter'>
                                       <ref>:display.state</ref>
                                       <s>item1</s>
                                  </invoke>
                                  <ref>item1</ref>
                                  <ref>op_item1</ref>
                                  <invoke name='getAttribute'>
                                       <invoke name='getSession'>
                                            <invoke name='getRequest'>
                                                 <ref>:display.state</ref>
                                            </invoke>
                                       </invoke>
                                       <s>item1</s>
                                  </invoke>
                             </block>
                        </Default>
                   </Field>
                   <Field name='mainPanel'>
                        <Display class='Panel'>
                             <Property name='valign' value='top' />
                             <Property name='horizontal' value='true' />
                             <Property name='style' value='cargilltable' />
                             <Property name='width' value='800' />
                        </Display>
                        <Field name='panel1'>
                             <Display class='Panel'>
                                  <Property name='valign' value='top' />
                                  <Property name='width' value='400' />
                             </Display>
                             <Field>
                                  <Display class='Html'>
                                       <Property name='html'>
                                            <concat>
                                                 <s>WORKITEM:</s>
                                                 <ref>workItemId</ref>
                                                 <s>&lt;/p&gt;</s>
                                            </concat>
                                       </Property>
                                       <Property name='valign' value='top' />
                                       <Property name='align' value='left' />
                                       <Property name='noNewRow'>
                                            <Boolean>false</Boolean>
                                       </Property>
                                  </Display>
                             </Field>
                        </Field>
                   </Field>
              </Form>
         </Extension>
         <MemberObjectGroups>
              <ObjectRef type='ObjectGroup' id='#ID#Top' name='Top' />
         </MemberObjectGroups>
    </Configuration>

    ----

    Here's the trace i get in that block that's trying to get the parameter:

    <block name='-----workItemId-----' trace='true'>
    <ref>display.state</ref>Resolved display.state to null --> null
    <invoke name='getParameter'>
    <ref>:display.state</ref>Resolved display.state to null --> null
    <s>item1</s> --> item1
    </invoke> --> null
    <ref>item1</ref>Resolved item1 to null --> null
    <ref>op_item1</ref>Resolved op_item1 to null --> null
    <invoke name='getAttribute'>
    <invoke name='getSession'>
    <invoke name='getRequest'>
    <ref>:display.state</ref>Resolved display.state to null --> null
    </invoke> --> null
    </invoke> --> null
    <s>item1</s> --> item1
    </invoke> --> null
    </block> --> null

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points