我正在运行Apache 2.0,我只是想知道是否可以使用JavaScript或jQuery进行301重定向.
我有一个指定位置的<a></a>标签,href当我点击该链接时,我被要求进行301重定向.
这是针对搜索引擎优化,我试图找到一种方法来301重定向到链接中的同一页面,而无需创建新页面或创建表单/提交.
我重命名了我的包,现在我得到了这个奇怪的错误:
Unable to instantiate application
app.MyApplication: java.lang.ClassNotFoundException:
app.MyApplication in loaderdalvik.system.PathClassLoader
Run Code Online (Sandbox Code Playgroud)
该MyApplication班是Application/app.清单说:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="Application">
Run Code Online (Sandbox Code Playgroud)
<application
android:label="AGG"
android:name="app.MyApplication"...
Run Code Online (Sandbox Code Playgroud)
我试过重新启动,清理内置.是在模拟器上还是在真实设备上不起作用.
地球上到底是怎么回事?
我试图定义一个切入点,它将捕获每个注释的方法(即)@CatchThis.这是我自己的注释.
此外,我想访问该方法的第一个参数,它将是Long类型.可能还有其他争论,但我不关心它们.
编辑
这就是我现在所拥有的.我不知道的是如何传递带注释的方法的第一个参数@CatchThis.
@Aspect
public class MyAspect {
@Pointcut(value = "execution(public * *(..))")
public void anyPublicMethod() {
}
@Around("anyPublicMethod() && @annotation(catchThis)")
public Object logAction(ProceedingJoinPoint pjp, CatchThis catchThis) throws Throwable {
return pjp.proceed();
}
}
Run Code Online (Sandbox Code Playgroud) 我需要构建一个多行选择控件.所有<option>的地方文本的宽度大于300像素(例如)成为有必要的行不超过提到的上限.
这些图像不言自明:

首先我尝试了这个,但是没有用.
<html>
<head>
<style>
option{
width: 100px;
white-space: wrap;
}
</style>
</head>
<body>
<select>
<option>I'm short</option>
<option>I'm medium text</option>
<option>I'm a very very very very very very very very very long text</option>
</select>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我正在使用bootstrap框架,我想也许我可以使用下拉控件来获取结果.我已经尝试设置max-width CSS属性,但它也不起作用......
我怎样才能做到这一点?
我使用以下jQuery通过数据服务插入数据.事件虽然我得到状态响应201并且数据已成功插入我的数据库,但系统仍将其视为错误并给我"失败"警报?
我在这里错过了什么?
$.ajax({
type: "POST",
url: "http://localhost:49223/Form/WebDataService.svc/XMLForm(guid'1eaef3a0-d6df-45bf-a8f6-3e7292c0d77e')/XMLRecord/",
data: JSON.stringify(record),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function() {
alert("Success");
},
error: function(xhr) {
alert("fail");
}
});
Run Code Online (Sandbox Code Playgroud)
更新:
来自Fire Bug的调试消息:
Preferences
POST http://localhost:49223/Form/WebDataService.svc/X...ef3a0-d6df-45bf-a8f6-3e7292c0d77e%27)/XMLRecord/
POST http://localhost:49223/Form/WebDataService.svc/XMLForm(guid%271eaef3a0-d6df-45bf-a8f6-3e7292c0d77e%27)/XMLRecord/
jquery....min.js (line 127)
POST http://localhost:49223/Form/WebDataService.svc/X...ef3a0-d6df-45bf-a8f6-3e7292c0d77e%27)/XMLRecord/
POST http://localhost:49223/Form/WebDataService.svc/XMLForm(guid%271eaef3a0-d6df-45bf-a8f6-3e7292c0d77e%27)/XMLRecord/
201 Created 6.7s
POST http://localhost:49223/Form/WebDataService.svc/X...ef3a0-d6df-45bf-a8f6-3e7292c0d77e%27)/XMLRecord/
POST http://localhost:49223/Form/WebDataService.svc/XMLForm(guid%271eaef3a0-d6df-45bf-a8f6-3e7292c0d77e%27)/XMLRecord/
201 Created
get readyState 4
get responseText "{ "d" : {\r\n"__metadata"...\')/XMLForm"\r\n}\r\n}\r\n} }"
get responseXML null
get status 201
get statusText "Created"
Run Code Online (Sandbox Code Playgroud) 如何将我的日期格式化为2012-11-25T23:50:56.193+01:00使用SimpleDateFormat?
如果我使用Z的格式如
yyyy-MM-dd'T'hh:mm:ss.SSSZ
然后它显示
2013-03-06T11:49:05.490+0100
mockito中这两个声明有什么区别?
@Mock(answer = Answers.CALLS_REAL_METHODS)
ArrayList<String> mock;
@Spy
ArrayList<String> spy;
Run Code Online (Sandbox Code Playgroud) 我想倾斜一个被拖动的项目以显示区别.我有基本的拖放小提琴这里https://jsfiddle.net/igaurav/bqprc9p8/3/
我的javascript看起来像:
"use strict";
var source = null;
function listItemDragStartHandler(event){
// What is true there for?
source = event.currentTarget;
event.dataTransfer.setData("text/plain", event.currentTarget.innerHTML);
event.currentTarget.style.transform = 'rotate(15deg)';
event.dataTransfer.effectAllowed = "move";
}
function dragoverHandler(event) {
event.preventDefault();
event.dataTransfer.dropEffect = "move";
}
function dropHandler(event) {
event.preventDefault();
event.stopPropagation();
var currentElement = event.currentTarget;
var listContainer = currentElement.parentNode;
listContainer.insertBefore(source, currentElement);
source.style.transform = 'rotate(0deg)';
}
function delete_item(event) {
var currentTarget = event.currentTarget;
var grandParentOfDelete = currentTarget.parentNode.parentNode;
grandParentOfDelete.remove();
}
function add_item() {
var item_text_node = document.getElementsByName("add-item-text")[0]
var item_text = item_text_node.value; …Run Code Online (Sandbox Code Playgroud) 我面临着问题formGroup.首先基于URL我采取一些价值并调用API来检索前场文本的特定用户数据.
register.html
<form [formGroup]="form" (ngSubmit)="onSubmit(form.value)" class="form-horizontal">
<div class="form-group row">
<label for="inputEmail3" class="col-sm-4 ">Username</label>
<div class="col-sm-8">
<input [formControl]="email" type="text" class="form-control" id="inputEmail3" placeholder="Email Address" [readonly]="isReadOnly">
</div>
</div>
</form>
Run Code Online (Sandbox Code Playgroud)
register.component.ts
import { Component } from '@angular/core';
import { FormGroup, AbstractControl, FormBuilder, Validators } from '@angular/forms';
import { Router, ActivatedRoute } from '@angular/router';
import { EmailValidator, EqualPasswordsValidator } from '../../theme/validators';
@Component({
selector: 'register',
templateUrl: './register.html',
})
export class Register {
public form: FormGroup;
public email: AbstractControl;
public username: string;
constructor(private registerService: RegisterService, …Run Code Online (Sandbox Code Playgroud) javascript angular2-forms angular2-template angular2-routing angular
我必须与从 GET 请求正文中获取参数的 API 进行交互。我知道这可能不是最好的主意,但它是 API 的构建方式。
当我尝试使用 构建查询时XMLHttpRequest,看起来负载根本没有发送。您可以运行它并查看网络选项卡;请求已发送,但没有正文(在最新的 Chrome 和 Firefox 中测试):
const data = {
foo: {
bar: [1, 2, 3]
}
}
const xhr = new XMLHttpRequest()
xhr.open('GET', 'https://my-json-server.typicode.com/typicode/demo/posts')
xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8')
xhr.send(JSON.stringify(data))
Run Code Online (Sandbox Code Playgroud)
诸如 axios 之类的库是基于 XMLHttpRequest 构建的,因此它们也无法正常工作...
有没有办法在 JavaScript 中实现这一点?