| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1247 人关注过本帖
标题:问一个servlet手工编译问题
取消只看楼主 加入收藏
Javapet
Rank: 1
等 级:禁止访问
帖 子:80
专家分:0
注 册:2008-1-5
结帖率:50%
收藏
 问题点数:0 回复次数:1 
问一个servlet手工编译问题
近来学了其他知识,竟然会忘了以前的基础知识,在这请教大家了,有以下三个文件,请问用命令提示符怎么样编译?请写出具体命令,谢谢了
AdmInfo.java  

package com;
public class AdmInfo {
    private String username;
    private String password;
    
    
    public AdmInfo(){
    }
    public AdmInfo(String username, String password) {
        //super();
        this.username = username;
        this.password = password;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    public String getUsername() {
        return username;
    }
    public void setUsername(String username) {
        this.username = username;
    }
    
}


AdminService.java :

package com;
import com.AdmInfo;

public class AdminService {
    public boolean isValidateLogin(AdmInfo adminfo){
        boolean bl = false;
        String uName=adminfo.getUsername();
        String pWord=adminfo.getPassword();
        System.out.println(uName);
        if(uName.equals("admin")&&pWord.equals("123")){
            bl=true;
        }
        return bl;
    }

}


LoginServlet.java :

package com;

import com.AdmInfo;
import com.AdminService;

import

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class LoginServlet extends HttpServlet {
    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        doPost(request,response);
    }
    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        
        String username=request.getParameter("username");
        String password=request.getParameter("password");
        System.out.println("pass");
        AdmInfo adminfo= new AdmInfo(username,password);
        AdminService adminservice= new AdminService();
        boolean bl= adminservice.isValidateLogin(adminfo);
        RequestDispatcher dispatcher=null;
        String path=null;
                
        if(bl){
            request.getSession().setAttribute("userId", username);
            path="/ok.jsp" ;  
           
        }
        else{
            request.setAttribute("status", "<font color=red>用户名或密码错误!请重新输入!</font>");
            path="/login.jsp" ;
        }
        dispatcher=request.getRequestDispatcher(path);
         dispatcher.forward(request, response);
    }
}
搜索更多相关主题的帖子: servlet 手工 编译 
2008-09-27 22:24
Javapet
Rank: 1
等 级:禁止访问
帖 子:80
专家分:0
注 册:2008-1-5
收藏
得分:0 
就只有这一条命令吗?我试过了,不行,我记得好像还有用到classpath servlet-api.jar的
2008-09-29 19:19
快速回复:问一个servlet手工编译问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.035789 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved