File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

actionforward

 
spear spear
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic