[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Struts forwarding problem.

Posted on 2006-10-27
3
Medium Priority
?
300 Views
Last Modified: 2010-04-01

I want my success to include a property key-value pair.  So far it isn't working.

1.  Try #1:

    <action    path="/customersValidate"
               type="com.saferX.web.action.CustomersAction"
               name="customersForm"
              scope="session"
              input="success"
           validate="true">
      <forward name="successAdmin"              path="tiledef.listCust"/>
      <forward name="success"                              path="/customers.do?dispatch=save" >
    </action>

javax.servlet.UnavailableException: Parsing error processing resource path
/WEB-INF/struts-config.xml
      at org.apache.struts.action.ActionServlet.handleConfigException(ActionServlet.java:739)
      at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:715)
      at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:670)
      at org.apache.struts.action.ActionServlet.init(ActionServlet.java:329)
      at javax.servlet.GenericServlet.init(GenericServlet.java:69)


2.  Try #2:    The struts DTD says that 'set-property' can be a child of 'forward'

   <action    path="/customersValidate"
               type="com.saferX.web.action.CustomersAction"
               name="customersForm"
              scope="session"
              input="success"
           validate="true">
      <forward name="successAdmin"              path="tiledef.listCust"/>
      <forward name="success"                              path="/customers.do" >
        <set-property name="dispatch" value="save"/>
      </forward>
    </action>

throws exception:
  javax.servlet.UnavailableException: Parsing error processing resource path
        /WEB-INF/struts-config.xml
      at org.apache.struts.action.ActionServlet.handleConfigException(ActionServlet.java:739)
      at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:715)
      at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:670)
      at org.apache.struts.action.ActionServlet.init(ActionServlet.java:329)
      at javax.servlet.GenericServlet.init(GenericServlet.java:69)


Try #3:  Displays a clean screen but doesn't have the key-value pair.

    <action    path="/customersValidate"
               type="com.saferX.web.action.CustomersAction"
               name="customersForm"
              scope="session"
              input="success"
           validate="true">
      <forward name="successAdmin"              path="tiledef.listCust"/>
      <forward name="success"                              path="customers.do" />
    </action>


How do I pass the key value pair to my action:forward method?
0
Comment
Question by:tmonteit
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
jaggernat earned 2000 total points
ID: 17822806
Its displaying a clean screen because

<forward name="success"                         path="customers.do" />

is not getting forwarded correctly . where is  customers.do  going?  Which method are you calling when customers.do is invoked? Is your Action class extending DispatchAction ?

>>>>How do I pass the key value pair to my action:forward method?

not sure what you mean. if you want to pass two parametres called KEY and VALUE , you can do this:

  <forward name="success"     path="/customers.do?key=KEY&amp;value=VALUE" >

 **       &amp; is equavalant of  "&"
0
 

Author Comment

by:tmonteit
ID: 17822841
Here is customers.do

    <action    path="/customers"
               type="com.saferX.web.action.CustomersAction"
               name="customersForm"
              scope="session"
           validate="false">
      <forward name="success"                  path="tiledef.customerInfo" />
      <forward name="validate"                  path="/customersValidate.do"/>
    </action>

I can do this and get the Action to behave propertly.   The significant thing here is the "dispatch=save".  Problem is how do I make the struts action to the same?

<a href="customers.do?dispatch=save">Save Link </a>
0
 
LVL 10

Expert Comment

by:jaggernat
ID: 17822934
>>>>    <a href="customers.do?dispatch=save">Save Link </a>

does the above link work? what error are you getting ?
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Applications for our next round of the Experts Exchange Scholarship Contest are starting to roll in. It made us wonder what our past winners are up to these days. Here's a look at what four winners experienced with the contest and what they're doing…
In the below post we have mentioned the best hosting type for startups. Also, check out some of the superlative web hosting companies that are proposing affordable web hosting solutions to host your startup website.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question