小编Den*_*ger的帖子

Java Web Project无法正确构建

我有一个Java Web项目,我正在部署到嵌入Eclipse的Servers Plugin中的Tomcat,唉,当我在发布/启动服务器后导航到该webapp的位置时,.class文件都丢失了.我可以导航到ProjectName\WEB-INF\classes\path\to\packages\ - >所有包都是空的.

任何想法如何解决这个问题?

编辑

自动构建被检查,它编译就好了我刚刚包含的另一个Web项目,而不是指定的那个

编辑2

重新安装Eclipse(因为为什么不) - 没有任何改变,适用于Project#2,不适用于Project#1.现在甚至没有包裹的路径.src文件夹的内容(应该移动到WEB-INF/classes)根本不存在 - 但是资源(我有一个具有相同部署程序集命令的资源文件夹)是.

java eclipse deployment tomcat buildpath

13
推荐指数
1
解决办法
2万
查看次数

System.Web.HttpException文件不存在 - 页面加载很好(ASP.NET)

每次我的ASP.NET-Application抛出错误时,我都在使用Log4Net并进行日志记录:

    protected void Application_Error(object sender, EventArgs e)
    {
        Exception ex = Server.GetLastError();
        Log.Error("An error occurred", ex);
    }
Run Code Online (Sandbox Code Playgroud)

唉,每当我访问我的应用程序页面时,System.Web.HttpException都会发现"文件不存在".

这是堆栈跟踪:

bei System.Web.StaticFileHandler.GetFileInfo(String virtualPathWithPathInfo, String physicalPath, HttpResponse response)
bei System.Web.StaticFileHandler.ProcessRequestInternal(HttpContext context, String overrideVirtualPath)
bei System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state)
bei System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
bei System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Run Code Online (Sandbox Code Playgroud)

我没有任何线索如何调试,这发生在我的ASP.NET开发服务器和IIS 7.5上我部署它.

c# asp.net log4net exception application-error

12
推荐指数
1
解决办法
1万
查看次数

使用jQuery-Resizable调整2个div的宽度

我目前在以下页面上工作:

页面的架构

使用以下代码在jQuery中修改了divResizable $().ready()

 $("#divResizable").resizable({ handles: 'e' });
 $("#divResizable").bind("resize", function (event, ui) {
      $('#divContent').width(850 -(ui.size.width - 175));
 });
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,当divResizable变小时,我尝试增加divContent的宽度,反之亦然.但是,使用此代码,divContent并不总是"增长"到左侧,它有时会延伸到不相关的div的右侧,这不会使调整大小看起来很好.

是否有更复杂的方法输入让这两个div的宽度对应?

我能想到的是将divContent的宽度设置为

(start of irrelevant - divResizable.width) == 850px
  ^ e.g 1025px          ^ e.g. 175px
Run Code Online (Sandbox Code Playgroud)

我究竟会用jQuery做到这一点?

javascript css jquery resizable jquery-ui-resizable

10
推荐指数
1
解决办法
2万
查看次数

UserControl中的Web控件是否为空?

我已经构建了一个小型用户控件,它本质上是一个DropDownList,带有一些基于Target-Property设置的预设值.

这是代码:

public partial class Selector : System.Web.UI.UserControl
{
    public string SelectedValue { get {return this.ddl.SelectedValue; } }
    public int SelectedIndex { get { return this.ddl.SelectedIndex; } }
    public ListItem SelectedItem { get { return this.ddl.SelectedItem; } }
    private string target;
    public string Target { get { return this.target; } set { this.target = value; } }
    protected void Page_Load(object sender, EventArgs e)
    {
        ddl.DataSource = target=="Group"?Util.GetAllGroups(Session["sessionId"].ToString()):Util.GetAllUsers(Session["sessionId"].ToString());
        ddl.DataBind();
    }
}
Run Code Online (Sandbox Code Playgroud)

ASP-标记:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Selector.ascx.cs" Inherits="InspireClient.CustomControls.Selector" %>
<asp:DropDownList runat="server" …
Run Code Online (Sandbox Code Playgroud)

c# asp.net user-controls dynamic pageload

9
推荐指数
1
解决办法
5034
查看次数

Internet Explorer忽略URL中的Hashtag

我已经设置了以下网址重写规则:

<rules>
            <rule name="Clean URL" stopProcessing="true">
                <match url="^([A-Za-z0-9]+)([\?A-Za-z0-9#=&amp;]+)?$" />
                <action type="Rewrite" url="{R:1}.aspx{R:2}" />
            </rule>
            <rule name="CleanTest" stopProcessing="true">
                <match url="^([a-z0-9/]+).aspx([a-zA-Z0-9\?#=&amp;]+)?$" />
                <action type="Redirect" url="{R:1}{R:2}" />
            </rule>
        </rules>
Run Code Online (Sandbox Code Playgroud)

这样做是在客户端的地址栏中显示一个干净的(非.aspx)URL,并将每个干净的URL调用重定向到相应的.aspx-Page.这"通常"工作正常.但是,当我的URL包含一个hashtag,即Administration.aspx#first仅在IE中重定向后缺少hashtag时,它在FF/Chrome中运行得非常好,这可能导致什么?

单击Chrome/FF中的链接后的结果:

Administration#first

IE(9)中的结果:

Administration

附录:它对GET参数完全正常.

链接: Login.aspx?logout=1

IE: Login?logout=1

FF /铬: Login?logout=1

asp.net internet-explorer url-rewriting iis-7.5 hashtag

9
推荐指数
1
解决办法
915
查看次数

ListItemCollection的ForEach扩展方法

我实现了一个ExtensionMethod,它基本上用作ForEach-Loop,我的实现看起来像这样:

public static void ForEach(this ListItemCollection collection, Action<ListItem> act )
{
    foreach (ListItem item in collection)
        act(item);
}
Run Code Online (Sandbox Code Playgroud)

但是,我想在第一次满足特定条件后停止循环的方法.

这是我目前使用它的方式:

ddlProcesses.Items.ForEach(item => item.Selected = item.Value == Request["Process"]?true:false);
Run Code Online (Sandbox Code Playgroud)

问题是DropDownList中只能有一个项目符合这个要求,但是循环正在完成,解决这个问题最难的方法是什么?

谢谢.

.net c# linq extension-methods listitem

6
推荐指数
1
解决办法
6231
查看次数

如何在不破坏其目的的情况下为ParallelQuery编写Map-Method?

我想在不破坏并行性的情况下为ParallelQuery编写Map-Extension方法.问题是,我不知道如何.我正在使用ParallelQuery,因为我相信多线程将提升我的性能,这是我的代码到目前为止:

public static List<T2> Map<T, T2>(this ParallelQuery<T> source, Func<T, T2> func)
{
    List<T2> result = new List<T2>();
    foreach(T item in source)
    {
        result.Add(func(item));
    }
    return result;
}
Run Code Online (Sandbox Code Playgroud)

正如你所看到的,如果我是正确的,这种方式会破坏并行性的目的.我该如何正确地做到这一点?

感谢Dykam指出-Method Select正是我想要的行为.但是,仅仅为了学习目的,我想看看它是如何工作的,谢谢!

c# linq parallel-processing extension-methods multithreading

5
推荐指数
1
解决办法
234
查看次数

为多个XmlReader.Read()用法重置StreamReader

我想重新使用我与.dad()的XML文件关联的StreamReader - 来自System.Xml.XmlReader的调用.

基本上我已经整理了一个小扩展方法,其中包含以下代码:

 public static string GetValueByPath(this StreamReader str, string attributeName, params string[] nodes)
    {
        str.BaseStream.Position = 0;
        XmlReader reader = XmlReader.Create(str);
        // Stuff happens here now, not important for the question
    }
Run Code Online (Sandbox Code Playgroud)

调用此扩展方法的StreamReader在整个Session中保持不变.

第一次这很好用,但如果我第二次使用这个方法,我会收到一个System.Xml-Exception.有没有办法有效地"重置"StreamReader?

谢谢,

丹尼斯

c# xmlreader streamreader

4
推荐指数
1
解决办法
4766
查看次数

使用匿名类型调用通用方法(C#)

让我们说我想迭代a string[][],使用匿名类型追加一个值并对结果执行一个通用的ForEach-Extension方法(很明显的例子,我知道,但我想你会得到它的第一个!).

这是我的代码:

//attrs = some string[][]
attrs.Select(item => new { name = HttpContext.GetGlobalResourceObject("Global", item[0].Remove(0, 7)), value = item[1] })
            .ForEach</*????*/>(/*do stuff*/);
Run Code Online (Sandbox Code Playgroud)

究竟我会在ForEach的Type-Parameter中加入什么?

这是ForEach的样子:

public static void ForEach<T>(this IEnumerable<T> collection, Action<T> act)
{
    IEnumerator<T> enumerator = collection.GetEnumerator();
    while (enumerator.MoveNext())
        act(enumerator.Current);
}
Run Code Online (Sandbox Code Playgroud)

c# linq generics extension-methods

4
推荐指数
1
解决办法
903
查看次数

在 ABAP 中等待&lt;毫秒&gt;

根据 ABAP 文档,该命令WAIT UP TO x SECONDS需要类型 i 的操作数。但是,我想等待 x 毫秒或类似的时间。到目前为止,官方文档和其他几个论坛帖子都没有帮助。

有什么方法可以指定等待几分之一秒吗?

abap

4
推荐指数
1
解决办法
9812
查看次数