Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to tell where I came from?

 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • 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
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • 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.
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic