首页 > 代码库 > 蜗牛—JSP学习之JavaBean初识
蜗牛—JSP学习之JavaBean初识
初识:
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href=http://www.mamicode.com/"">>通过HTTP表单中的參数设置JavaBean的属性值
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href=http://www.mamicode.com/"">>有可能在填入中文的时候输出会乱码
能够在.java文件里编写代码
public String getPassword() { try { byte b[] = password.getBytes("ISO-8859-1"); password = new String(b, "UTF-8"); return password; } catch (Exception e) { // TODO: handle exception return password; } }
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。