• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to tell where I came from?

 
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm using Struts 1. In my ActionForm class, I have getters and setters to store the fields submitted with the form, for example,

public String getAccountid() {
return accountNum;
}

public void setAccountid(String p_accountNum) {
this.accountNum = p_accountNum;
}

How can I tell, from within one of those methods, which URL/action a user visited? In my struts-config.xml file I have two actions that submit to the same bean

<action path="/pcFlow"
type="com.myco.regui.struts.accounts.AccountsAction"
scope="request"
name="REAccountLookUpBean"
validate="true"
input="/jsp/pcAccountLookup.jsp">
</action>

<action path="/hhFlow"
type="com.myco.regui.struts.accounts.AccountsAction"
scope="request"
name="REAccountLookUpBean"
validate="true"
input="/jsp/hhError.jsp">
</action>

I would like to figure out which action was invoked. Thanks for your help, - Dave
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They submit to the same action, not the same bean.

Personally I'd just add a hidden form field rather than make the ActionForm tied to what happens to be your current configuration.
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

How can I tell, from within one of those methods, which URL/action a user visited? In my struts-config.xml file I have two actions that submit to the same bean



From those methods, you cannot identify what URI was submitted.

Actually, the Action object does not sumbit anything to the same bean, or any bean for that matter. The ActionForm object is created before the call on the Action object.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic