新手求助!android服务器端程序 !在线等候,多谢各位大侠!!!

福满心头 2013-12-21 11:12:29
android手机端实现用户登录功能,需要一个服务器端的程序,采用的是httpServlet传输协议,在开发服务器端采用的是struts2+spring的框架结构,但是始终不好用

第一种方式是想直接写action,通过访问action来访问数据库,实现与手机端的数据通讯,但是总是报错
报的是如下错误:
java.lang.NoSuchMethodException: com.mobile.servlet.mInterface.mlog()

程序如下:
public class mInterface extends BaseServlet {

public ActionForward mlog(HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException, JSONException {
// TODO Auto-generated method stub

String logname=request.getParameter("username");
String logpass=request.getParameter("userpass");

//此处验证登陆用户名密码是否正确
if(logname!=null && !logname.equals("") && logpass!=null && !logpass.equals(""))
{
response.setCharacterEncoding("utf-8");
if(存在此用户)
{
userInfoMap=(Map)userInfoList.get(0);

userid=Integer.parseInt(userInfoMap.get("USER_ID").toString());
request.getSession(true).setAttribute("userId", userid);

}


}
else
{
PrintWriter out = response.getWriter();
out.println("-----------------");
userid=-2;
}
JSONObject jsonObj = new JSONObject();
jsonObj.put("userId", userid);
response.getWriter().println(jsonObj.toString());
return null;
}
}


applicationContext.xml文件内容:
<!-- 手机终端接口action注入开始 -->

<bean id="Minterface" class="com.mobile.servlet.mInterface" scope="prototype">
<property name="userManageService">
<ref bean="IUserManageService"/>
</property>
</bean>

<!-- 手机终端接口action注入结束 -->


struts.xml文件内容:
<package name="mAction" extends="struts-default">
<action name="mlogMinterface" class="Minterface" method="mlog">
</action>
</package>


我找了一下网上的资料大概意思是说mlog()括号里面不能跟参数,可是不跟参数,我怎么能获取httpServletRequest跟httpServeltResponse?

或者哪位大侠有别的服务器端程序的实现方式,能教教菜鸟,在此多谢多谢!
...全文
88 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧