使用 Spring.net 进行 xVal 验证

发布于 2024-07-18 04:44:38 字数 981 浏览 2 评论 0原文

我开始使用 xVal 作为 ASP.Net MVC 应用程序的验证框架。 我使用 Spring.Net IoC 容器将应用程序保存在一起。

我已按照 Steve Sanderson 博客上的说明进行操作,以使服务器端验证正常工作。 但是,当我尝试让客户端工作时,出现以下运行时异常:

Spring.Objects.Factory.NoSuchObjectDefinitionException was unhandled by user code

Message="No object named 'Scripts' is generated : Cannot findDefinition for object [Scripts]"

我认为这是因为 Site.Masterpage 有以下内容其中的代码:

<script type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery-1.2.6.js")%>"></script>
<script type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery.validate.js")%>"></script>
<script type="text/javascript" src="<%= ResolveUrl("~/Scripts/xVal.jquery.validate.js")%>"></script>

正在尝试使用 Spring 解析 ~/Scripts/ 。

我如何让 Spring 来处理这个问题(即配置 XML 中的内容),或者我在 Site.Master 中更改什么,这样就不会发生这种情况?

I have started to play with xVal as my validation framework for an ASP.Net MVC application. I use the Spring.Net IoC container to hold the app together.

I have followed the instructions on Steve Sanderson's blog to get server side validation working fine. But when I try to get client side working, I get the following runtime exception:

Spring.Objects.Factory.NoSuchObjectDefinitionException was unhandled by user code

Message="No object named 'Scripts' is defined : Cannot find definition for object [Scripts]"

I presume this is because the Site.Masterpage has the following code in it:

<script type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery-1.2.6.js")%>"></script>
<script type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery.validate.js")%>"></script>
<script type="text/javascript" src="<%= ResolveUrl("~/Scripts/xVal.jquery.validate.js")%>"></script>

Which is trying to resolve ~/Scripts/ using Spring.

How do I get either Spring to cope with this (i.e. what goes into the config XML), or what do I change in Site.Master so this does not happen?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

贱贱哒 2024-07-25 04:44:38

哦,在史蒂夫的帮助下我找到了答案。 不要盲目地从网上复制和粘贴示例,我的脚本文件夹中有 jquery-1.3.2.js,而不是 1.2.6。 通过将 Site.Master 文件中的引用更改为正确的版本号,一切就开始工作了。

Opps, with Steve's help I found the answer. Don't blindly copy and paste samples from the web, I have jquery-1.3.2.js in my scripts folder, not 1.2.6. By changing the reference in the Site.Master file to be the correct version number, it all started working.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文