aspose file tools*
The moose likes Struts and the fly likes How to tell where I came from? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to tell where I came from?" Watch "How to tell where I came from?" New topic
Author

How to tell where I came from?

Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
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

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Apr 16, 2008
Posts: 2187
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to tell where I came from?