aspose file tools
The moose likes JSP and the fly likes help me with my compiling jsp files Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "help me with my compiling jsp files" Watch "help me with my compiling jsp files" New topic
Author

help me with my compiling jsp files

ruben chan
Greenhorn

Joined: Apr 26, 2002
Posts: 10
i got difficulty in compiling my jsp files. comiling jsp files is really a troublesome and a hard thing. html codes,javascritp codes and jsp codes all in one page. it's hard for me to find where the errors are.And more worse,i should finish my compiling job in the next two days to meet the deadline.but i still have five jsp files to compile.i wish someone could do me a favor to give me some suggestion on compiling more efficiently.Or somebody would take a look at my jsp code.i will apreciate your help. thank you
happyprince1206@yahoo.com


hello
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8876

Plz send ur jsp code


Groovy
Caven Wang
Ranch Hand

Joined: Jul 07, 2001
Posts: 31
why not try Jbuilder6? It is so swift in compiling a jsp file!


@_@ Life is so nice!
ruben chan
Greenhorn

Joined: Apr 26, 2002
Posts: 10
Thank you for responding.i got errors like this:
/comfirm.jsp:42:
pageContext.write(_jsp_string4, 0, _jsp_string4.length);
^
i use resin.what puzzled me is that i didin't use pageContext.write() method.i guess mage the
<%=....%>equals to this method. i don't know.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8876

plz send the jsp , otherwise it may be difficult to help
Originally posted by ruben_chan:
Thank you for responding.i got errors like this:
/comfirm.jsp:42:
pageContext.write(_jsp_string4, 0, _jsp_string4.length);
^
i use resin.what puzzled me is that i didin't use pageContext.write() method.i guess mage the
<%=....%>equals to this method. i don't know.
ruben chan
Greenhorn

Joined: Apr 26, 2002
Posts: 10
this is one of my jsp files
i use it to check the form which contains
users' login or registering information.
i use parameter type in http-head to identify the
different kind of information.
thank you for your help.

//confirm.jsp
<%@ page contentType="text/html; charset=GBK" %>
<html>
<head>
<title>welcom!</title>
<%@ page language="java"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.lang.*"%>
<%@ page import="beans.SqlCon.*"%>
<%@ page session="true"%>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<jsp:useBean id="dbconnect" scope="page" class="beans.SqlCon"/>
<%
try{
dbconnect.dbConn();
}
catch(SQLException e){
out.println("数据库不能正确打开,请再试一次.");
}
%>
<%
private Boolean isDigit(Char cCheck){
if(('0'<=cCheck)&&(cCheck<='9'))
return true;
else
return false;
}
%>

<%
public boolean IsAlpha(Char cCheck)
{
if ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))
return true;
else
return false;
} %>
<%
private boolean isValid(String info){
for (nIndex=0; nIndex<info.length(); nIndex++)
{
Char cCheck = info.charAt(nIndex);
if ( nIndex==0 && ( cCheck.equals('-') || cCheck.equals('_')) )
return false;
if (!IsDigit(cCheck) && !IsAlpha(cCheck) && !(cCheck.equals('_' )))
return false;
else
return true;
}
}
%>
<%
private boolean checkMail(String mail){
if(mali.indexOf("@")!=-1&&mail.indexOf(".")!=-1){
if ( nIndex==0 && ( cCheck.equals('-') || cCheck.equals('_')) )
return false;
else{
if (IsDigit(cCheck)||IsAlpha(cCheck)&& !(cCheck.equals('_' )))
return true;
else
return false;
}
}
} %>
<%
type=request.getParameter("ty");
if(type.equals("new")){
Strinng id,pwd,gender,mail;
id=request.getParameter("user_id").trim();
pwd=request.getParameter("user_pwd").trim();
rpwd=request.getParameter("user_rpwd").trim();
gender=request.getparameter("radiobutton");
boolean isCorrect=false;
boolean isFilled=false;
if(id!=null&&pwd!=null&&rpwd!=null)
isFilled=ture;
else{ %>
<h2><font color="red">必填字段不能为空</font></h2>");
<jsp:forward page="register.html"/>
<% if(ifFilled)
isFilled=false;
}
if(isFilled){
if(id.length()<=12){
if(isValid(id))
isCorrect=ture;
else {
%>
<p align="center"><font color="red">请勿输入特殊字符</font></p>");
<jsp:forward page="register.html"/>
<%
if(isCorrect)
isCorrect=false;
}
}
else{ %>
<h2 align="center"><font color="#FF0000">用户名的长度须小于12!</font></h2>
<jsp:forward page="register.html"/>
<%
}
}
else{ %>
<h2 align="center"><font color="#FF0000">用户名不能为空!</font></h2>
<jsp:forward page="register.html"/>
<%
if(isCorrect)
iscorrect=false;
}
if(pwd.length()<=8){
if(!pwd.isValid()){
if(isCorrect)
isCorrect=false; %>
<h2 align="center"><font color="#FF0000">密码输入不规范!</font></h2>
<jsp:forward page="register.html"/>
<%
}
}
else{ %>
<h2 align="center"><font color="#FF0000">密码长度须小于等于8位</font></h2>
<jsp:forward page="register.html"/>
<%
}
if(rpwd.length()<=8){
if(!rpwd.isValid()){
if(isCorrect)
isCorrect=false; %>
<h2 align="center"><font color="#FF0000">确认密码输入不规范!</font></h2>
<jsp:forward page="register.html"/>
<%
}
}
else{
if(!(pwd.equals("rpwd"))){
if(isCorrect())
isCorrect=false; %>
<h2 align="center"><font color="#FF0000">两次密码不一样!</font></h2>
<jsp:forward page="register.html"/>
<%
}
}
if(mail!=null){
if(!check_mail()){
if(isCorrect())
isCorrect=false;
%>
<h2 align="center"><font color="#FF0000">邮箱地址格式不正确!</font></h2
><jsp:forward page="register.html"/>
<%
}
}
if(isFilled&&isCorrect){
try{
ResultSet res=dbconnect.query("select *"+"from user_info" + "where user_id=id");
}
catch(Exception e){
out.println("对不起,数据库读取有误,请再试一次.");
}
}
if(res.next()){
res.close(); %>
<p align="center"><font color="red">对不起,这个名字已经存在,请重新注册!</font></p>
<jsp:forward page="register.html"/>
<%
}
else{
try{
int suc=dbconnect.update("insert into user_info(user_id,user_pwd,user_gender)"+"values(id,pwd,gender)" );
}
catch(Excption e){
system.out.println(" 对不起,数据插入有误,请再试一次.");
}
if(suc!=0)
system.out.println("对不起,数据插入有误,请再试一次.");
else{
if(request.getParameter("user_mail")!=null){
mail=request.getParameter("user_mail");
try{
dbconnect.update("insert into user_info(user_mail)"+"values(mail)");
}
catch(Exception e){
system.out.println("对不起,数据插入有误,请再试一次.");
}
}
}
session.setAttribute("userName",id); %>
<%
if(type.equals("old")||type.equals("login")){
String id,password;
id=reguest.getParameter("u_id").trim();
password=request.getParameter("u_pwd").trim();
boolean isFilled=false;
boolean isCorrect=true;
if(id!=null&&password!=null)
isFilled=ture;
else{
if(isFilled())
isFilled=false;%>
<h2 align="center"><font color="#FF0000">必填项不能为空!</font></h2>
<jsp:forward page="register.html"/>
<%}
if(isFilled){
if(id.length()>12||isValid(id)){
if(isCorrect())
isCorrect=false;
%>
<h2 align="center"><font color="#FF0000">用户名输入不正确!</font></h2>
<jsp:forward page="register.html"/>
<%}
if(pwd.length()>8||pwd.isValid("pwd")){
if(isCorrect())
isCorrect=false; %>
<h2 align="center"><font color="#FF0000">密码输入不正确!</font></h2>
<jsp:forward page="register.html"/>
<%
}
if(isFilled&&isCorrect){
try{
ResultSet res=dbconnect.query("select *"+"from user_info"+"where user_id=id");
}
catch(Exception e){
system.out.println("对不起,数据库读取有误,请再试一次.");
}
if(res.next()){
if(password.trim()==res.getString(2)){
session.setAtrribute("userName",id);%>
<jsp:forward page="topic.jsp"/>
<%
}
else{%>
<h1 align="center"><font size="5" color="#FF0000"><b>密码错误,请再来一次</b>!</font></h1>
<jsp:forward page="register.html"/>
<%
}
}
else{ %>
<p align="center"><font size="5" color="#FF0000"><b>这个注册号不存在!</b></font><br>
<jsp:forward page="register.html"/>
<%
}
}
try{
if(res!=null)
res.close();
}
finally{
dbconnect.close();
}
%>
</body>
</html>
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8876

I find that u have declared methods within scriptlets which can't be done u can declare methods only within declaration part.. Declarations begin with <%!. Use <%! before any method declaration...I can see typos also.. u have given Boolean is return type when u have returned boolean from the method ..correct the return type to boolean
[ April 27, 2002: Message edited by: pradeep bhat ]
[ April 27, 2002: Message edited by: pradeep bhat ]
ruben chan
Greenhorn

Joined: Apr 26, 2002
Posts: 10
thank you,i have neglect that declaration must be
start with <!.. and Boolean should be boolean.
however,after i had corrected the error,i still get the same error.
may be i should make a bean to contain all the methods in the jsp page.
Marilyn Monickam
Ranch Hand

Joined: Jun 05, 2001
Posts: 66
Ruban
I found 50 opening braces in your code but only 46 closing braces. That leads to the error.
Marilyn
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
"ruben_chan"
Your name doesn't follow the javaranch guidelines. Please take a moment and change your "Publicly Displayed Name" by modifying your profile, after reviewing the guidelines at http://www.javaranch.com/name.jsp
Thanks for your cooperation.
- madhav


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: help me with my compiling jsp files
 
Similar Threads
Junk characters are displayed on JSP pages
Write a file to client
bbcodes
ANT For C/C++ Compiling ???
running a Tomcat example