J2EE里JSP页面如何执行java代码???

以下是java代码:
package servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.ResultSet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import connect_DB.*
;public class ModifyCompany extends HttpServlet {

public ModifyCompany() {
    super();
}


public void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException 
{
    request.setCharacterEncoding("utf-8");
    String pwd=request.getParameter("pwd");
    String com_name=request.getParameter("com_name");
    String com_introduce=request.getParameter("com_introduce");
    String found_time=request.getParameter("found_time");
    String employee_number=request.getParameter("employee_number");
    String company_address=request.getParameter("address");
    String postcode=request.getParameter("postcode");
    String contact_address=request.getParameter("contact_address");
    String fax=request.getParameter("fax");
    String contact_tel=request.getParameter("contact_phone");
    String email=request.getParameter("email");
    String website=request.getParameter("website");
    String strSql="update E_UserInfo set password='"+pwd+"',company_name='"+com_name+"',company_profile='"+com_introduce+"',found_time='"+found_time+"',NumberOfEmployee='"+employee_number+"',company_address='"+company_address+"',post_code='"+postcode+"',contact_address='"+contact_address+"',fax='"+fax+"',contact_tel='"+contact_tel+"',E_mail='"+email+"',website='"+website+"'";
    ConnectDB cdb=new ConnectDB();
    cdb.doExecute(strSql);
    response.sendRedirect("../company/xgqyxx.jsp");
}

}

就是有修改原有企业信息,它的JSP action是一个.jsp页面,然后在这个页面中调用上面的java,求助!

2

3个回答

1.写一个servlet调用那个java类的main方法。
2.在web.xml种把那个servlet配置为
1

1.写一个servlet调用那个java类的main方法。
2.在web.xml种把那个servlet配置为
〈load-on-startup〉1〈/load-on-startup〉

milaner337
米阑儿 回复479925485: Localstorage.remove(key),可手动删除缓存的
4 年多之前 回复
milaner337
米阑儿 回复479925485: Localstorage.remove(key),可手动删除缓存的
4 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐