Ok, the verdict is out. It works. :) Basically the logic in the action controller decides which action to forward to depending on the user-agent value. After that, it all depends on the action forwarded to to render the correct version of the site. Code snippet:
String UserAgent = "";
java.util.Enumeration e = req.getHeaderNames();
while(e.hasMoreElements()) {
String name = (String) e.nextElement();
String value = req.getHeader(name);
if (name.equals("user-agent")) {
UserAgent = value;
}
}
if (UserAgent.equals("Mozilla/2.0 (compatible; MSIE 3.02; Windows CE; PPC; 240x320)"))
{
// if user agent is for Pocket PC, forward to success_pda
return mapping.findForward("success_pda");
}
// by default forward to success
return mapping.findForward("success");
Friday, September 26, 2003
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment