简单的设定:
以下程序默认条件:
该表单仅有一个用户:用户名和密码均为数值型123456
用户名文本框名字为text1,密码文本框的名字是text2
那么登陆表单的确定按钮代码可以设置为:
if alltrim(thisform.text1.value)==123456 and alltrim(thisform.text2.value)==123456
messagebox("欢迎使用,登陆成功!",0,"提示信息")
else
messagebox("用户名或者密码错误!请重新输入!",0,"错误信息")
endif
thisform.refresh
我使用几系统都B/S结构每登录都需要输入用户名密码觉非麻烦考虑其同事需求妨写自登录程序吧前考虑使用单点登录几经尝试放弃
我习惯使用Java本能始寻找Java解决Google输入Java自登录、Java网页模拟登录、Java Post 登录结倒少内容差我尝试终究没达我预期目标我都知道些代码应该jsp页面执行c/s结构程序执行些代码确实管用
我先析代码
String surl = ""
URL url = new URL(surl)
URLConnection conn = url.openConnection()
conn.setDoOutput(true)
OutputStreamWriter out=new OutputStreamWriter(conn.getOutputStream())
String str = "username=yourname&password=123456"
out.write(str)
out.flush()
out.close()
C/S结构且参数确程序能够功登录oa系统要看结通面代码系统服务器返结System.out.println()
String sling = ""
String scontent = ""
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(),"UTF-8"))
while ((sling = in.readLine()) != null)
scontent += in + "rn"
System.out.println(scontent)
C/S结构控制台输返值返内容看程序已经功登录要网址浏览器打重新登录问题没根本解决恶意注册应该达目
看C/S结构容易实现网页程序自登录除非C/S程序内嵌浏览器直接浏览器自访问系统应该没别主要问题于我没办共享Session
便于共享Session我能浏览器实现网页自登录通面代码jsp页面测试达预期目标
网页自登录希望程序自填充用户名密码Post式提交给登录页面Form所指向action页面或我系统登录页面源代码保存网页usernamepassword文本框设置默认值通网页登录系统测试发现行接能已经想解决
我通url.openConnection()建立连接返scontent打印接着打印代码:
out.println("rn")
原理简单通login.jsp登录页面全部源代码写前页面使用javascript脚本用户名密码值填充提交表单终于实现自登录目标现我通特殊网址例自访问oa
能注意参数url值经加密内容用户名密码加效期即效期内链接才效才实现自登录
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
typedef struct stud //学生信息结构
{
long num
char name[20]
float score
}Stud
typedef struct node
{
Stud student
struct node *next
}Node
Node *head=NULL
void read(void)
void inser(long b)
void print()
void find(long b)
void searchname(char *s)
Node * del(long n)
void sort(int flag)
void menu()
void main()
{
char choose
int flag=1
while (flag)
{
menu()//调用功能菜单函数,显示菜单项。
printf(" 请选择:")
choose=getchar()
switch(choose)
{ 1
case '1': read()//调用建立链表的函数;输出链表信息;
print()
printf("nPress any key Continue ")
//getchar()
getchar()
break
case '2': //调用按学号查找学生信息的函数;并输出查找结果信息;
long c
printf("input the number you want to find:")
scanf("%ld",&c)
find(c)
printf("nPress any key Continue.")
getchar()
break
case '3':
//调用按姓名查找学生信息的函数;并输出查找结果信息;
char s[20]
printf("input the name you want to find:")
scanf("%s",s)
searchname(s)
printf("n Press any key Continue.")
getchar()
getchar()
break
case '4':
//调用根据学号删除某个学生信息的函数;并输出删除后的链表信息;
Node *h
long n
printf("input the number you want to delete:")
scanf("%ld",&n)
h=del(n)
if(h==NULL) printf("No find the student n")
else print()
printf("n Press any key Continue.")
getchar()
getchar()
break
case '5':
//调用插入新的学生信息的函数;并输出插入后的链表信息;
long a
printf("input the number for the new:n")
scanf("%ld",&a)
inser(a)2
print()
printf("n Press any key Continue.")
getchar()
getchar()
break
case '6':
//调用按分数降序排序输出的函数;并输出排序后的链表信息;
sort(1)
print()
sort(0)
printf("nPress any key Continue.")
getchar()
getchar()
break
case '0':
//结束程序运行!
flag=0
printf("n *** The End! ***n")
break
default: printf("n Wrong Selection !(选择错误,重选)n")
getchar()
}
}
}
void menu() //综合作业功能菜单
{
printf(" n 学 生 信 息 管 理 系 统n")
printf(" n 菜 单nn")
printf(" n 1. 建 立 链 表 并 显 示 n")
printf(" n 2. 查 找 某 学 号 的 学 生 信 息 n")
printf(" n 3. 查 找 某 姓 名 的 学 生 信 息 n")
printf(" n 4. 删 除 某 个 学 号 的 学 生n")
printf(" n 5. 插 入 新 的 学 生 信 息 n")
printf(" n 6. 按 分 数 降 序 排 序 输 出 n")
printf(" n 0. 退 出nn")
}
void read(void)
{
long a
printf("input the number:")
scanf("%ld",&a)
while(a>0){ 3
inser(a)
printf("input the number:")
scanf("%ld",&a)
}
}
void inser(long b)
{
Node *last,*current,*p
current=head
while(current!=NULL&&b>current->student.num){
last=current
current=current->next
}
if(current==NULL||b<current->student.num){
printf("input the name,score:")
p=(Node *)malloc(sizeof(Node))
p->student.num=b
scanf("%s%f",p->student.name,&p->student.score)
p->next=NULL
if(current==head){
p->next=head
head=p
}
else{
p->next=current
last->next=p
}
}
else if(b==current->student.num)
printf("error input a different number:")
}
void print()
{
Node *p=head
printf("学号 姓名 成绩:n")
while(p!=NULL){
printf("%ld %s %fn",p->student.num,p->student.name,p->student.score)
p=p->next
} 4
printf("n")
}
void find(long b)
{
Node *p=head
while(p!=NULL&&b!=p->student.num)
p=p->next
if(!p) printf("No foundn")
else {
printf("学号 姓名 成绩n")
printf("%ld %s %fn",p->student.num,p->student.name,p->student.score)
}
}
void searchname(char *s)
{
Node *p=head
int flag=0
printf("学号 姓名 成绩:n")
while(p!=NULL)
{
if(strcmp(p->student.name,s)==0)
{
printf("%ld %s %fn",p->student.num,p->student.name,p->student.score)
flag=1
p=p->next
continue
}
else p=p->next
}
if(!flag) printf("No find")
}
Node * del(long n)
{
Node *p=head,*last
while(p->student.num!=n){
last=p
p=p->next
}
if(p==NULL) return p
else if(p==head) head=p->next
else last->next=p->next5
return head
}
void sort(int flag)
{
Node *p1,*p2,*k
float t1
long t2
char s[20]
for(p1=headp1->nextp1=p1->next)
{
k=p1
for(p2=p1->nextp2p2=p2->next)
if(flag==1&&k->student.score<p2->student.score||!flag&&k->student.num>p2->student.num)
k=p2
if(k!=p1){
t1=p1->student.score
p1->student.score=k->student.score
k->student.score=t1
t2=p1->student.num
p1->student.num=k->student.num
k->student.num=t2
strcpy(s,p1->student.name)
strcpy(p1->student.name,k->student.name)
strcpy(k->student.name,s)
}
}
}
给你看看
以下方法实现了用户界面登陆
import java.awt.*
import java.awt.event.*
public class DengLuJieMian extends frame implements ActionListener
{
Label username=new Label("用户名:")//使用文本创建一个用户名标签
TextField t1=new TextField()//创建一个文本框对象
Label password=new Label("密码:")//创建一个密码标签
TextField t2=new TextField()
Button b1=new Button("登陆")//创建登陆按钮
Button b2=new Button("取消")//创建取消按钮
public DengLuJieMian()
{
this.setTitle("学生信息管理系统")//设置窗口标题
this.setLayout(null)//设置窗口布局管理器
username.setBounds(50,40,60,20)//设置姓名标签的初始位置
this.add(username)// 将姓名标签组件添加到容器
t1.setBounds(120,40,80,20)// 设置文本框的初始位置
this.add(t1)// 将文本框组件添加到容器
password.setBounds(50,100,60,20)//密码标签的初始位置
this.add(password)//将密码标签组件添加到容器
t2.setBounds(120,100,80,20)//设置密码标签的初始位置
this.add(t2)//将密码标签组件添加到容器
b1.setBounds(50,150,60,20)//设置登陆按钮的初始位置
this.add(b1)//将登陆按钮组件添加到容器
b2.setBounds(120,150,60,20)//设置取消按钮的初始位置
this.add(b2)// 将取消按钮组件添加到容器
b1.addActionListener(this)//给登陆按钮添加监听器
b2.addActionListener(this)// 给取消按钮添加监听器
this.setVisible(true)//设置窗口的可见性
this.setSize(300,200)//设置窗口的大小
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0)
}
})//通过内部类重写关闭窗体的方法
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==b1)//处理登陆事件
{
String name=t1.getText()
String pass=t2.getText()
if(name!=null&&pass.equals("000123"))//判断语句
{
new StudentJieMian()
}
}
}
public static void main(String args[])//主函数
{
new DengLuJieMian()
}
}
以下方法实现了学生界面设计
import java.awt.*
import java.awt.event.*
class StudentJieMian extends frame implements ActionListener
{
MenuBar m=new MenuBar()//创建菜单栏
Menu m1=new Menu("信息")//创建菜单“信息”
MenuItem m11=new MenuItem("插入")//创建“插入”的菜单项
MenuItem m12=new MenuItem("查询")
Menu m2=new Menu("成绩")//创建菜单“成绩”
MenuItem m21=new MenuItem("查询")
public StudentJieMian()
{
this.setTitle("学生界面")//设置窗口标题
this.setLayout(new CardLayout())//设置窗口布局管理器
this.setMenuBar(m)//将菜单栏组件添加到容器
m.add(m1)//将信息菜单放入菜单栏
m.add(m2)
m1.add(m11)//将“插入”菜单项添加到“信息”菜单
m1.add(m12)//将“查询”菜单项添加到“信息”菜单
m2.add(m21)//将“查询”菜单项添加到“成绩”菜单
m11.addActionListener(this)//给“插入”菜单项添加监听器
m12.addActionListener(this)//给“查询”菜单项添加监听器
m21.addActionListener(this)//给“查询”菜单项添加监听器
this.setVisible(true)//设置窗口的可见性
this.setSize(300,200)//设置窗口的大小
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0)//关闭窗口
}
})
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==m11) //处理“添加信息”事件
{
new AddStudent()
}
if(e.getSource()==m12) //处理“查询信息”事件
{
new SelectStudent()
}
if(e.getSource()==m21) //处理“查询成绩”事件
{
new ChengJiStudent()
}
}
public static void main(String args[])
{new StudentJieMian() //创建一个对象 }
以上就是关于请问在VF中,制作一个用户名和密码都是123456的教务管理系统的表单登陆界面,确定按钮的代码是什么啊?全部的内容,如果了解更多相关内容,可以关注醉学网,你们的支持是我们更新的动力!