学了dw 就可以做网站了吗有什么网站可以做投票

张小明 2026/1/3 11:54:48
学了dw 就可以做网站了吗,有什么网站可以做投票,crm管理系统登录,wordpress h5幻灯片1.Model层——User类的设计 同上一篇文章用户添加。 2. dao层——UserDao的设计 在UserDao中添加登陆方法的代码。 public boolean Login(User user){//根据用户信息执行查询操作#xff0c;查到返回true,没查到返回falseString strUserNameuser.getUsername();String str…1.Model层——User类的设计同上一篇文章用户添加。2. dao层——UserDao的设计在UserDao中添加登陆方法的代码。public boolean Login(User user){ //根据用户信息执行查询操作查到返回true,没查到返回false String strUserNameuser.getUsername(); String strPassworduser.getPassword(); Integer type user.getType(); Cursor cursordb.query(user_table,null,username? and password? and type?, new String[]{strUserName,strPassword,String.valueOf(type)},null,null,null ); if(cursor.moveToNext()){ return true; }else { return false; } }3. service层——UserService设计(1)接口UserService添加登陆方法声明。public boolean Login(User user);2实现类UserServiceImpl添加登陆方法的实现。public boolean Login(User user) { return userDao.Login(user); }4. View层——LoginActivity设计(1)布局文件activity_login.xml设计?xml version1.0 encodingutf-8? LinearLayout xmlns:androidhttp://schemas.android.com/apk/res/android xmlns:apphttp://schemas.android.com/apk/res-auto xmlns:toolshttp://schemas.android.com/tools android:layout_widthmatch_parent android:layout_heightmatch_parent android:orientationvertical android:padding12dp android:gravitycenter android:backgroundcolor/colorBlue tools:context.LoginActivity LinearLayout android:layout_widthmatch_parent android:layout_height450dp android:backgrounddrawable/login_box_background android:orientationvertical TextView android:idid/textView android:layout_widthmatch_parent android:layout_heightwrap_content android:textSize40sp android:layout_marginBottom20dp android:gravitycenter android:textWelcome / EditText android:idid/etUserName android:layout_widthmatch_parent android:layout_heightwrap_content android:ems10 android:inputTypetextPersonName android:hint用户名 android:textSizedimen/fontSize android:drawableLeftdrawable/username / EditText android:idid/etPassword android:layout_widthmatch_parent android:layout_heightwrap_content android:ems10 android:inputTypetextPassword android:hint密码 android:textSizedimen/fontSize android:drawableLeftdrawable/password android:maxLength10 / LinearLayout android:layout_widthmatch_parent android:layout_heightwrap_content android:orientationhorizontal RadioGroup android:layout_widthmatch_parent android:layout_heightwrap_content android:orientationhorizontal RadioButton android:idid/radStudent android:layout_width0dp android:layout_weight1 android:layout_heightwrap_content android:checkedtrue android:textSizedimen/fontSize android:text学生 / RadioButton android:idid/radTeacher android:layout_width0dp android:layout_weight1 android:layout_heightwrap_content android:textSizedimen/fontSize android:text教师 / /RadioGroup /LinearLayout Button android:idid/btLogin android:layout_widthmatch_parent android:layout_heightwrap_content android:layout_marginTop20dp android:backgrounddrawable/new_btn_background android:textColorcolor/colorWhite android:layout_marginLeft20dp android:layout_marginRight20dp android:textSizedimen/fontSize android:textLogin / LinearLayout android:layout_widthmatch_parent android:layout_heightwrap_content android:layout_marginTop20dp android:orientationhorizontal CheckBox android:idid/chkAutoLogin android:layout_width0dp android:layout_heightwrap_content android:layout_weight2 android:textSizedimen/fontSize android:text自动登陆 / CheckBox android:idid/chkSavePass android:layout_width0dp android:layout_heightwrap_content android:layout_weight3 android:checkedtrue android:text记住密码 android:textSizedimen/fontSize / /LinearLayout LinearLayout android:layout_widthmatch_parent android:layout_heightwrap_content android:layout_marginTop20dp android:orientationhorizontal TextView android:idid/tvReg android:layout_width0dp android:layout_heightwrap_content android:layout_weight3 android:textSizedimen/fontSize android:textColorcolor/colorBlue android:layout_marginLeft30dp android:text用户注册 android:textStylebold / TextView android:idid/tvForgetPass android:layout_width0dp android:layout_heightwrap_content android:layout_weight2 android:textSizedimen/fontSize android:textColorcolor/colorBlue android:layout_marginLeft50dp android:textStylebold android:text忘记密码 / /LinearLayout /LinearLayout /LinearLayout(2)主类LoginActivity设计package com.example.myactivitydemo; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.content.SharedPreferences; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; import android.widget.RadioButton; import android.widget.TextView; import android.widget.Toast; import com.example.myactivitydemo.entity.User; import com.example.myactivitydemo.service.UserService; import com.example.myactivitydemo.service.impl.UserServiceImpl; import com.example.myactivitydemo.util.DbHelper; import com.example.myactivitydemo.util.MD5Util; public class LoginActivity extends AppCompatActivity { private EditText etUserName; private EditText etPassword; private Button btLogin; private CheckBox chkSavePass; private CheckBox chkAutoLogin; private TextView tvReg; private RadioButton radStudent; private RadioButton radTeacher; //定义两个成员变量 private SharedPreferences sp; private SharedPreferences.Editor editor; private UserService userService; private int type; Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); initView(); //实例化 spgetSharedPreferences(user,0); editorsp.edit(); //读取用户信息 String strUserNamesp.getString(username,); String strPasswordsp.getString(password,); etUserName.setText(strUserName); etPassword.setText(strPassword); tvReg.setOnClickListener(new View.OnClickListener() { Override public void onClick(View v) { Intent intentnew Intent(LoginActivity.this,RegisterActivity.class); startActivity(intent); } }); btLogin.setOnClickListener(new View.OnClickListener() { Override public void onClick(View v) { String strUserNameetUserName.getText().toString().trim(); String strPasswordetPassword.getText().toString().trim(); if(radStudent.isChecked()){ type1; }else{ type2; } //身份验证 userServicenew UserServiceImpl(LoginActivity.this); User usernew User(); user.setUsername(strUserName); user.setPassword(strPassword); user.setType(type); if(userService.Login(user)){ if(chkSavePass.isChecked()){ //执行记住密码的操作 editor.putString(username,strUserName); editor.putString(password,etPassword.getText().toString()); editor.commit();//提交 } Intent intentnew Intent(LoginActivity.this,InfoActivity.class); startActivity(intent); }else{ Toast.makeText(LoginActivity.this, 用户名或密码错误,Toast.LENGTH_LONG).show(); } } }); } public void initView(){ etUserNamefindViewById(R.id.etUserName); etPasswordfindViewById(R.id.etPassword); btLoginfindViewById(R.id.btLogin); chkAutoLoginfindViewById(R.id.chkAutoLogin); chkSavePassfindViewById(R.id.chkSavePass); tvRegfindViewById(R.id.tvReg); radStudentfindViewById(R.id.radStudent); radTeacherfindViewById(R.id.radTeacher); } }最后是实现效果
版权声明:本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

网站建设中数据库海口建设网站的公司

第一章:Open-AutoGLM本地生活优惠搜罗 Open-AutoGLM 是一款基于开源大语言模型的自动化信息聚合工具,专为本地生活服务场景设计,能够实时抓取并分析各大平台发布的优惠信息,如餐饮折扣、影院特惠、社区团购等。通过自然语言理解与…

张小明 2026/1/2 5:30:46 网站建设

学做网站从零开始有域名 空间如何建网站

第一章:Open-AutoGLM 报错代码查询在使用 Open-AutoGLM 框架进行自动化任务时,开发者常会遇到各类运行时错误。准确识别并解析报错代码是提升调试效率的关键环节。该框架通过标准化的错误码机制反馈问题来源,便于快速定位故障点。常见错误类型…

张小明 2026/1/1 21:43:00 网站建设

跨境电商网站建设方案书网络营销导向网站建设的基础

VSCode调试控制台集成Anything-LLM解释异常堆栈信息 在现代软件开发中,一个常见的场景是:你正在调试一段代码,突然控制台弹出一长串堆栈跟踪信息——满屏的 at com.example... 或 Caused by: java.lang.NullPointerException。即使是有经验的…

张小明 2026/1/1 19:44:58 网站建设

网站运营管理员具体做什么复兴区建设局网站

粉丝提问:在一家互联网公司做后端开发五年了,最近团队有管理岗位的机会,老板也暗示可以考虑我。内心有点纠结,一方面觉得管理岗位意味着更大的责任和影响力,可能薪资也会更高;另一方面,自己对写…

张小明 2026/1/2 1:09:58 网站建设

用阿里巴巴做公司网站怎么样阿里跨境电商平台有哪些

文章目录前言一、时序数据库选型的核心考量因素二、IoTDB / TimechoDB:为工业物联网而生1. 产品体系:“采-存-用”一体化2. 架构优势:高可用、高扩展3. 企业级增强功能三、IoTDB 大模型:时序大模型开启智能分析新范式1. 什么是时…

张小明 2026/1/3 0:53:43 网站建设

网站的网页自己注册的公司怎么报税

玩转WS2812B:别再被“闪瞎眼”坑了,真正致命的是这根线上的时间精度你有没有遇到过这样的情况?精心写好代码,接上WS2812B灯带,想让第一颗灯亮个红色——结果整条灯带疯狂闪烁,颜色乱飞,像是中了…

张小明 2025/12/29 12:50:10 网站建设