Solved

Struts forwarding problem.

Posted on 2006-10-27
3
293 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 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
java.util.concurrent.locks in java 3 191
spring example errors 33 330
Market Place not working in Eclipse Luna 2 112
equalIsNot  challenge 43 142
When you’re making plans to join the modern business race, you should analyze various details that may affect your results. Nowadays, millions of businesses are trying to grow into established and appreciated professional enterprises.
For months I had no idea how to 'discover' the IP address of the other end of a link (without asking someone who knows), and it drove me batty. Think about it. You can't use Cisco Discovery Protocol (CDP) because it's not implemented on the ASAs.…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

770 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