[Eclipse]同步CVS时总是提示错误

我在一台机器上使用CVSNT建立了CVS库,并把项目提交到库中没有问题。 回到家修改了一些代码和配置文件,再同步项目的时候,处理到struts-config.xml时提示:

Error fetching file revisions

不明白为什么,然后上google查了一下,找到两个相关问题的地址。 一个是eclipse cvs的faq,上面关于这个问题的解释如下:

This error, or an error stating that "An error has occurred processing file", occur when the CVSNT server has been configured to use a repository prefix (also referred to as a repository alias). CVSNT provides this mechanism to allow compatibility with the Unix/Linux based command line tools. However, the CVSNT server does not properly map the repository paths that are communicated in text messages. The Eclipse CVS client relies on these text messages to provide advanced features such as synchronization and compare. In order for these features to work properly, the CVSNT server must not be configured to use a repository prefix. Instead, the full path name (i.e. D:cvsroot) must be used (see related question above). 

但我并未使用prefix这个功能。另一个网站上有人说:

I've had two things that relate to this problem. 1) Window->Preferences->Team->Ignored resources includes a pattern to ignore files called 'tags' 2) the CVS/Root file used a different case to the repository listed in CVS NT. dion ? 3/24/04; 10:50:48 PM

似乎也不是这两条的原因,因为我的eclipse里关于cvs的设置从未修改过;大小写我也改过,不过还要找时间去实验室看看建库的那台机器里到底是什么样的写法(我判断不是这个原因)。 实在没办法,只能找机会在建库的机器上把这两条删掉重新添加了,甚至把库里整个项目删掉重来了。

搬家前链接:https://www.cnblogs.com/bjzhanghao/archive/2004/07/28/28067.html

[Struts]学习日记2 – 增加一些验证

使用struts的一个好处就是,很多传统jsp/servlet开发中十分琐碎的事情都有规范化的方法来处理了。例如表单验证、错误提示、HTML字符过滤等等。今天简单说一说在form类里进行验证。

在上一篇文章里的LogonForm.java里加入下面这个validate方法:

import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;

public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    ActionErrors errs=new ActionErrors();
    if(userId.trim().equals(""))
        errs.add("userId",new ActionError("error.userId.empty"));
    return errs;
}

该方法验证用户是否输入了用户Id,若用户没有输入则返回登录页面并在用户Id文本框后面提示。

其中,errs.add方法的第一个参数对应/form/logon.jsp中<html:errors property="userId"/>中的property值,这个logon.jsp是向导在创建form bean时自动生成的。第二个参数会从ApplicationResources.properties文件中寻找key为error.userId.empty的值作为错误提示信息,所以在这个.properties文件中应该有这么一行:

error.userId.empty=UserId can not be empty.

搬家前链接:https://www.cnblogs.com/bjzhanghao/archive/2004/07/28/28075.html

日志搬家了!

水木blog的skin太少,编辑功能也有问题,干脆趁贴子还少的时候换个地方。

今天下午把帖子导到这里(博客园)又花了一翻工夫,格式上好象不太兼容,代码有些乱,暂时先不管了。一开始都导到文章区去了,不得已又一篇一篇的删,为什么不提供多个条目同时删除/移动的功能呢??

总之,希望在这里能一直呆下去。(什么,dotNet专用?。。我倒@#$%^)

[Struts]学习日记1 – 一个简单的例子

这个例子是提供一个登录界面,用户输入用户Id和密码,如果一致则判断为登录成功。使用easy struts这个eclipse的插件要做这件事很容易,步骤如下:

1、创建一个新工程,并为在工程属性里为该工程添加easy struts支持。

2、在eclipse菜单File->New->Other里选择Easy Action assosiated with a form。这就打开一个向导,共有三步,下面分别说明。

3、第一步是创建form。Module留空(使用缺省),我们的use case填logon,easy struts会自动根据这个名称更改form name和form type这两个域,最好根据需要更改一下后者的包名称。点form properties右边的add按钮,增加userId和password两个属性,type都是java.lang.String,jsp input type分别是text和password类型。点next进入下一步。

4、第二步是创建action。全部使用缺省值即可。点next进入下一步。

5、第三步是创建forwards和exceptions。我们为刚刚创建的action添加一个名为success的forward,path为/form/main.htm,该页面就是登录成功后看见的页面了。当然,你还要实际创建这个页面,否则登录成功后会出现404错误。按finish按钮完成向导。

6、在向导帮你生成的LogonAction.java文件的execute方法里写下验证登录并跳转的代码如下:

public ActionForward execute(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response) throws Exception {

    LogonForm logonForm = (LogonForm)form;
    ActionErrors errors = new ActionErrors();

    if(!logonForm.getUserId().equals(logonForm.getPassword()))
    errors.add(ActionErrors.GLOBAL_ERROR,new ActionError("error.password.mismatch"));

    if(!errors.isEmpty()){
        saveErrors(request,errors);
        return mapping.getInputForward();
    }

    return (mapping.findForward("success"));
}

7、把这个项目加成一个Tomcat的context,具体方法就是在Tomcat的server.xml中加上下面这句:

<Context path="/struts-test" reloadable="true" docBase="C:\eclipse\workspace\struts-test" />

8、启动Tomcat,使用 http://localhost:8080/struts-test/form/logon.jsp 访问,应该可以看到登录画面。

注意:我发现Easy Struts虽然会帮你把需要的jar拷到WEB-INF/lib里,但这只是一部分,还得手动把其他Struts的lib/*.jar文件拷过来,否则会提示"Cannot find ActionMappings or ActionFormBeans collection"

搬家前链接:https://www.cnblogs.com/bjzhanghao/archive/2004/07/28/28062.html