小编shi*_*sei的帖子

HTMLUNIT getformbyname,网站中未指定表单名称

我正在尝试使用HTMLUNIT在网站上找到一个按钮我遵循本教程http://htmlunit.sourceforge.net/gettingStarted.html但它需要一个表单名称.我正在尝试做的网站有这个页面来源.

<form method="post" action="doDelete">
     Are you sure you want to delete 'Apple?'?
 <input name="Submit" value="Yes" class="submit-button" type="submit" />
 </form>
Run Code Online (Sandbox Code Playgroud)

我正在尝试单击网页上的"是"按钮验证框.(删除按钮)如您所见,没有提供表单名称.这是我的代码.

 final WebClient webClient = new WebClient();
        final HtmlPage page1 = webClient.getPage("http://ma.some-site.com:8080/user/mike/delete");



        List<HtmlForm> formlist = (List<HtmlForm>) page1.getForms();
       System.out.println(formlist.toString());

        final HtmlForm form = page1.getFormByName("myform"); <---Problem here
       final HtmlSubmitInput button = form.getInputByName("Submit");
       button.click();
        webClient.closeAllWindows();
Run Code Online (Sandbox Code Playgroud)

我尝试了这个但是没有用

  final HtmlForm form =   page1.getFormByName(formlist.get(1).getLocalName());
Run Code Online (Sandbox Code Playgroud)

我相信你可以使用xpath来查找表单名称?

java xpath htmlunit

7
推荐指数
1
解决办法
7648
查看次数

JBoss AS 7禁用热部署

在以前的版本中,您只需在conf/jboss-service.xml中禁用ScanEnabled属性.

我想知道如何在JBoss 7上禁用它

谢谢

jboss

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

传递linq查询来查看

我做了一个linq查询,我想传递给视图,但它给了我这个错误

The model item passed into the dictionary is of type 'System.Data.Entity.Infrastructure.DbQuery`1[<>f__AnonymousType4`2[System.String,System.String]]', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1
Run Code Online (Sandbox Code Playgroud)

我的ViewModel

  public class ManageScoreViewModel
     {
         public string fullName { get; set; }
         public string teamName { get; set; }
     }
Run Code Online (Sandbox Code Playgroud)

调节器

  public ActionResult Index()
        {
            MyteamViewModel ms = new MyteamViewModel ();
            var vm = (from u in db.Users
                     join tm in db.Team_Members
                     on u.user_id equals tm.user_id
                     join t in db.Teams
                     on tm.team_id equals t.team_id
                     orderby t.name
                     select new …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc

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

如何使用JBoss AS 7在Internet上部署应用程序

我正在使用JBoss 7 AS.我正在通过cmd这样的cmd部署项目

bin/standalone.sh -b [ipaddress]

只有当我在网络上时这才能正常工作,但是当我在网络外或通过互联网时,它不起作用.

我如何启动它以便人们可以通过互联网访问它?

我试过这个,但它不起作用.

bin/standalone.sh -b 0.0.0.0

它说:

谷歌浏览器无法加载网页,因为响应时间过长.网站可能已关闭,或者您可能遇到与Internet连接有关的问题.

jboss7.x

3
推荐指数
1
解决办法
8717
查看次数

自定义Web字体在IE9中不起作用

我下载了自定义字体(Gotham-Light.eot),但它在Internet Explorer 9上不起作用.

@font-face {
    font-family: Gotham-Light;
    src: url('Gotham-Light.eot');
}
Run Code Online (Sandbox Code Playgroud)

这不起作用.我正在使用ASP MVC3重建,使用自定义工具,仍然没有.

css asp.net webfonts internet-explorer-9 asp.net-mvc-3

3
推荐指数
1
解决办法
9984
查看次数

使用group by传递linq查询以查看[错误输出]

我在控制器中得到了这个

var tobi = (from a in db.Assessments
join u in db.Users on a.rated equals u.user_id
join tm in db.Team_Members on u.user_id equals tm.user_id
join t in db.Teams on tm.team_id equals t.team_id
where (tm.end_date == null || tm.end_date > DateTime.Today)
group new TobiViewModel
{
    teamname = t.name,
    assessed_due = a.assessed_due,
    assessment_id = a.assessment_id,
    rater = a.rater,
    rated = a.rated
}
by new { t.name, a.rated }).ToList();

return View(tobi);
Run Code Online (Sandbox Code Playgroud)

但是它在视图中不接受它?

传递到字典中的模型项的类型为'System.Collections.Generic.List 1[System.Linq.IGrouping2 [<> f__AnonymousType10 2[System.String,System.String],Kyubu.ViewModels.TobiViewModel]]', but this dictionary requires a …

linq asp.net-mvc

3
推荐指数
1
解决办法
1982
查看次数

jquery在另一个文本框中键入时更新文本框值

我有2个文本框字段.电子邮件和用户名.当我输入电子邮件字段时,我想要动态更新用户名,电子邮件字段中的字母.我有这个代码,但它不起作用

$('#txt_email').keyup(function() {
                $('#txt_username').text($(this).val());
            });
Run Code Online (Sandbox Code Playgroud)

小提琴:http://jsfiddle.net/j7ECW/

jquery keyup

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

asp mvc自定义验证如何获取其他值

我正在使用自定义验证比较用户名.我正在检查它是否与旧值相同,或者如果它通过正则表达式,它是可以接受的,但如果不是,则抛出错误.如果可能,我如何从viewmodel获取UserID?

    [EmailValidation]
    public string Username{ get; set; }
    public int UserID { get; set; }



public class EmailValidationAttribute : ValidationAttribute
    {
         protected override ValidationResult IsValid(object value, ValidationContext validationContext)
         {

             User user= User.getUserByID(UserID); //How to get UserID?
             string username= value.ToString();
             if (user.Username== username || IsValid(username))
                {
                    return ValidationResult.Success;
                }
                else
                {
                    return new ValidationResult("Error");
                }

            }
Run Code Online (Sandbox Code Playgroud)

validation asp.net-mvc mvvm data-annotations

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