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
Solved

Struts forwarding problem.

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
reflections, dynamic class loading 3 75
parse example 13 95
dateFashion java challenge 9 146
JSONSerializer.toJSON in JSP generating error 8 81
This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
This article explains the steps required to use the default Photos screensaver to display branding/corporate images
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

837 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