论坛首页 Java企业应用论坛

在实际项目中应用WebWork有什么问题吗?

浏览 10324 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2005-04-13  
Readonly 写道
胡扯, 去看代码去, 只要是神智清醒的都知道为xml解析代码设置EntityResolver, 让它优先读取local dtd, 更别说webwork这种高质量的open source lib了:
com.opensymphony.xwork.config.providers.XmlConfigurationProvider


杀猪的
兄弟,你这个title是怎么加上去的啊?教教俺,俺很土,不会弄。
0 请登录后投票
   发表时间:2005-04-13  
现在想起来dtd应该没有问题,否则Spring、Hibernate不是一样有这个问题了?

其实用Webwork我最担心的是性能/稳定性的问题,性能上的担心是因为没用过,再怎么做压力测试也顶不上实际使用;再有就是稳定性,因为项目组的人现在只熟悉STRUTS,我不希望在使用中产生很多问题,而到处去找资料,或者花了几天的时间,证明了是Framework的问题,必须另想法绕过去,等等诸如此类的事情。

这几天我先做个压力测试看看Webwork和STRUTS的差别如何,反正都在我的机器上,其他环境都一样。
0 请登录后投票
   发表时间:2005-04-14  
还有validator的xml文件中中文信息。。。我统统用utf-8编码(xml文件,还有ww2和velocity的设置,以及webapp的默认编码设置)。。jetty下正常,但是orion下显示成?号,估计是sun的解析器有点问题,或者我不会设置.

dtd文件我是这么测试的:机器挂在网上,我的webapp正常;把网络断掉,重启jetty运行,到验证input时候,出现找不到dtd的异常,只好修改url或者用系统dtd.

郁闷,如何设置EntityResolver?给个url吧.
0 请登录后投票
   发表时间:2005-04-14  
敬爱的zzsczz兄弟, 偶错了, 偶才发现你说的是validators.xml文件 

http://jira.opensymphony.com/browse/XW-253

如何解决: 别对这个简单的xml文件用dtd

其他的xml文件的dtd都是先校验local dtd的.
0 请登录后投票
   发表时间:2005-04-15  
咣当,
取决于 DOCTYPE里面命名时的那个串。如果是schema的话,是一定到location定义的地方找的。

很久以前一位boss告诉我http://xxx.xxx.com/xxx.dtd不会到网上去取,事实并不是这样,如果你没有本地拷贝,一般会出错,而且好像还是网上的版本优先。
0 请登录后投票
   发表时间:2005-04-15  
看一下com.opensymphony.xwork.validator.ValidatorFileParser的代码就知道了
builder.setEntityResolver(new EntityResolver(); {
       public InputSource resolveEntity(String publicId, String systemId); throws SAXException, IOException {
            if ("-//OpenSymphony Group//XWork Validator 1.0//EN".equals(publicId);); {
                ClassLoader loader = Thread.currentThread();.getContextClassLoader();;

                return new InputSource(loader.getResourceAsStream("xwork-validator-1.0.dtd"););;
            }

            return null;
      }
});;

是在本地找xwork-validator-1.0.dtd这个文件的。
0 请登录后投票
   发表时间:2005-04-15  
今天仔细看了一些论坛上的发言,特别是在讨论Webwork和Spring结合的几种方式时,发现了一个问题,就是Action和Service是否要分开来,在用STRUTS时,因为Action的限制,必须把业务逻辑给独立出来,好处就不多说了,易于测试等等。

可是现在在Webwork下,发现大家还是建议把Action和Service分开来,我总觉得这不是很简洁的解决方式,也许是Action和Web的关联还是太大?Model Drive的方式还是不足以支持前端的显示要求?
0 请登录后投票
   发表时间:2005-04-16  
我觉得还不不用分离的好

在ww2中的action本身已经没有受到什么太多的接口的污染,很容易测试,本身就可以作为service了.过于倾向于完美的设计反而容易造成"过度设计"吧?
0 请登录后投票
   发表时间:2005-04-18  
看看APPFUSE的以下代码,在业务逻辑简单的情况下Service基本上与DAO重合了

public class RoleManagerImpl extends BaseManager implements RoleManager {
    private RoleDAO dao;

    public void setRoleDAO(RoleDAO dao); {
        this.dao = dao;
    }

    public List getRoles(Role role); {
        return dao.getRoles(role);;
    }

    public Role getRole(String rolename); {
        return dao.getRole(rolename);;
    }

    public void saveRole(Role role); {
        dao.saveRole(role);;
    }

    public void removeRole(String rolename); {
        dao.removeRole(rolename);;
    }
}


另外,再看看BaseAction 的用法,还是和HttpServletRequest 关系密切,这还是一样不好测试,看来大家都很推崇的APPFUSE,在模式上也没有多好的解决方法。

public class BaseAction extends ActionSupport {
......

    public void saveMessage(String msg); {
        List messages = (List); getRequest();.getSession();.getAttribute("messages");;
        if (messages == null); {
            messages = new ArrayList();;
        }
        messages.add(msg);;
        getRequest();.getSession();.setAttribute("messages", messages);;
    }
    
    /**
     * Convenience method to get the user object from the session
     *
     * @param request the current request
     * @return the user's populated object from the session
     */
    protected User getUser(HttpServletRequest request); {
        return (User); request.getSession();.getAttribute(Constants.USER_KEY);;
    }
    
    /**
     * Convenience method to get the Configuration HashMap
     * from the servlet context.
     *
     * @return the user's populated form from the session
     */
    public Map getConfiguration(); {
        Map config = (HashMap); getRequest();.getSession();.getServletContext();
                               .getAttribute(Constants.CONFIG);;
        // so unit tests don't puke when nothing's been set
        if (config == null); {
            return new HashMap();;
        }
        return config;
    }
    
    /**
     * Convenience method to get the request
     * @return current request
     */
    public [color=red]HttpServletRequest [/color]getRequest(); {
        return ServletActionContext.getRequest();;  
    }
    
0 请登录后投票
   发表时间:2005-04-19  
看了2天Webwork的资料,说实话对它有点失去信心。

因为我们项目组的人只对STRUTS比较熟悉,全部改过来,
好像难度不小,Webwork又没有提供太多的改进,说起来
还是和Struts类似,可能还不如我直接修改Struts,让它尽量
向Webwork的优点靠拢,这样好像风险还小些。
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics