This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes Struts and the fly likes actionforward Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "actionforward " Watch "actionforward " New topic
Author

actionforward

spear spear
Greenhorn

Joined: Mar 24, 2006
Posts: 5
Firstly, i am using struts and struts-wml. The problem i'm facing with actionforward. I have 2 front ends one with WML and JSP. I have to create identical ActionMappings (and the actual action class) for both which i think is unncessary. The actual class contents are the same just the mappings that are defined in struts-config they point to either the jsp or wml version. Is there anyway i can remove the redundancy of having 2 identical action classes?
Janhvi Malhotra
Greenhorn

Joined: Jan 12, 2006
Posts: 6
you could use condition to test whether u need to forward to WML or JSP and call the corresponding actionForward..

if(WML)
mapping.findForward("WMLpage");
else
mapping.findForward("jsppage");
spear spear
Greenhorn

Joined: Mar 24, 2006
Posts: 5
yeah i initially thought of that but i couldn't find a way to know if it was a wap request. I tried .getContentType() but that just returns some information about the form...
spear spear
Greenhorn

Joined: Mar 24, 2006
Posts: 5
since i have all the my wml content in one directory is it possible to test based on the directory the user entered from?
spear spear
Greenhorn

Joined: Mar 24, 2006
Posts: 5
maybe getContentType?? but that gives me:

System.out.print("Content:" + ((ServletRequest) response).getContentType());
java.lang.ClassCastException: weblogic.servlet.internal.ServletResponseImpl

tried:

System.out.print("Content:" + response.getContentType());

undefined for httpservletrequest
spear spear
Greenhorn

Joined: Mar 24, 2006
Posts: 5
Well i just figured i can share the same action class just the foward and edit pages are different. So the only thing that it duplicate is the actionforwards in struts-config
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"spear spear",
Welcome to the Ranch. We have two main rules 'round the parts. The first is 'Be Nice', the second is 'follow the display name rules'.

You can check out the display name rules here but I'll summarise for you:

We require display names to be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and fix your display name, since accounts with invalid display names get deleted.

thanks,
Dave.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: actionforward