Solved

Struts forwarding problem.

Posted on 2006-10-27
3
297 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
jaggernat earned 500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Resolving an irritating Remote Desktop connection that stops your saved credentials from being used.
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

691 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