Solved

Struts forwarding problem.

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
What is Backup? Backup software creates one or more copies of the data on your digital devices in case your original data is lost or damaged. Different backup solutions protect different kinds of data and different combinations of devices. For e…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now