Harish
Harish

Reputation: 1647

Struts help needed

I am working on a Struts application.Now I have a strange situation.The current application has a config file something like this

<action path="/validate" type="test1Action" scope="request" validate="false"> 
           <forward name="cat1" path="path1/value1"/>
           <forward name="cat2" path="path1/value2"/>
           <forward name="cat3" path="path1/value3"/>
           <forward name="failure" path="path1"/>
           <forward name="failed" path="emptysession"/>
        </action>

Now the issue is if I add a new Action class test2Action and I have to change the type to test2Action and in test2Action I have only three return variables namely

cat1,failure,failed. Now cat1 should call test1Action. What I am trying to do is insert an action class inbetween a JSP and Action class.Anyone can help me out?

Upvotes: 0

Views: 107

Answers (2)

OMG Ponies
OMG Ponies

Reputation: 332571

I believe you need to updated the struts-config with:

<action path="/validate" type="test1Action" scope="request" validate="false"> 
  <forward name="cat1" path="validateTest2Action.do"/>
  <forward name="cat2" path="path1/value2"/>
  <forward name="cat3" path="path1/value3"/>
  <forward name="failure" path="path1"/>
  <forward name="failed" path="emptysession"/>
</action>

<action path="/validateTest2Action" type="test2Action" scope="request" validate="false"> 
  <forward name="cat1" path="path1/value1"/>
  <forward name="failure" path="path1"/>
  <forward name="failed" path="emptysession"/>
</action>

Upvotes: 1

Will Hartung
Will Hartung

Reputation: 118641

I'll get down voted for this, but, oh well.

IF you are just starting out, then I'd simply abandon Struts 1 completely. Head on over to either Struts 2 or Stripes. Struts 1 has no redeeming qualities whatsoever today, save legacy code.

If you're on a legacy code set, then there's not much you can do.

If you have the option bailing on it now, I'd run, quickly, right now, away from Struts 1 and pick something else. Life's too short.

Upvotes: 1

Related Questions