我一直在谷歌上搜索从URL读取参数值的方法,但没有成功.在ASP.NET Webform中,我们曾经使用Request.Querystring ["name"]来获取值.如何在MVC3中执行此操作?
我需要在HtmlHelper类中访问参数.有人请.
互联网上没有明确的答案.奇怪...
我有下面的代码一个可以绑定到我的用户存储库,另一个可以绑定到缓存.我应该为UserRepository和Cache使用什么范围.UserRepository上的Scope应该是Singleton吗?
this.Bind<IUserRepository>().To<UserRepositary>().InRequestScope();
this.Bind<IDistributedCacheService>().To<DistributedCacheService>().InSingletonScope();
Run Code Online (Sandbox Code Playgroud) 我是Maven的新手.搜索了很多但没有成功.尽我所能.有人向我解释如何解决这个问题.任何你当前使用struts2和tomcat 7的pom都会非常有用.
我正在使用maven3
错误
插件'org.apache.tomcat.maven:tomcat7-maven-plugin:2.0-SNAPSHOT'未找到
我看到这个插件可以在http://people.apache.org/repo/m2-snapshot-repository/org/apache/tomcat/上找到.从这里获得链接http://tomcat.apache.org/tomcat-7.0-doc/maven-jars.html#Using_Tomcat_libraries_With_Maven
我的pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>Struts2_Maven_Web</groupId>
<artifactId>Struts2_Maven_Web</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<name>Struts2_Maven_Web Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.3.4.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>apache.snapshots</id>
<url>http://repository.apache.org/content/groups/snapshots-group/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>apache.snapshots</id>
<name>Apache Snapshots</name>
<url>http://repository.apache.org/content/groups/snapshots-group/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<build>
<finalName>Struts2_Maven_Web</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0-SNAPSHOT</version>
<configuration>
<path>/</path>
</configuration>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
已编辑**** …
jqGrid 3.8.1工作正常,我更新了jqGrid 3.8.2.代码开始生成错误.错误是:未捕获的异常:jqGrid - 没有这样的方法:navGrid.以下是我的代码.
注意:如果我删除下面的行比Grid工作正常.这是为什么?
jQuery("#lists55").jqGrid('navGrid', '#pagers55', { edit: false, add: false, del: false });
Run Code Online (Sandbox Code Playgroud)
在ASP.NET MVC 3 Razor中使用它.
<link href="@Url.Content("~/Content/themes/images/jquery-ui-1.8.7.custom.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/themes/ui.jqgrid.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/js/jquery-ui-1.8.7.custom.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/js/grid.locale-en.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/js/jquery.jqGrid.min.js")" type="text/javascript"></script>
jQuery().ready(function () {
jQuery("#lists55").jqGrid({
data: mydata1,
datatype: "local",
colNames: ['Inv No', 'Date', 'Client', 'Amount', 'Tax', 'Total', 'Notes'],
colModel: [{ name: 'id', index: 'id', width: 55 },
{ name: 'invdate', index: 'invdate', width: 90 },
{ name: 'name', …Run Code Online (Sandbox Code Playgroud) 我的表单上有if-else条件,我在其中显示标题和按钮文本以进行添加和更新.
下面我在struts2项目中使用的代码和相同的代码想在xhtml页面的JSF2项目中使用.
Struts2
<s:if test="person==null || person.id==null || person.id==''">
<s:set var="buttonText" value="getText('person.button.add')"/>
<s:text name="person.h1.add.text"/>
<i><s:text name="person.smallfont.add.text"/></i>
</s:if>
<s:else>
<s:set var="buttonText" value="getText('person.button.edit')"/>
<s:text name="person.h1.edit.text"/>
<s:text name="person.smallfont.edit.text"/>
</s:else>
Run Code Online (Sandbox Code Playgroud)
我可以在xhtml页面中使用JSTL并使用上面的代码,但我在下面使用EL看到了不同的方法.我不确定,但不喜欢下面的方法
<h:outputLabel value="Add Information" rendered="#{!empty personBean.person.id}" />
<h:outputLabel value="Use the form below to add your information." rendered="#{!empty personBean.person.id}" />
<h:outputLabel value="Update Information" rendered="#{empty personBean.person.id}" />
<h:outputLabel value="Use the form below to edit your information." rendered="#{empty personBean.person.id}" />
Run Code Online (Sandbox Code Playgroud)
我的问题:
有人指导我如何在JSF项目的IF-ELSE条件中使用上面的代码.使用EL/JSTL还是其他?
这个相同的代码适用于MVC 2但不适用于MVC 3 Razor.加载页面后,如下面的Razor中调用的HTMLHelper加载菜单.
用于测试的硬编码菜单,不在页面上输出.
using System.Collections.Generic;
using System.Web.Mvc;
using System.Web.Mvc.Html;
using myproject.Extensions;
public static class MenuHelper
{
public static string TabbedMenu(this HtmlHelper helper, IEnumerable<MenuTab> tabs)
{
//I have hard coded menu for testing purpose.
return "<div class='menu-image'><img src='/content/Images/common/on-left.gif' alt='' /></div><div class='on'><a class='over' href='/?Length=4'>Home</a></div><div class='menu-image'><img src='/content/Images/common/on-right.gif' alt='' /></div><a href='/Home/About'>About</a><a href='/Home/Contact'>Contact</a>";
}
}
Run Code Online (Sandbox Code Playgroud)
下面是Razor CSHTML代码.
@{Html.TabbedMenu
(
new List<MenuTab>
{
MenuTab.Create("Home", "Index", "Home"),
MenuTab.Create("About", "About", "Home"),
MenuTab.Create("Contact", "Contact", "Home")
}
);}
Run Code Online (Sandbox Code Playgroud) 我对我的项目的文件夹结构以及将它们分组在控制器中有点困惑。项目是电子商务。我有类似的页面
主页、关于、联系方式、类别菜单和子类别列表页面、产品列表、产品详细信息、购物车、购物车摘要、结账
用户管理 编辑个人资料、订单、登录信息管理。
管理员 产品管理(插入、更新、删除、上传图像、添加描述等)、类别管理、订单管理等。
我应该创建区域吗?如何制作干净的文件夹结构。
我查过很多书,但找不到好书.我对书中感兴趣,我可以通过简单的方式学习OOP概念.像Java Black book这样的书
对不起,如果问题是愚蠢的.
在某处,我读到了
ASP.NET支持三种类型的缓存:
页面输出缓存[输出缓存]
片段缓存[输出缓存]
数据缓存
在某个地方
ASP.NET中有两种不同类型的缓存:
* Application caching
* Page output caching
Run Code Online (Sandbox Code Playgroud)
ASP.NET支持多少种类型的缓存?
我想在表中跳过2 tr,有2个不同的类.
第一个类是.gridTitleRow,第二个tr是类.gridSpan.如何在下面的语法中跳过这些?
$.each($(".gridTable tr:not(.gridTitleRow)"), function(a, b){});
Run Code Online (Sandbox Code Playgroud)
编辑我正在使用各自如下
$("#gridBtn").live("click", function (e) {
e.preventDefault();
var indexArraay = [];
var flag = false;
$.each($(".gridTable tr:not(.gridTitleRow)"), function(a, b){
var id = $("input.idField", b).val();
var order = $("input[id='index']", b).val();
var active = $("input[id='activeCb']", b).attr("checked");
var deleteRow = $("input[id='deleteCb']", b).attr("checked");
(deleteRow == true) ? flag = true : null;
indexArraay.push({
"id": id,
"index": order,
"active": active,
"delete": deleteRow
})
});
if (flag == true)
{
$("#dialog:ui-dialog").dialog("destroy");
var text = "Alert: Deleting footer Prent menu …Run Code Online (Sandbox Code Playgroud)