Jsp 如何在WebLogicPortlet中更改ContentURI?

Jsp 如何在WebLogicPortlet中更改ContentURI?,jsp,struts,weblogic,portlet,Jsp,Struts,Weblogic,Portlet,我正在开发一个使用Weblogic Portlet和Struts的应用程序。我所需要做的就是根据客户端使用的web浏览器在同一个portlet中加载不同的jsp 例如:如果我有一个名为home.portlet的portlet。如果用户正在使用IE,它应该在home.portlet中显示IE.jsp;如果用户正在使用firefox,我应该在home.portlet中显示firefox.jsp 这是我在home.portlet中的内容: <netuix:content>

我正在开发一个使用Weblogic Portlet和Struts的应用程序。我所需要做的就是根据客户端使用的web浏览器在同一个portlet中加载不同的jsp

例如:如果我有一个名为home.portlet的portlet。如果用户正在使用IE,它应该在home.portlet中显示IE.jsp;如果用户正在使用firefox,我应该在home.portlet中显示firefox.jsp

这是我在home.portlet中的内容:

<netuix:content>
        <netuix:jspContent contentUri="IE.jsp"/>
    </netuix:content>


 //in struts config file
 <forward name="firefox" path="/firefox.jsp>
因此,即使用户正在使用firefox,它也会显示IE.jsp。 如何从Struts操作类更改portlet中的jsp内容,以便检查用户使用的浏览器类型并相应地显示页面

感谢所有的帮助和建议

谢谢


-Sai

您必须检查homeAction.java中的浏览器,并根据该浏览器进行转发

尝试此操作以检查操作中的浏览器版本

public void checkBrowserType (HttpServletRequest req)
{
   String s = req.getHeader("user-agent");
   if (s == null)
      return;
   if (s.indexOf("MSIE") > -1)
      System.out.println("using Internet Explorer");
   else if (s.indexOf("Netscape") > -1)
      System.out.println("using Netscape");
   // etc ...   
}

我的portlet没有为struts配置。我现在改了,效果很好

例如:



然后在action类中,我检查浏览器并显示相应的jsp

,感谢您的回复。我对portlet有问题。我已经有了检查useragent的代码。我想出来了。我有点笨。我的portlet没有为struts配置。我现在改了,效果很好。Thanks@Sai-如果您的问题得到了回答,请务必接受答案以关闭被认为有害的问题浏览器。如果有人使用Chrome、Safari、Opera……会发生什么?@ninjalj:我提到了一个例子。这不是全部代码
public void checkBrowserType (HttpServletRequest req)
{
   String s = req.getHeader("user-agent");
   if (s == null)
      return;
   if (s.indexOf("MSIE") > -1)
      System.out.println("using Internet Explorer");
   else if (s.indexOf("Netscape") > -1)
      System.out.println("using Netscape");
   // etc ...   
}
<netuix:strutsContent action="getStudentList" module = "people/students"
  refreshAction = "getStudentList" reqestAttrpersistence="none"/>