是什么区别action
和actionListener
,什么时候应该使用action
与actionListener
?
有时,使用时<h:commandLink>
,<h:commandButton>
或者<f:ajax>
,在action
,actionListener
或listener
与标签相关的方法根本不被调用.或者,bean属性不会使用提交的UIInput
值进行更新.
有什么可能的原因和解决方案?
我想从画廊创建一个图片选择器.我用代码
intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, TFRequestCodes.GALLERY);
Run Code Online (Sandbox Code Playgroud)
我的问题是在此活动中显示视频文件.有没有办法过滤显示的文件,以便在此活动中不显示任何视频文件?
对于我们的Web应用程序,我需要根据视图保存获取和显示的项目的顺序 - 或者确切地说 - 生成视图的控制器和操作(当然还有用户ID,但这不是重点).
我不是在每个控制器动作中自己给出一个标识符(为了将它用于某些视图相关的DB输出排序),我认为从控制器和动作方法自动创建这个标识符会更安全,更容易.来自.
如何从控制器中的action方法中获取控制器和操作的名称?或者我需要反思吗?我想这很简单,提前谢谢!
我正在尝试根据下拉菜单中的选定值更改表单操作.
基本上,HTML看起来像这样:
<form class="search-form" id="search-form" method="post" accept-charset="UTF-8" action="/search/user">
<select id="selectsearch" class="form-select" name="selectsearch">
<option value="people">Search people</option>
<option value="node">Search content</option>
</select>
<label>Enter your keywords: </label>
<input type="text" class="form-text" value="" size="40" id="edit-keys" name="keys" maxlength="255" />
<input type="submit" class="form-submit" value="Search" id="edit-submit" name="search"/>
</form>
Run Code Online (Sandbox Code Playgroud)
如果选择"人员"(默认情况下),则操作应为"/ search/user",如果选择了内容,则操作应为"/ search/content"
我还在四处寻找,但一直无法找到如何做到这一点.
我正在与C#中的Action Delegates合作,希望能够更多地了解它们并思考它们可能有用的地方.
有没有人使用过Action Delegate,如果有的话为什么?或者你能举出一些可能有用的例子吗?
从API级别16(Jelly Bean)开始,可以使用通知添加操作
builder.addAction(iconId, title, intent);
Run Code Online (Sandbox Code Playgroud)
但是当我向通知添加操作并按下操作时,通知不会被解除.单击通知本身时,可以将其解除
notification.flags = Notification.FLAG_AUTO_CANCEL;
Run Code Online (Sandbox Code Playgroud)
要么
builder.setAutoCancel(true);
Run Code Online (Sandbox Code Playgroud)
但显然,这与通知相关的操作无关.
任何提示?或者这不是API的一部分?我没找到任何东西.
在MVC3中使用Razor替换图像链接的最佳方法是什么.我现在只是这样做:
<a href="@Url.Action("Edit", new { id=MyId })"><img src="../../Content/Images/Image.bmp", alt="Edit" /></a>
Run Code Online (Sandbox Code Playgroud)
有没有更好的办法?
我在Global.asax中有默认路由:
RouteTable.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = System.Web.Http.RouteParameter.Optional }
);
Run Code Online (Sandbox Code Playgroud)
我希望能够定位特定的功能,所以我创建了另一条路线:
RouteTable.Routes.MapHttpRoute(
name: "WithActionApi",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = System.Web.Http.RouteParameter.Optional }
);
Run Code Online (Sandbox Code Playgroud)
所以,在我的控制器中,我有:
public string Get(int id)
{
return "object of id id";
}
[HttpGet]
public IEnumerable<string> ByCategoryId(int id)
{
return new string[] { "byCategory1", "byCategory2" };
}
Run Code Online (Sandbox Code Playgroud)
打电话.../api/records/bycategoryid/5
会给我我想要的东西.但是,通话.../api/records/1
会给我错误
找到了与请求匹配的多个操作:...
我明白为什么那就是-航线只是定义哪些URL是有效的,但是当涉及到的功能匹配,都Get(int id)
和ByCategoryId(int id)
比赛api/{controller}/{id}
,这是混淆了框架.
我需要做些什么才能让默认的API路由再次运行,并保持一个{action}
?我想创建一个名为RecordByCategoryIdController
匹配默认API路由的不同控制器,我会请求它.../api/recordbycategoryid/5
.但是,我发现这是一个"脏"(因此不令人满意)的解决方案.我已经找到了这方面的答案,没有关于使用路线{action}
甚至提到这个问题的教程.
如何设置Swift中自定义UIBarButtonItem的操作?
以下代码成功将按钮放在导航栏中:
var b = UIBarButtonItem(title: "Continue", style: .Plain, target: self, action:nil)
self.navigationItem.rightBarButtonItem = b
Run Code Online (Sandbox Code Playgroud)
现在,我想func sayHello() { println("Hello") }
在触摸按钮时打电话.到目前为止我的努力:
var b = UIBarButtonItem(title: "Continue", style: .Plain, target: self, action:sayHello:)
// also with `sayHello` `sayHello()`, and `sayHello():`
Run Code Online (Sandbox Code Playgroud)
和..
var b = UIBarButtonItem(title: "Continue", style: .Plain, target: self, action:@selector(sayHello:))
// also with `sayHello` `sayHello()`, and `sayHello():`
Run Code Online (Sandbox Code Playgroud)
和..
var b = UIBarButtonItem(title: "Continue", style: .Plain, target: self, action:@selector(self.sayHello:))
// also with `self.sayHello` `self.sayHello()`, and `self.sayHello():`
Run Code Online (Sandbox Code Playgroud)
请注意,它sayHello()
出现在intellisense中,但不起作用.
谢谢你的帮助.
编辑:对于后代,以下工作: …