JSP中自定义标签属性配置说明
required 是是否为必选属性
rtexprvalue的全称是 Run-time Expression Value, 它用于表示是否可以使用JSP表达式.
当在<attribute>标签里指定<rtexprvalue>true</rtexprvalue>时, 表示该自定义标签的某属性的值可以直接指定或者通过动态计算指定, example as follow:
<sql:query var="result" >
select * from mytable order by nameid
</sql:query>
<%request.setAttribute("nameid", "2"); %>
<myTag:cupSize cupSize="1" cupSizes="${result}"></myTag:cupSize>
<myTag:cupSize cupSize="${nameid}" cupSizes="${result}"></myTag:cupSize>
当在<attribute>标签里指定<rtexprvalue>false</rtexprvalue>时, 表示该自定义标签的某属性的值只能直接指定, example as follow:
<myTag:cupSize cupSize="1" cupSizes="${result}"></myTag:cupSize>
相关文档:
今天在学习jsp中数据库的使用时,遇到一个很奇怪的情况(至少现在看来是的)。jsp中连接mysql数据库,开启mysql数据库后,在jsp页面中嵌入的java连接mysql数据库的那几句代码。好像 Class.forName("org.gjt.mm.mysql.Driver");没起到作用,只需要Connection con=DriverManager.getConnection("jdbc:mysql://localhost/test? ......
●jsp连接MySQL数据库
testmysql.jsp如下:
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%Class.forName("org.gjt.mm.mysql.Driver").newInstance();
String url ="jdbc:mysql://localhost/softforum?
user=soft&pas ......
由于要做上传 就找了个例子 留着参考
上传:需要smartupload组件
import com.jspsmart.upload.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
/**
* 上传公共类,对SmartUpload进行了封装
* ......
一,纯粹的jsp页面中文乱码
原因:对jsp代码的编写,默认的字符集事“ISO-8859-1”,如果代码中存在中文,则会出现乱码!
解决办法:在page中加上contentType="text/html;charset=gb2312",采用国标来翻译页面中的代码!
二,post方式提交表单出现乱码
原因: ......