2014年5月22日星期四

Neighborhoods : How will the value passed to java class in

index.jsp
I have access to the server 's own release through mobile phones, and to achieve a login function , the user name to log on to the database through Login.java comparison, I would like the user name after comparison, shown in the index.jsp page this user name
------ Solution ------------------------------------- -------
you can save the local user name and other information, log on to the index.jsp pass after the success of the past , index. jsp to display . But to do deal with security aspects . For example, the http headers , verify ip address and so on.
------ For reference only -------------------------------------- -
can exist username
------ For reference only session where --------------------------- ------------

I do is phone side c / s mode , does not take session ah
------ For reference only ---- -----------------------------------
displayed in the index.jsp page out of this username ? You still cs modes , cs mode where you come from jsp it
------ For reference only -------------------------- -------------

mobile client login is c / s mode , after the jump reached a webview ( browser) Activty, where can show page < br> ------ For reference only ---------------------------------------

Thank you, I want to know how to pass index.jsp past can teach about it
------ For reference only ------------- --------------------------
such as access webview in the specified address as http://ip address / index.jsp? username = myusername ,
index.jsp can be based on the user name username value , and then remove the user information display.
------ For reference only -------------------------------------- -

webview here I have shown this page, I had a product information list on this page , I just want to show the user name
------ For on this page reference only ---------------------------------------

 public class Login extends HttpServlet {  
private static final long serialVersionUID = 1L;
private boolean result;
public String a;
public void doGet (HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType ("text / html");
PrintWriter out = response.getWriter ();
String name = request.getParameter ("username");
String psd = request.getParameter ("psd");
a = request.getParameter ("username");
/ / contrast with the database user name and password
DBUtil dbUtil = new DBUtil ();
{
if ("aaa" equals (name).) result = true;
else
result = dbUtil.checkUser ("select * from user where name =? and password ; = ", new String [] {name, psd})?;
out.print (result);}
}
public void doPost (HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doGet (request, response);
}

}

------ For reference only ---------------------------------- -----

webview here I have shown this page, I had a product information list on this page , I just want on this page shows the user name  

public class Login extends HttpServlet {
private static final long serialVersionUID = 1L; 
private boolean result;
public  String a;
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out=response.getWriter();
String name = request.getParameter("username");        
String psd = request.getParameter("psd");
                a =request.getParameter("username");
  //与数据库对比用户名和密码
DBUtil dbUtil = new DBUtil();
{
  if("aaa".equals(name))result = true;
  else
        result = dbUtil.checkUser("select * from user where name=? and password = ?",new String []{name,psd});
out.print(result);}  
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
          this.doGet(request, response);
}
}


------ For reference only ----------------------------------- ----
easiest way in the index. jsp to display a username places add code :
<% = request.getParameter ("username")%>
------ For reference only ------------------ ---------------------

mobile client login is c / s mode , after the jump reached a webview ( browser) Activty, here you can display the page,  
Whether b / s, c / s server always want to save a session state , you do not save this state is at the client , and the server have nothing , right ? Seen some app + app html5 timely with children outside of the shell , that is to communicate with the http protocol. Then will return to the client cookie saved , followed by time ajax request will jsessionID plus , maintained throughout the session.
------ For reference only -------------------------------------- -

Thank you for doing your way out .

没有评论:

发表评论