Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

jsp ´«stringÀàÐͲÎÊý

ÎÒµÄÒ»¸öjsp²¿·Ö´úÂ룬ÆäÖÐidÊÇÉÏÒ»¸öÒ³Ãæ´«¹ýÀ´µÄ²ÎÊý£¨Êý¾Ý¿â²éѯµÃµ½µÄ¶¯Ì¬Êý¾Ý£©£º

String id;
try
{
id= request.getParameter("id");
}catch(Exception e){
id="wrong";
}
%>
<%
String DBURL="jdbc:postgresql://localhost/postgres";
String  user="postgres";
String password="postgres";
Connection con=null;
Statement stmt=null;
ResultSet rs=null;
String sqlString1=null;
try{
  Class.forName("org.postgresql.Driver").newInstance();
  con=DriverManager.getConnection(DBURL,user,password);
  }catch(ClassNotFoundException e){
    out.println("ClassNotFoundException:"+e.getMessage());
  }
if(id!="wrong"){
sqlString1="select office_id,company_name,line_1_label_address,line_2_label_address,line_3_label_address,line_4_label_address,line_5_label_address,postal_code,telephone,facsimile,email from xinaddress where company_name="+id;

ÎÒÔËÐÐʱ£¬ÎÒ´ÓÉÏÒ»¸öÒ³Ãæ½øÕâ¸öÒ³ÃæÊ±×ÜÊdzöÏÖ´íÎó£¬
˵
SQL Exception!:ERROR: syntax error at or near "Shipping"
µ«ÊÇÎÒÈç¹û´«µÄ²ÎÊýÊÇintÀàÐÍʱ
ÉÏÃæÓÃ
int id;
try
{
id= Integer.parseInt(request.getParameter("id"));
}catch(Exception e){
id=0;


Ïà¹ØÎÊ´ð£º

jsp ÖÐÂÒÂëµÄ - Java / Web ¿ª·¢

ÎҵĿª·¢µÄƽ̨ÊÇMyeclipes6.0 + tomcat5.x + mysql
ÎÒËùÓеıàÂ뷽ʽ¶¼ÊÇÓõÄUTF-8 
ÎÒÖ»ÓÃÁËStrtus¿ò¼Ü
ÔÚÒ»¸öformÖÐÈçÏÂÓõÄÊÇpostµÄÌá½»·½Ê½£º
 <form class="form" action=&quo ......

¹ØÓÚÔÚJSPÖÐÉÏ´«Í¼Æ¬µÄÏà¹ØÎÊÌâ - Web ¿ª·¢ / ÆäËû

//Óÿͻ§µÄsessionµÄid½¨Á¢Ò»¸öÁÙʱÎļþ£º
//String tempFileName=(String)session.getId();
String tempFileName = (String)session.getId();
//out.println(& ......

jspÒ³ÃæÖÐ×ÖÌå±äÉ«ÎÊÌâ - Java / Web ¿ª·¢

<html><head><title>[@title]</title>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<script language='javascript'>
function diyCheck ......

jsp/servlet,·þÎñÆ÷¶Ë²éѯ¿ÉÒÔ£¬·ÃÎʲéѯ²»¿É¡£

Ò»¸öÃû³Æ,ÐèÒªÊäÈëµÄ£¬Ò»¸öÏÂÀ­²Ëµ¥£¬Ñ¡ÔñµÄ£¬¸ù¾ÝÕâÁ½¸ö½øÐÐÄ£ºý²éѯ¡£ÔÚ·þÎñÆ÷¶ËÎÞÂÛÊäÈëÓë·ñ£¬¶¼Äܵóö²éѯ½á¹û¡£
µ«ÊÇ·ÃÎʵϰ£¬Ö»ÓÐÔÚÊäÈëÃû³ÆµÄʱºò£¬ÔÙÑ¡ÔñÏÂÀ­²Ëµ¥²ÅÄܲéѯ£¬Èô²»ÊäÈëÃû³Æ£¬Ö»Ñ¡ÔñÏÂÀ­²Ëµ ......

Jsp IfÌõ¼þÅжÏÎÊÌâ. - Java / Web ¿ª·¢

ÐÂÊÖ:
tomcat+struts 2.0
jsp Ò³ÃæÖ±½Ó¹ØÁªmodel
ÏÖÔÚÐèÒª¸ù¾Ýmodel(admin)ÀïÃæµÄÒ»¸öitem(id),ÅжÏjspÒ³Ãæ³öÏÖµÄÄÚÈÝ.
´ó¸ÅÁ÷³Ì:
...
<table>
<tr>
<td>
<s:if admin.id is null> ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ