易截截图软件、单文件、免安装、纯绿色、仅160KB

Struts html:link 标签的使用

Struts -- html:link 标签的使用
 
<html:link> 标签用于生成HTML <a> 元素。<html:link> 在创建超链接时,有两个优点:
(1) 允许在URL 中以多种方式包含请求参数。
(2) 当用户浏览器关闭Cookie 时,会自动重写URL,把SessionID 作为请求参数包含在URL 中,用于跟踪用户的Session 状态。
<html:link> 标签有以下重要属性:
(1) forward:指定全局转发链接。
(2) href:指定完整的URL 键接。
(3) page:指定相对于当前网页的URL。
        <html:rewrite> 用于输出超链接中的URI部分,但它并不生成HTML <a> 元素。URI指的是URL 中协议、主机和端口以后的内容。URI 用于指定具体的请求资源。例如,对于URL:HTTP://localhost:8080/HtmlBasic.do,它的URI为/HtmlBasic.do
示例:
1、创建全局转发链接
    首先,在Struts-config.xml 中<global-forwards> 元素中定义一个<forward> 元素:
    <global-forwards>
        <forward name = "index" path="/index.jsp"/>
    </global-forwards>
    接着,在JSP 文件中创建<html:link> 标签:
    <html:link forward="index">
        Link to Global ActionForward
    </html:link>
    <html:link> 标签的forward 属性和<global-forwards> 元素中的<forward> 子元素匹配。以上代码生成如下HTML 内容:
    <a href="/index.jsp">Link to Global ActionFoward</a>
    值得注意的是,<html:link> 的forward 属性只引用Struts-config.xml 配置文件中<global-forwards>内的<forward> 子元素,如果引用<action> 内的<forward> 子元素,在运行时将会抛出异常:
    Cannot create rewrite URL: Java.Net.MalfomedURlException: Cannot retrieve ActionForward
2、创建具有完整URL 的链接
    如果Web 应用需要链接到其他站点,应该给出其他站点完整URL,例如:
    <html:link href="http://jakarta.apach


相关文档:

Android的webview加载本地html、本apk内html和远程URL

首先在layout文件夹下的xml中 加入WebView控件
<WebView
android:id="@+id/wv1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
再在主文件中输入如下代码
 
public class TestDemo extends Activity {
/** Called when the activity is first created. */ ......

HTML:MESSAGES,HTML:ERRORS,用法


=======<html:messages>============
Action 中 :
    ActionMessages message = new ActionMessages();
    message.add(" 消息句柄 ",new ActionMessage(" 资源文件中 Key 值 ",String 类型描述信息 ));
    this.addMessages(request,message);
   ......

相对路径/绝对路径(举例一html)


http://localhost:8080/tj16/
"/"代表根目录,"./" 代表当前目录,"../"代表上级目录。
服务器端的相对地址指的是相对于你的web应用的地址,是在服务器端解析的。(http://localhost:8080/tj16/)
html页面中的相对地址都是相对于服务器根目录,是客户端浏览器解析的。(http://localhost:8080/)
webapp tj16
i:/test/t ......

java读取html文件并抽取a href相关连接和链接标题

import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.*;
import java.io.*;
import java.nio.CharBuffer;
public class RegTest
{
    public static void main(String[] args)
    {
        //定义一个文章列 ......

将HTML页面嵌入FLEX应用中

先用现成的组件玩一下,一会再去看看组件源码研究一下。
http://code.google.com/p/flex-iframe/
下载了flexiframe.swc,引入工程。
flex代码
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="absolute"
   ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号