我对jQuery很新,并且认为我可能会做出比它需要的更难的东西.我有一个jQuery变量,它只是一个无序列表.它是这样声明的:
var $list = $('#activityList'); // activityList is ID of <ul>
Run Code Online (Sandbox Code Playgroud)
我正在尝试<li>使用我创建的变量选择该列表中的所有元素:
$items = $('#' + $list.attr('id') + ' > li');
Run Code Online (Sandbox Code Playgroud)
有没有人知道是否有不同的语法来实现同样的事情而不必将变量分解为它的id属性?
谢谢.
澄清:我使用简化代码来提问,但我确实想在选择器中使用jQuery变量"$ list",而不是硬编码ID.
我有一个使用 Spring Security 4.0.1.RELEASE 的基于 J2EE REST 的 Web 应用程序。我正在使用基于 Java 的配置配置 Spring Security,并将会话创建策略设置为 STATELESS,如下所示:
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(secureEnabled=true, prePostEnabled=true, jsr250Enabled=true, order=1)
public class DefaultSecurityBeansConfig extends WebSecurityConfigurerAdapter {
// ...
@Override
protected void configure(HttpSecurity http) throws Exception {
http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()...; // additional config omitted for brevity
// ...
}
// ...
}
Run Code Online (Sandbox Code Playgroud)
在阅读了这篇关于 Spring Security 会话管理的文章后,我认为SessionManagementFilter过滤器不应该运行在 Spring Security 的过滤器链中。但它绝对是。我可以在那个类中设置断点doFilter方法中,它会在对服务器的每个请求上运行。
这里发生了什么?此过滤器正在运行的事实导致我的应用程序中出现其他意外行为,我认为这些行为已被配置掉。
谢谢。
我需要概述一些上下文的背景信息.请耐心等待,我会尽量简化我的问题:
我有一个继承自另一个对象的对象.我们将第一个对象称为Fruit,第二个称为Apple.所以我宣布苹果如下:
public class Apple : Fruit
{
public string appleType;
public string orchardLocation;
// etc.
}
Run Code Online (Sandbox Code Playgroud)
而Fruit对象如下:
public class Fruit
{
public int fruitID;
public int price;
// etc.
}
Run Code Online (Sandbox Code Playgroud)
所以Apple继承了Fruit.让我们说我有许多其他水果类型都继承自水果:香蕉,橙子,芒果等.
在我的应用程序中,我保持在Session中存储特定类型的水果作为该类型的对象的能力,因此我可能在那里有一个Apple对象或Banana对象.我有一个方法将从会话中检索当前的Fruit,如下所示:
protected Fruit GetModel(int fruitID)
{
// code to retrieve the fruit from the Session
// fruitID could be the ID for an Apple or Banana, etc.
}
Run Code Online (Sandbox Code Playgroud)
偶尔,我需要从Session中获取结果,更新一些内容,然后将其上传回Session.我可以这样做:
Apple myApple = (Apple)GetModel(fruitID);
myApple.orchardLocation = "Baugers";
UpdateModel(myApple); // just overwrites the current fruit in the Session
Run Code Online (Sandbox Code Playgroud)
现在我的问题.我需要从Session中提取对象,更新特定于水果本身的东西(比如价格),然后将同一个对象上传回Session.到现在为止,我一直都知道对象的类型,所以在我的情况下 - …
这是我以前的几个问题的延续.我有一个名为UserController的控制器,我想处理两种类型对象的操作:User和UserProfile.在其他操作中,我想为这两个对象和UserController定义一个Edit操作.它们需要是单独的动作,我不介意在控制器中将它们称为EditUser和EditProfile ,但我更喜欢URL如下所示:
http://www.example.com/User/Edit/{userID}
Run Code Online (Sandbox Code Playgroud)
和
http://www.example.com/User/Profile/Edit/{userProfileID}
Run Code Online (Sandbox Code Playgroud)
有没有人知道如何实现这些路线,因为对同一控制器中的动作有所限制?
谢谢.
asp.net-mvc ×1
c# ×1
generics ×1
inheritance ×1
java ×1
jquery ×1
selector ×1
session ×1
spring ×1