JSP语法
我已经会java了,但我还不会jsp呢,就是不知道怎么样写jsp文件呀。请高手指点一下。
------解决方案--------------------网上的例子 很多的 找个例子自己敲一下就ok了
------解决方案--------------------所谓的JSP也就是把HTML,JS,JAVA等套在他的格式里,你可以先把JSP的页面指令啥的看看,然后找点例子做做,有JAVA基础,上手JSP还是比较容易的
------解决方案--------------------页头
<%@ page language= "java " contentType= "text/html; charset=gb2312 " %>
引用错误页
<%@page
errorPage = "/common/error.jsp " %>
使用javabean
<jsp:useBean id= "Pool " scope= "page " class= "test.Hello "/>
导入
<%@page import= "java.sql.* "%>
<%!-声明成员变量-%>
如: <%!String a,b,c%>
<%存放Java代码%>
如: <%
a= "aa "
if( "aa ".equals(a)){
out.println( "ok ");
//注释
}
%>
------解决方案--------------------找个例子,配个服务,一试便知!
------解决方案--------------------给个例子给你 :
<%@ include file= "/lib/shareHeader.jsp " %>
<%@ include file= "/lib/shareDBConnectionPool.jsp " %>
<%@ include file= "/lib/menuBar.jsp " %>
<%@ page import= "com.eleceltek.wf.user.* "%>
<%@ page import= "com.eleceltek.util.FieldData " %>
<script language= "Javascript " src= " <%=DEF_URL_PREFIX%> /lib/javascript.js "> </script>
<script language= "Javascript " src= " <%=DEF_URL_PREFIX%> /lib/validations.js "> </script>
<%
String items=request.getParameter( "items ");
if(items==null || Integer.parseInt(items) <1) items = "2 ";
String mode=request.getParameter( "mode ");
if(mode==null) mode= "new ";
String[] dormno=request.getParameterValues( "dormno ");
String[] address=request.getParameterValues( "address ");
String[] phone=request.getParameterValues( "phone ");
String[] facilities=request.getParameterValues( "facilities ");
String[] remarks=request.getParameterValues( "remarks ");
%>
<script language= 'javascript '>
function addline() {
document.forms[0].items.value=parseInt(document.forms[0].items.value)+1;
document.forms[0].action = "addDorm.jsp ";
document.forms[0].submit();
}
function emailPopup(mypage, myname, inField1, inField2, inField3, inField4, inField5) {
var inVal;
inVal = eval(inField1 + ".value ");
openpage = mypage + "?dormno= " + inVal + "&inField1= " + inField1 + "&inField2= " + inField2+ "&inField3= " + inField3+ "&inField4= " + inField4+ "&inField5= " + inField5 ;
//alert(openpage);
winprops = "height=400,width=500,scrollbars=yes,dependent=yes,resizable=no,toolbar=no,status=Yes,directories=no,menubar=no ";
win = window.open(openpage, myname, winprops);
if (parseInt(navigator.appVersion) > = 4) { win.window.focus(); }
}
</script>
<tr> <td>
<form name= 'addDormForm ' action= 'addDorm_process.jsp ' method= 'post '>
<table width= '750 ' cellpadding= '0 ' cellspacing= '0 '>