我为Fragment创建了一个微调器,用从HTTP标注中检索的数据填充它.首次创建Fragment时,我使用其选择选项填充微调器,设置其setOnItemSelectedListener并在onCreateView()中设置其初始选择.
stateSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View view, int position, long id)
{
if (spinnerPosition != position)
{
spinnerPosition = position;
TextView stateSelected = (TextView) view;
String stateSelectedStr = stateSelected.getText().toString();
LinearLayout ballotsDisplay = (LinearLayout) getActivity().findViewById(R.id.ballotsDisplay);
ballotsDisplay.removeAllViews();
Map<String, String> calloutParams = new HashMap<String, String>();
calloutParams.put("state", stateSelectedStr);
// Create and execute AsyncTask to retrieve ballots
new RetrieveBallots().execute(calloutParams);
}
}
public void onNothingSelected(AdapterView<?> parent) {
return;
}
});
// Set default selection for spinner
int defaultState = adapter.getPosition(userState);
if (defaultState == …Run Code Online (Sandbox Code Playgroud) 当我使用强类型集线器时,我遇到了TypeLoadException.我的界面是:
public interface IClientCallback
{
void callback<T>(T msg, string eventType);
void test(string msg, string eventType);
}
Run Code Online (Sandbox Code Playgroud)
所有方法都在单个接口中,并且接口不从任何其他接口继承.
我的Hub类是:
public class ServiceHub : Hub<IClientCallback>
{
public static readonly string ServiceHubName = "ServiceHub";
public void Register(string name, string eventType)
{
Clients.All.test("hello", "world");
}
}
Run Code Online (Sandbox Code Playgroud)
当我使用我的客户端应用程序在集线器上调用Register方法时,在Hub应用程序上,当它在Clients.All.test(...)时收到异常:
TypeLoadException方法'Microsoft.AspNet.SignalR.Hubs.TypedClientBuilder.IClientCallbackImpl'中的方法'callback'来自程序集'Microsoft.AspNet.SignalR.Hubs.TypedClientBuilder,Version = 0.0.0.0,Culture = neutral,PublicKeyToken = null'没有一个实现.
我无法缩小导致此异常的确切原因.一点帮助或建议将不胜感激.
我对Spring比较新,我对标签有点困惑.
在浏览文档并查看不同的帖子后,似乎主要用途是Spring MVC需要将请求分派给@Controllers.
我创建了一个带有两个requestMappings的控制器:
@RequestMapping(method = RequestMethod.GET,value ="/ health")@ RequestMapping(method = RequestMethod.GET,value ="/ test")
我在servlet.xml中测试和测试了web应用程序,似乎没有任何区别是被忽略或没有.请求似乎仍然可以达到我的控制器.
任何人都可以向我解释这个标签究竟用于什么?
提前致谢!