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

Struts 2 ʹÓÃXMLÎļþУÑé½Ì³Ì

Struts 2 ʹÓÃXMLÎļþУÑéÀýÌâ
ÔÚÕâ¸öÀý×ÓÖÐÎÒÃǽ«Á˽⵽ÔõôÑùͨ¹ýXMLÎļþÀ´½øÐÐУÑé¡£XMLУÑéÎļþ±ØÐëÒÔ"¶¯×÷(action)Àà-Validation.xml"µÄÐÎʽÃüÃû¡£ÔÚÕâ¸öÀý×ÓÖУ¬¶¯×÷(action)ÀàÃûÊÇ"Login.java"£¬XMLÎļþÃûÊÇ"Login-Validation.xml"¡£
Login-validation.xmlµÄÎļþÄÚÈÝÈçÏ£º
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
<validators>
<field name="userName">
<field-validator type="requiredstring">
<message>User Name is required.</message>
</field-validator>
</field>
<field name="password">
<field-validator type="requiredstring">
<message key="password.required" />
</field-validator>
</field>
</validators>
field±êÇ©ÔªËØ°üº¬ÐèÒªÑéÖ¤µÄ±íµ¥ÊôÐÔÃû¡£field-validator±êÇ©ÔªËØ°üº¬µÄÊÇÐèÒªÖ´ÐеÄУÑéÀàÐÍ¡£
¿ÉÒÔͨ¹ýmessage±êÇ©ÔªËØÖ±½ÓÖ¸¶¨´íÎóÐÅÏ¢£¬Ò²¿ÉÒÔͨ¹ýmessage±êÇ©ÔªËصÄkeyÊôÐÔ£¬½«ÔÚÊôÐÔÎļþÖж¨ÒåµÄ´íÎóÐÅÏ¢Ö¸¶¨µ½Ó¦ÓõĴíÎóÐÅÏ¢ÉÏ¡£
×¢ÒâÊôÐÔÎļþÃûÒªºÍ¶¯×÷(action)ÀàÃûÏàͬ¡£
ÏÂÃæÊÇLogin¶¯×÷(action)µÄÄÚÈÝ£º
public class Login extends ActionSupport {

private String userName;
private String password;
public Login() {
}

public String execute() {
return SUCCESS;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}


ÏÂÃæÊÇlogin.jspÒ³Ãæ°üº¬µÄÄÚÈÝ£º
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Login Page</


Ïà¹ØÎĵµ£º

XMLʵÏÖÒì¹¹Êý¾Ý¿â¼äת»»µÄʵÏÖÓë·ÖÎö£¨×ª£©

XMLÖÐÒ»ÖÖÀ©Õ¹µÄ±ê¼ÇÓïÑÔ,Ëü¾ßÓкܺõÄÀ©Õ¹ÐÔ±ê¼Ç.±¾ÎÄͨ¹ýXMLʵÏÖ²»Í¬Êý¾Ý¿âµÄ¶¨Òå,ʵÏÖ¶ÔXMLÊý¾Ý¿âµÄ·ÃÎʺÍÒì¹¹Êý¾Ý¿âÖ®¼äµÄ»¥·Ã.  
¡¡¡¡¹Ø¼ü´Ê:XML  Òì¹¹Êý¾Ý¿â  ÐÅÏ¢½»»»  Êý¾Ý¿â·ÃÎÊ  
1  ÒýÑÔ  
¡¡¡¡XML(Extensible  Markup  Language)ËüÊÇÓÉW3C×éÖ¯ÓÚ1998Äê2Ô &nb ......

flex ²Ù×÷xml ʵÏÖÔöɾ¸Ä²é

Ïêϸ½éÉÜFlexÖвÙ×÷XML(ÉÏ)
2009Äê12ÔÂ30ÈÕ ÐÇÆÚÈý 12:05
Ò» ÔÚ½éÉÜFlexÖвÙ×÷XML֮ǰ£¬Ê×Ïȼòµ¥½éÉÜÏÂXMLÖеĻù±¾ÊõÓï¡£   
ÔªËØ£ºXMLÖÐÓµÓпªÊ¼±êÇ©ºÍ½áÊø±êÇ©µÄÕâÒ»¿é³ÆΪ“ÔªËØ”   
½Úµã£º°ÑXMLÔªËØÓëÎı¾½áºÏÆðÀ´Í³³ÆΪ½Úµã   
¸ù½Úµã£ºÎ»ÓÚÕû¸öXMLÎÄ ......

FOR XML PATH¾ÙÀý

´ó¼Ò¶¼ÖªµÀÔÚSQL ServerÖÐÀûÓà FOR XML PATH Óï¾äÄܹ»°Ñ²éѯµÄÊý¾ÝÉú³ÉXMLÊý¾Ý£¬ÏÂÃæÊÇËüµÄһЩӦÓÃʾÀý¡£
DECLARE @TempTable table(UserID int , UserName nvarchar(50));
insert into @TempTable (UserID,UserName) values (1,'a')
insert into @TempTable (UserID,UserName) values (2,'b')
 
select UserID, ......

JavaµÄXMLÎļþ²Ù×÷Ö®DOMÈëÃÅƪ £¨1£©

DOM³õ²½
DOMÊÇDocument Object ModelµÄËõд£¬¼´Îĵµ¶ÔÏóÄ£ÐÍ¡£Ç°Ãæ˵¹ý£¬XML½«Êý¾Ý×é֯Ϊһ¿ÅÊ÷£¬ËùÒÔDOM¾ÍÊǶÔÕâ¿ÅÊ÷µÄÒ»¸ö¶ÔÏóÃèÐð¡£Í¨Ë×µÄ˵£¬¾ÍÊÇͨ¹ý½âÎöXMLÎĵµ£¬ÎªXMLÎĵµÔÚÂß¼­ÉϽ¨Á¢Ò»¸öÊ÷Ä£ÐÍ£¬Ê÷µÄ½ÚµãÊÇÒ»¸ö¸ö¶ÔÏó¡£ÎÒÃÇͨ¹ý´æÈ¡ÕâЩ¶ÔÏó¾ÍÄܹ»´æÈ¡XMLÎĵµµÄÄÚÈÝ¡£
ÏÂÃæÎÒÃÇÀ´¿´Ò»¸ö¼òµ¥µÄÀý×Ó£¬¿´¿´ÔÚDOMÖ ......

JavaµÄXMLÎļþ²Ù×÷Ö®DOMÈëÃÅƪ £¨2£©

ÏÂÃæµÄÄÚÈÝ£¬ÎÒÃǽ«¸ü¶àµÄ¹Ø×¢DOM£¬ÎªDOM×÷Ò»¸ö½ÏΪÏêϸµÄ½âÎö£¬Ê¹ÎÒÃÇʹÓÃÆðÀ´¸üΪµÃÐÄÓ¦ÊÖ¡£
DOMÏê½â
1£®»ù±¾µÄDOM¶ÔÏó
DOMµÄ»ù±¾¶ÔÏóÓÐ5¸ö£ºDocument£¬Node£¬NodeList£¬ElementºÍAttr¡£ÏÂÃæ¾ÍÕâЩ¶ÔÏóµÄ¹¦ÄܺÍʵÏֵķ½·¨×÷Ò»¸ö´óÖµĽéÉÜ¡£
Document¶ÔÏó´ú±íÁËÕû¸öXMLµÄÎĵµ£¬ËùÓÐÆäËüµÄNode£¬¶¼ÒÔÒ»¶¨µÄ˳Ðò°üº ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ