??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲经典一区,爱福利视频一区,成人全视频免费观看在线看 http://www.aygfsteel.com/liaojiyong/category/11453.htmlzh-cnSat, 08 Aug 2009 19:39:27 GMTSat, 08 Aug 2009 19:39:27 GMT60Nice Eclipse RCP Application Demohttp://www.aygfsteel.com/liaojiyong/archive/2009/08/07/290191.htmlliaojiyongliaojiyongFri, 07 Aug 2009 01:48:00 GMThttp://www.aygfsteel.com/liaojiyong/archive/2009/08/07/290191.htmlhttp://www.aygfsteel.com/liaojiyong/comments/290191.htmlhttp://www.aygfsteel.com/liaojiyong/archive/2009/08/07/290191.html#Feedback0http://www.aygfsteel.com/liaojiyong/comments/commentRss/290191.htmlhttp://www.aygfsteel.com/liaojiyong/services/trackbacks/290191.html 完整代码附上
下蝲原码




liaojiyong 2009-08-07 09:48 发表评论
]]>
SWT/JFace实践QؓComposited滚动条效果(ScrolledCompositeQ?/title><link>http://www.aygfsteel.com/liaojiyong/archive/2007/10/31/157093.html</link><dc:creator>liaojiyong</dc:creator><author>liaojiyong</author><pubDate>Wed, 31 Oct 2007 01:07:00 GMT</pubDate><guid>http://www.aygfsteel.com/liaojiyong/archive/2007/10/31/157093.html</guid><wfw:comment>http://www.aygfsteel.com/liaojiyong/comments/157093.html</wfw:comment><comments>http://www.aygfsteel.com/liaojiyong/archive/2007/10/31/157093.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.aygfsteel.com/liaojiyong/comments/commentRss/157093.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/liaojiyong/services/trackbacks/157093.html</trackback:ping><description><![CDATA[工作中一个Q务是Z个已l有的Composited滚动条,原以为可以这样实玎ͼ<br />     Composite scrollabledComposite = new Composite(parent, SWT.H_SCROLL | SWT.V_SCROLL);<br />      再设|一下其它的参数可以了Q谁知这h可以d滚动条,但是滚动条里的CompositeҎ不会跟着动;于是Q查APIQ发现有ScrolledCompositeq个c,好家伙,q个c里的注释连main () Ҏ都提供了Q正点! <p>于是Q我的代码如下:</p> <p>       parentComposite.setLayout(new FillLayout());<br />         ScrolledComposite scrolledComposite = new ScrolledComposite(parentComposite,  SWT.H_SCROLL|SWT.V_SCROLL);<br />         <br />         Composite mainComposite = new Composite(scrolledComposite,SWT.NONE);<br />         scrolledComposite.setContent(mainComposite);<br />         mainComposite.setBackground(Display.getCurrent().getSystemColor (SWT.COLOR_WHITE));// White color<br />         mainComposite.setLayout(new GridLayout(1,true));<br />         GridData data = new GridData(GridData.FILL_BOTH);<br />         mainComposite.setLayoutData(data);<br />        </p> <p>        Composite topComposite = new Composite(mainComposite, SWT.BORDER);<br />         topComposite.setLayout(new GridLayout(2, false));<br />         topComposite.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));// White color</p> <p>        reloadBtn = new Button(topComposite, SWT.PUSH);<br />         reloadBtn.setText("&Reload from preferences");<br />         reloadBtn.setToolTipText("Reload values from preference page(Shift+R)");</p> <p>        saveBtn = new Button(topComposite, SWT.PUSH);<br />         saveBtn.setText("&Save to preferences");<br />         saveBtn.setToolTipText("save values to preference page(Shift+S)");<br />         <br />         scrolledComposite.setExpandHorizontal(true);<br />         scrolledComposite.setExpandVertical(true);<br />         scrolledComposite.setMinWidth(800);<br />         scrolledComposite.setMinHeight(400);</p> <p><br />  <span style="color: red">ȝQ?br /> </span> 1Q在为Composited滚动条时Q最上面的Composite的布局需设ؓFillLayout();<br />  2) 不要直接往scrolledComposite上面d控g;<br />  3) 在创建完ScrolledComposite后不要忘C用setContent()Ҏ去设|滚动条所控制的Composite;<br />  4) 最重要的是,Scrolledcomposite的以下四个参数必设|才能出现滚动条Q?br />     scrolledComposite.setExpandHorizontal(true);<br />     scrolledComposite.setExpandVertical(true);<br />     scrolledComposite.setMinWidth(800);<br />     scrolledComposite.setMinHeight(400);<br />     只有前两设为true之后Q后面的两项才v作用?br /> 5Q?对于setMinWidth()和setMinHeight()ҎQAPI的注释中是说用来讄滚动条出现的最宽度和高度Q但是我试了一下,有时出现滚动条了Q?br />     但是拖动滚动条还是不能显CComposite里面的全部内容,于是把setMinWidth()和setMinHeight()讑֤一些就可以了,个h感觉滚动条出现的<br />     宽度和高度检Scrolledcomposite自己已经实现了,q里的宽度和高度是指拖动滚动条里可以看到的Composite的最大宽度和最大高度?/p> <img src ="http://www.aygfsteel.com/liaojiyong/aggbug/157093.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/liaojiyong/" target="_blank">liaojiyong</a> 2007-10-31 09:07 <a href="http://www.aygfsteel.com/liaojiyong/archive/2007/10/31/157093.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>把控制台重定向到GUIlg上(转)http://www.aygfsteel.com/liaojiyong/archive/2007/10/31/157092.htmlliaojiyongliaojiyongWed, 31 Oct 2007 01:04:00 GMThttp://www.aygfsteel.com/liaojiyong/archive/2007/10/31/157092.htmlhttp://www.aygfsteel.com/liaojiyong/comments/157092.htmlhttp://www.aygfsteel.com/liaojiyong/archive/2007/10/31/157092.html#Feedback0http://www.aygfsteel.com/liaojiyong/comments/commentRss/157092.htmlhttp://www.aygfsteel.com/liaojiyong/services/trackbacks/157092.htmlQ没有用log功能。当然这是个不好的习惯?br />    刚开始的时候用Swing做了一个面板,采用JTextPanelg作ؓ打印信息的容器。可能是太久没有用Swing了,在测试的时候这个东西的水^滑动块老是随着信息的显C动地滑向最后的地方Q而且打印信息看v来很凌ؕ。后来就换用SWTQ把打印的信息容器换用TextlgQ把样式定义为SWT.MULT | SWT.V_SCROLL | SWT.WRAP Q让它可以自动换行?br />    查一下JDK的API文档QSystemcL供了可以重定向的ҎsetOut(PrintStream out)、setErr(PrintStream err)、setIn(InputStream in)。在此我们只需求用setOut和setErr够了,q二个方法都要传入一个PrintStreamcd的参敎ͼ只要在调用打C息的前面调用q二个方法重设输出流和错误流可以达到我们的目的。那么我们承PrintStreamc,q把要显CZ息的lg作ؓ参数传入到这个自定义的打印流cM?br />
 1public class MyPrintStream extends PrintStream {
 2
 3    private Text text;
 4    
 5    public MyPrintStream(OutputStream out, Text text) {
 6        super(out);
 7        this.text = text;
 8    }

 9
10    /**
11     * 在这里重?所有的打印Ҏ都要调用的方?br /> 12     */

13    public void write(byte[] buf, int off, int len) {
14        final String message = new String(buf, off, len);
15        
16        /* SWT非界面线E访问组件的方式 */
17        Display.getDefault().syncExec(new Thread(){
18            public void run(){
19                /* 在这里把信息d到组件中 */
20                text.append(message);
21            }

22        }
);
23    }

24    
25}

把组件作为参C入到q个打印中Qƈ重写父类的write(byte[] buf, int off, int len)ҎQ把写出的信息添加到lg上,注意到重载了带OutputStream的构造方法?br />    q里有二点必L意,保lg在调用打C息添加前是已l被正确创徏的,另外必须注册不同GUIlg对线E的讉K形式Q像上面的SWT对界面的访问有严格的规定?br />    完成了PrintStream后,下面是如何用,在我们启动界面后Q用下面的方式Q?
1MyPrintStream mps = new MyPrintStream(System.out, text);
2        System.setOut(mps);
3        System.setErr(mps);

Q这样就可以把原来程序里的所有System.out和System.err信息转移C的GUI界面上?br />

liaojiyong 2007-10-31 09:04 发表评论
]]>
一个ActionDelegate代理多个Action http://www.aygfsteel.com/liaojiyong/archive/2007/10/31/157091.htmlliaojiyongliaojiyongWed, 31 Oct 2007 00:59:00 GMThttp://www.aygfsteel.com/liaojiyong/archive/2007/10/31/157091.htmlhttp://www.aygfsteel.com/liaojiyong/comments/157091.htmlhttp://www.aygfsteel.com/liaojiyong/archive/2007/10/31/157091.html#Feedback0http://www.aygfsteel.com/liaojiyong/comments/commentRss/157091.htmlhttp://www.aygfsteel.com/liaojiyong/services/trackbacks/157091.html
 <viewerContribution
            
id="test.viewerContribution1"
            targetID
="test.testView" >
         
<action
               
class="test.AddTestDelegate"
               id
="add.a"
               label
="A"
               menubarPath
="test"/>
         
<action
               
class="test.AddTestDelegate"
               id
="add.b"
               label
="B"
               menubarPath
="test"/>
         
<action
               
class="test.AddTestDelegate"
               id
="add.c"
               label
="C"
               menubarPath
="test"/>
         
<action
               
class="test.AddTestDelegate"
               id
="add.d"
               label
="D"
               menubarPath
="test"/>
      
</viewerContribution>

    上面的主要区别是在idQ在所有的代理ActionDelegate中的run(IAction action)Ҏ中都带有一个参数actionQ这个参数有个用途就是可以在q行时区别是对应的那个action。下面我们看一下AddTestDelegatecȝ定义Q?br />

 1package test;
 2
 3import org.eclipse.jface.action.IAction;
 4import org.eclipse.jface.viewers.ISelection;
 5import org.eclipse.ui.IViewActionDelegate;
 6import org.eclipse.ui.IViewPart;
 7
 8public class AddTestDelegate implements IViewActionDelegate {
 9
10    private IViewPart view;
11    public AddTestDelegate() {
12        // TODO 自动生成构造函数存?/span>
13    }

14
15    public void init(IViewPart view) {
16        this.view = view;
17
18    }

19
20    public void run(IAction action) {
21        String id = action.getId();
22        
23        if(id.equals("add.a")){
24            //TODO
25        }
else if(id.equals("add.b")){
26            //TODO
27        }
else if(id.equals("add.c")){
28            //TODO
29        }
else if(id.equals("add.d")){
30            //TODO
31        }

32
33    }

34
35    public void selectionChanged(IAction action, ISelection selection) {
36        // TODO 自动生成Ҏ存根
37
38    }

39
40}

    我们可以在运行时通过action.getId()在识别是对应的那个Action?br />    ȝQ这个途径可以为插件开发中避免写过多的ActionDelegateQ把一些功能较为接q实C码又比较的操作合ƈ在一赗当Ӟ对于操作步骤比较多的Qؓ了代码维护的方便Q还是徏议单独ؓ它定义一个代理?br />       



liaojiyong 2007-10-31 08:59 发表评论
]]>
d完整的Eclipse RCP帮助pȝ(?http://www.aygfsteel.com/liaojiyong/archive/2007/10/31/157086.htmlliaojiyongliaojiyongWed, 31 Oct 2007 00:44:00 GMThttp://www.aygfsteel.com/liaojiyong/archive/2007/10/31/157086.htmlhttp://www.aygfsteel.com/liaojiyong/comments/157086.htmlhttp://www.aygfsteel.com/liaojiyong/archive/2007/10/31/157086.html#Feedback0http://www.aygfsteel.com/liaojiyong/comments/commentRss/157086.htmlhttp://www.aygfsteel.com/liaojiyong/services/trackbacks/157086.html     l过一L索,最后终于折腑և来,在这里记录下面,与大家分享。如果你做过RCP产品Q下面这些内容应该很熟悉?br />     1. d帮助的菜单?br />        在ApplicationActionBarAdvisorcM加入帮助菜单V代码片断如下:
      
//帮助
    private IWorkbenchAction helpAction;

    
/**
     * 创徏操作
     
*/
    
protected void makeActions(IWorkbenchWindow window) {
        ....
 
        
/* 帮助 */
        .....
        helpAction 
= ActionFactory.HELP_CONTENTS.create(window);
        register(helpAction);
        .....

     }

    
/**
     * 填充主菜?br />      
*/
    
protected void fillMenuBar(IMenuManager menuBar) {
        
/* 主菜单栏 */
        IMenuManager mainMenu 
= getActionBarConfigurer().getMenuManager();
        
        MenuManager helpMenu 
= new MenuManager("帮助(&H)", IWorkbenchActionConstants.M_HELP);
        helpMenu.add(introAction);
        helpMenu.add(helpAction);
        ....
        
        
        mainMenu.add(helpMenu);
    }
   2.  d相关的依赖项?br />        打开plugin.xmlQ{?依赖?的tab?点击"d"按钮Q需要加入下面的q些依赖:
1. org.apache.lucene
2.
org.eclipse.help.appserver
3.
org.eclipse.help.base
4.
org.eclipse.help.ui
5.
org.eclipse.help.webapp
6.
org.eclipse.tomcat
7.org.eclipse.ui.forms
   
    3. dorg.eclipse.help.toc扩展?br />        q个非常ҎQ{?扩展"tab,点击“d”按钮。网上或是相关的书籍有很多关于添加help内容的介l,Z节省幅Q这里直接添加一个扩展向导来完成。选择"扩展向导"-->"帮助内容"Q确定后可以看到“所有扩?#8221;的列表中多了一个org.eclipse.help.toc扩展Q这里可能需要修改一下,生成的toc.xml和testToc.xml里面的label属性标{不能是qQ不然帮助框架会M出,到时候显CZ出帮助的l织l构?br />        l构如下Q?br />       
<extension
         
point="org.eclipse.help.toc">
      
<toc file="toc.xml"/>
      
<toc
            
file="testToc.xml"
            primary
="true"/>
   
</extension>
   
    4. 部v产品配置
       为您的RCPd一个品配|,打开产品配置~辑器(xxx.productQ,转到"配置"tab,点击“d”Q加入你的插Ӟ然后点击“d必需的插?#8221;,q样?#8220;插g和段”列表会看C的插件以及你的RCP要完整启动的所有必需相关插g。在q里你应该看C在plugin.xml中依赖的那七个help相关的插Ӟ以及一些以nl1l尾的插Ӟq些是语a插g。保存,转到“概述”tab,点击"启动产品"。然后打开“帮助--> 帮助内容”Q就可能看到你的帮助pȝ了?br />     到此一个完整的帮助pȝ完成了。下面是一个截图:
   

liaojiyong 2007-10-31 08:44 发表评论
]]>
SWT实现d栏图标(pȝ托盘Q,带菜单和ToolTip(?http://www.aygfsteel.com/liaojiyong/archive/2007/01/12/93457.htmlliaojiyongliaojiyongFri, 12 Jan 2007 07:33:00 GMThttp://www.aygfsteel.com/liaojiyong/archive/2007/01/12/93457.htmlhttp://www.aygfsteel.com/liaojiyong/comments/93457.htmlhttp://www.aygfsteel.com/liaojiyong/archive/2007/01/12/93457.html#Feedback0http://www.aygfsteel.com/liaojiyong/comments/commentRss/93457.htmlhttp://www.aygfsteel.com/liaojiyong/services/trackbacks/93457.html阅读全文

liaojiyong 2007-01-12 15:33 发表评论
]]>
eclipsepȝ托盘插gEaseTray2.0.0 (?http://www.aygfsteel.com/liaojiyong/archive/2007/01/12/93437.htmlliaojiyongliaojiyongFri, 12 Jan 2007 06:48:00 GMThttp://www.aygfsteel.com/liaojiyong/archive/2007/01/12/93437.htmlhttp://www.aygfsteel.com/liaojiyong/comments/93437.htmlhttp://www.aygfsteel.com/liaojiyong/archive/2007/01/12/93437.html#Feedback0http://www.aygfsteel.com/liaojiyong/comments/commentRss/93437.htmlhttp://www.aygfsteel.com/liaojiyong/services/trackbacks/93437.htmlEaseTray2.0.0Q提供最化到系l托盘、关闭到pȝ托盘的功能?br />snap200606.jpg
启动时自动加载,工具栏按钮切换状态?img height="30" alt="snap200604.jpg" src="http://www.aygfsteel.com/images/blogjava_net/vip01/snap200604.jpg" width="98" border="0" />snap200605.jpg
支持中英文?br />2007010101.jpg2007010102.jpg

下蝲Q?a href="/Files/liaojiyong/EaseTray_2.0.0.v20070101.zip">EaseTray_2.0.0.v20070101.zip

有朋友说q行后会提示
"this chosen operation is not currently available"
?当前操作不可?{?/p>

L?font style="BACKGROUND-COLOR: #ffffff" color="#ff0000">jdk版本>=1.5

本插件已l在
eclipse3.2.1
wtp1.5.2
myeclipse5.1
jdk6
jdk5
环境下测试通过



liaojiyong 2007-01-12 14:48 发表评论
]]>
Myeclipse所有版本注册码的通用法Q{Q?/title><link>http://www.aygfsteel.com/liaojiyong/archive/2006/12/10/86650.html</link><dc:creator>liaojiyong</dc:creator><author>liaojiyong</author><pubDate>Sun, 10 Dec 2006 03:21:00 GMT</pubDate><guid>http://www.aygfsteel.com/liaojiyong/archive/2006/12/10/86650.html</guid><wfw:comment>http://www.aygfsteel.com/liaojiyong/comments/86650.html</wfw:comment><comments>http://www.aygfsteel.com/liaojiyong/archive/2006/12/10/86650.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/liaojiyong/comments/commentRss/86650.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/liaojiyong/services/trackbacks/86650.html</trackback:ping><description><![CDATA[ <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /> <span style="COLOR: #0000ff">import</span> <span style="COLOR: #000000"> java.io.</span> <span style="COLOR: #000000">*</span> <span style="COLOR: #000000">;<br /><img id="Codehighlighter1_37_2240_Open_Image" onclick="this.style.display='none'; Codehighlighter1_37_2240_Open_Text.style.display='none'; Codehighlighter1_37_2240_Closed_Image.style.display='inline'; Codehighlighter1_37_2240_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_37_2240_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_37_2240_Closed_Text.style.display='none'; Codehighlighter1_37_2240_Open_Image.style.display='inline'; Codehighlighter1_37_2240_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span> <span style="COLOR: #0000ff">public</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">class</span> <span style="COLOR: #000000"> Crack </span> <span id="Codehighlighter1_37_2240_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"> <img src="http://www.aygfsteel.com/images/dot.gif" /> </span> <span id="Codehighlighter1_37_2240_Open_Text"> <span style="COLOR: #000000">{<br /><img id="Codehighlighter1_81_648_Open_Image" onclick="this.style.display='none'; Codehighlighter1_81_648_Open_Text.style.display='none'; Codehighlighter1_81_648_Closed_Image.style.display='inline'; Codehighlighter1_81_648_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_81_648_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_81_648_Closed_Text.style.display='none'; Codehighlighter1_81_648_Open_Image.style.display='inline'; Codehighlighter1_81_648_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />   </span> <span style="COLOR: #0000ff">public</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">static</span> <span style="COLOR: #000000"> String convert(String s) </span> <span id="Codehighlighter1_81_648_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"> <img src="http://www.aygfsteel.com/images/dot.gif" /> </span> <span id="Codehighlighter1_81_648_Open_Text"> <span style="COLOR: #000000">{<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />       </span> <span style="COLOR: #0000ff">if</span> <span style="COLOR: #000000"> (s </span> <span style="COLOR: #000000">==</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">null</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">||</span> <span style="COLOR: #000000"> s.length() </span> <span style="COLOR: #000000">==</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">0</span> <span style="COLOR: #000000">)<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />           </span> <span style="COLOR: #0000ff">return</span> <span style="COLOR: #000000"> s;<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />       </span> <span style="COLOR: #0000ff">byte</span> <span style="COLOR: #000000"> abyte0[] </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> s.getBytes();<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />       </span> <span style="COLOR: #0000ff">char</span> <span style="COLOR: #000000"> ac[] </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">new</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">char</span> <span style="COLOR: #000000">[s.length()];<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />       </span> <span style="COLOR: #0000ff">int</span> <span style="COLOR: #000000"> i </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">0</span> <span style="COLOR: #000000">;<br /><img id="Codehighlighter1_288_609_Open_Image" onclick="this.style.display='none'; Codehighlighter1_288_609_Open_Text.style.display='none'; Codehighlighter1_288_609_Closed_Image.style.display='inline'; Codehighlighter1_288_609_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_288_609_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_288_609_Closed_Text.style.display='none'; Codehighlighter1_288_609_Open_Image.style.display='inline'; Codehighlighter1_288_609_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />       </span> <span style="COLOR: #0000ff">for</span> <span style="COLOR: #000000"> (</span> <span style="COLOR: #0000ff">int</span> <span style="COLOR: #000000"> k </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> abyte0.length; i </span> <span style="COLOR: #000000"><</span> <span style="COLOR: #000000"> k; i</span> <span style="COLOR: #000000">++</span> <span style="COLOR: #000000">) </span> <span id="Codehighlighter1_288_609_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"> <img src="http://www.aygfsteel.com/images/dot.gif" /> </span> <span id="Codehighlighter1_288_609_Open_Text"> <span style="COLOR: #000000">{<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />           </span> <span style="COLOR: #0000ff">int</span> <span style="COLOR: #000000"> j </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> abyte0[i];<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />           </span> <span style="COLOR: #0000ff">if</span> <span style="COLOR: #000000"> (j </span> <span style="COLOR: #000000">>=</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">48</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">&&</span> <span style="COLOR: #000000"> j </span> <span style="COLOR: #000000"><=</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">57</span> <span style="COLOR: #000000">)<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />               j </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> ((j </span> <span style="COLOR: #000000">-</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">48</span> <span style="COLOR: #000000">) </span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">5</span> <span style="COLOR: #000000">) </span> <span style="COLOR: #000000">%</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">10</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">48</span> <span style="COLOR: #000000">;<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />           </span> <span style="COLOR: #0000ff">else</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">if</span> <span style="COLOR: #000000"> (j </span> <span style="COLOR: #000000">>=</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">65</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">&&</span> <span style="COLOR: #000000"> j </span> <span style="COLOR: #000000"><=</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">90</span> <span style="COLOR: #000000">)<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />               j </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> ((j </span> <span style="COLOR: #000000">-</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">65</span> <span style="COLOR: #000000">) </span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">13</span> <span style="COLOR: #000000">) </span> <span style="COLOR: #000000">%</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">26</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">65</span> <span style="COLOR: #000000">;<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />           </span> <span style="COLOR: #0000ff">else</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">if</span> <span style="COLOR: #000000"> (j </span> <span style="COLOR: #000000">>=</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">97</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">&&</span> <span style="COLOR: #000000"> j </span> <span style="COLOR: #000000"><=</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">122</span> <span style="COLOR: #000000">)<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />               j </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> ((j </span> <span style="COLOR: #000000">-</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">97</span> <span style="COLOR: #000000">) </span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">13</span> <span style="COLOR: #000000">) </span> <span style="COLOR: #000000">%</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">26</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">97</span> <span style="COLOR: #000000">;<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />           ac[i] </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> (</span> <span style="COLOR: #0000ff">char</span> <span style="COLOR: #000000">) j;<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />       }</span> </span> <span style="COLOR: #000000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />       </span> <span style="COLOR: #0000ff">return</span> <span style="COLOR: #000000"> String.valueOf(ac);<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />   }</span> </span> <span style="COLOR: #000000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" /> <br /> <img id="Codehighlighter1_688_866_Open_Image" onclick="this.style.display='none'; Codehighlighter1_688_866_Open_Text.style.display='none'; Codehighlighter1_688_866_Closed_Image.style.display='inline'; Codehighlighter1_688_866_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /> <img id="Codehighlighter1_688_866_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_688_866_Closed_Text.style.display='none'; Codehighlighter1_688_866_Open_Image.style.display='inline'; Codehighlighter1_688_866_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />   </span> <span style="COLOR: #0000ff">private</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">static</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">int</span> <span style="COLOR: #000000"> hash(String s) </span> <span id="Codehighlighter1_688_866_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"> <img src="http://www.aygfsteel.com/images/dot.gif" /> </span> <span id="Codehighlighter1_688_866_Open_Text"> <span style="COLOR: #000000">{<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />       </span> <span style="COLOR: #0000ff">int</span> <span style="COLOR: #000000"> i </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">0</span> <span style="COLOR: #000000">;<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />       </span> <span style="COLOR: #0000ff">char</span> <span style="COLOR: #000000"> ac[] </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> s.toCharArray();<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />       </span> <span style="COLOR: #0000ff">int</span> <span style="COLOR: #000000"> j </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">0</span> <span style="COLOR: #000000">;<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />       </span> <span style="COLOR: #0000ff">for</span> <span style="COLOR: #000000"> (</span> <span style="COLOR: #0000ff">int</span> <span style="COLOR: #000000"> k </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> ac.length; j </span> <span style="COLOR: #000000"><</span> <span style="COLOR: #000000"> k; j</span> <span style="COLOR: #000000">++</span> <span style="COLOR: #000000">)<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />           i </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">31</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">*</span> <span style="COLOR: #000000"> i </span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000"> ac[j];<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />       </span> <span style="COLOR: #0000ff">return</span> <span style="COLOR: #000000"> Math.abs(i);<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />   }</span> </span> <span style="COLOR: #000000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" /> <br /> <img id="Codehighlighter1_908_1212_Open_Image" onclick="this.style.display='none'; Codehighlighter1_908_1212_Open_Text.style.display='none'; Codehighlighter1_908_1212_Closed_Image.style.display='inline'; Codehighlighter1_908_1212_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /> <img id="Codehighlighter1_908_1212_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_908_1212_Closed_Text.style.display='none'; Codehighlighter1_908_1212_Open_Image.style.display='inline'; Codehighlighter1_908_1212_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />   </span> <span style="COLOR: #0000ff">private</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">static</span> <span style="COLOR: #000000"> String inputString() </span> <span id="Codehighlighter1_908_1212_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"> <img src="http://www.aygfsteel.com/images/dot.gif" /> </span> <span id="Codehighlighter1_908_1212_Open_Text"> <span style="COLOR: #000000">{<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />       BufferedReader bufferedreader </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">new</span> <span style="COLOR: #000000"> BufferedReader(<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />               </span> <span style="COLOR: #0000ff">new</span> <span style="COLOR: #000000"> InputStreamReader(System.in));<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />       String s </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">null</span> <span style="COLOR: #000000">;<br /><img id="Codehighlighter1_1054_1105_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1054_1105_Open_Text.style.display='none'; Codehighlighter1_1054_1105_Closed_Image.style.display='inline'; Codehighlighter1_1054_1105_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1054_1105_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1054_1105_Closed_Text.style.display='none'; Codehighlighter1_1054_1105_Open_Image.style.display='inline'; Codehighlighter1_1054_1105_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />       </span> <span style="COLOR: #0000ff">try</span> <span style="COLOR: #000000"> </span> <span id="Codehighlighter1_1054_1105_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"> <img src="http://www.aygfsteel.com/images/dot.gif" /> </span> <span id="Codehighlighter1_1054_1105_Open_Text"> <span style="COLOR: #000000">{<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />           s </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> bufferedreader.readLine();<br /><img id="Codehighlighter1_1139_1190_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1139_1190_Open_Text.style.display='none'; Codehighlighter1_1139_1190_Closed_Image.style.display='inline'; Codehighlighter1_1139_1190_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1139_1190_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1139_1190_Closed_Text.style.display='none'; Codehighlighter1_1139_1190_Open_Image.style.display='inline'; Codehighlighter1_1139_1190_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />       }</span> </span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">catch</span> <span style="COLOR: #000000"> (IOException ioexception) </span> <span id="Codehighlighter1_1139_1190_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"> <img src="http://www.aygfsteel.com/images/dot.gif" /> </span> <span id="Codehighlighter1_1139_1190_Open_Text"> <span style="COLOR: #000000">{<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />           ioexception.printStackTrace();<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />       }</span> </span> <span style="COLOR: #000000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />       </span> <span style="COLOR: #0000ff">return</span> <span style="COLOR: #000000"> s;<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />   }</span> </span> <span style="COLOR: #000000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" /> <br /> <img id="Codehighlighter1_1257_2238_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1257_2238_Open_Text.style.display='none'; Codehighlighter1_1257_2238_Closed_Image.style.display='inline'; Codehighlighter1_1257_2238_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /> <img id="Codehighlighter1_1257_2238_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1257_2238_Closed_Text.style.display='none'; Codehighlighter1_1257_2238_Open_Image.style.display='inline'; Codehighlighter1_1257_2238_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />   </span> <span style="COLOR: #0000ff">public</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">static</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">void</span> <span style="COLOR: #000000"> main(String args[]) </span> <span id="Codehighlighter1_1257_2238_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"> <img src="http://www.aygfsteel.com/images/dot.gif" /> </span> <span id="Codehighlighter1_1257_2238_Open_Text"> <span style="COLOR: #000000">{<br /><img id="Codehighlighter1_1270_2154_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1270_2154_Open_Text.style.display='none'; Codehighlighter1_1270_2154_Closed_Image.style.display='inline'; Codehighlighter1_1270_2154_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1270_2154_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1270_2154_Closed_Text.style.display='none'; Codehighlighter1_1270_2154_Open_Image.style.display='inline'; Codehighlighter1_1270_2154_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />       </span> <span style="COLOR: #0000ff">try</span> <span style="COLOR: #000000"> </span> <span id="Codehighlighter1_1270_2154_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"> <img src="http://www.aygfsteel.com/images/dot.gif" /> </span> <span id="Codehighlighter1_1270_2154_Open_Text"> <span style="COLOR: #000000">{<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />           System.out.println(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">My Eclipse IDE v9.99 Keygen</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">);<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />           System.out.print(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">License Name : </span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">);<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />           String s </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> inputString();<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />           String licStr </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">YE3MP-999-00-9912310</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">;<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />           String h </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> s.substring(</span> <span style="COLOR: #000000">0</span> <span style="COLOR: #000000">, </span> <span style="COLOR: #000000">1</span> <span style="COLOR: #000000">)<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />                   </span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000"> licStr<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />                   </span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">Decompiling this copyrighted software is a violation of both your license agreement and the Digital Millenium Copyright Act of 1998 (http://www.loc.gov/copyright/legislation/dmca.pdf). Under section 1204 of the DMCA, penalties range up to a $500,000 fine or up to five years imprisonment for a first offense. Think about it; pay for a license, avoid prosecution, and feel better about yourself.</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />                   </span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000"> s;<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />           </span> <span style="COLOR: #0000ff">int</span> <span style="COLOR: #000000"> j </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> hash(h);<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />           String lic </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> s.substring(</span> <span style="COLOR: #000000">0</span> <span style="COLOR: #000000">, </span> <span style="COLOR: #000000">1</span> <span style="COLOR: #000000">) </span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000"> licStr </span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000"> Integer.toString(j);<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />           System.out.println(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">License Key : </span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000"> convert(lic));<br /><img id="Codehighlighter1_2184_2233_Open_Image" onclick="this.style.display='none'; Codehighlighter1_2184_2233_Open_Text.style.display='none'; Codehighlighter1_2184_2233_Closed_Image.style.display='inline'; Codehighlighter1_2184_2233_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_2184_2233_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_2184_2233_Closed_Text.style.display='none'; Codehighlighter1_2184_2233_Open_Image.style.display='inline'; Codehighlighter1_2184_2233_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />       }</span> </span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">catch</span> <span style="COLOR: #000000"> (Exception exception) </span> <span id="Codehighlighter1_2184_2233_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"> <img src="http://www.aygfsteel.com/images/dot.gif" /> </span> <span id="Codehighlighter1_2184_2233_Open_Text"> <span style="COLOR: #000000">{<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />           exception.printStackTrace();<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />       }</span> </span> <span style="COLOR: #000000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />   }</span> </span> <span style="COLOR: #000000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span> </span> <p> </p> <img src ="http://www.aygfsteel.com/liaojiyong/aggbug/86650.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/liaojiyong/" target="_blank">liaojiyong</a> 2006-12-10 11:21 <a href="http://www.aygfsteel.com/liaojiyong/archive/2006/12/10/86650.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>创徏struts1.2 + Hibernate3.0 Web工程(?http://www.aygfsteel.com/liaojiyong/archive/2006/06/14/52842.htmlliaojiyongliaojiyongWed, 14 Jun 2006 12:43:00 GMThttp://www.aygfsteel.com/liaojiyong/archive/2006/06/14/52842.htmlhttp://www.aygfsteel.com/liaojiyong/comments/52842.htmlhttp://www.aygfsteel.com/liaojiyong/archive/2006/06/14/52842.html#Feedback0http://www.aygfsteel.com/liaojiyong/comments/commentRss/52842.htmlhttp://www.aygfsteel.com/liaojiyong/services/trackbacks/52842.html 1. 环境说明

  安装Eclipse和安装MyEclipselg的过E在q里不进行介l。可以参考其它资料完成Eclipse环境的安装与资源的配|?/p>

  接下来的幅给Z个在MyEclipse开发环境下的一个Web工程实例。说明在MyEclipse的集成开发环境下Q如何利用Strutsq行Web工程开发?/p>

例子工程的环境:

Windows 2000 Professional或者更高的版本?br />J2SDK 5.0
Apache Tomcat 5.0
MySQL 4.0.14b
Eclipse-SDK-3.1
MyEclipse 4.0
SQLyog407(可?

2. 例子工程说明

  本例子是利用struts架构Q实现用户logon的Web工程。在q个工程中,用户可以讉K三个面Qindex.jsp、logon.jsp、menu.jsp。他们的关系如下图所C:

 

  其中Q左上角的方框代表strutsl构?WEB-INF/struts-config.xml中定义的Q?lt;global-forwards>Q也是在整个Web工程中,只要有logon的动作发生,都会使画面{Udlogon.jsp。那么处理logon.jsp画面的formbeen是上图上攑֏侧的模块表示的formbean来完成——logonForm?/p>

  LogonFrom处理后会有两个结果,“success”的时候,画面会{Udmenu.jspQ失败的话,回到logon画面?/p>

  在logon画面Q用户需要输入用户名和密码,点击submitQ进行登录认证。输入内容的是在logonForm的bean中检查。判断操作在logonAction的bean中完成,在logonAction的bean中,需要访问MySql数据库的Account表格Q进行用户和密码的查询。查询成功的话,证明用户认证通过?

3. 建立工程

3.1 v创徏新的Web Project

  启动MyEclipseQ通过WizardQ徏立一个Web工程。如下图Q?/p>

 

  点击project后,MyEclipse弹出工程的对话框Q我们在所|列的工E中选中MyEclipse下面的J2EE Projects的Web Project。如下图所C:

 

  在Wizard的下一,必要的输入信息是Project Name、Context root URL。最后点击finishQ一个空的WebProject已l徏立v来了

3.2 加蝲Struts

  在新创徏的Web Project中加载struts?/p>

  在MyEclipse集成开发环境下Q已l集成了struts开发的环境Q用户可以根据自q实际需要,加蝲struts的环境。加载过E如下图Q?/p>

 

  右键点击刚刚创徏好的工程Q点击MyEclipse属性,在扩展的右键菜单里面Q选择Add Struts Capabilities?/p>

  MyEclipse集成环境׃自动Struts所需要的目录l构q行创徏Qƈ需要的环境资源自动引用到相应的目录中去?/p>

  我们q要对自动生成的Strutsq行修正Q首先,修改WEB-INF/web.xml ?lt;web-app>标签中的属性删除?lt;web-app XXXXXXXXXXXXXXX> -> <web-app>

  其次要添加本工程的标{֮义库Q添?lt;taglib></taglib>
<taglib>
    <taglib-uri>/WEB-INF/app.tld</taglib-uri>
    <taglib-location>/WEB-INF/app.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-bean.tld
</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-html.tld
</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-logic.tld
</taglib-location>
  </taglib>

4. 完善工程

4.1 dindex画面

  在加载完Strutsl构之后Q就可以在这个工E中d内容了。我们可以添加一个画面JSP。添加JSP很简单,点击工程的右键,dJSP。Wizard会弹Z个添加的对话框。如下图Q?

 

  在File Name栏中改变文g名称Q改成index.jsp把这个jsp作ؓWeb工程的第一个画面?/p>

  Template To Use 栏可以选择W五(选择选择其他也可以Q?/p>

  对于新生成的jsp文gq行必要的修攏V?/p>

Index.jsp文gQ?br /><taglib>
<%@ page language="java" pageEncoding="UTF-8"%>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'index.jsp' starting page</title>
   
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="
keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
   
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
  </head>
 
  <body>
  <h3><bean:message key="index.heading"/></h3>
<html:link page="/logon.jsp"><bean:message key="index.logon"/></html:link>

</body>
</html>

 其中蓝色和橙色部分是修改的内容,蓝色部分是今后自动添加jsp文g必须修改的地方,让这个页面用到的tag都能在这个工E中定义的tag集合中找到?/p>

  色部分是画面的主要昄内容?lt;h3></h3>的内Ҏ一D|本,内容被strutsl构的静态文本集合中的index.headingl替换掉了。这个文本的内容可以在工E的src\com\yourcompany\struts\ApplicationResources.properties文g中找到。Strutsl构推荐用户页面上的静态文本用ApplicationResources的Ş式替换。这样可以在大量的维护页面文字时候,感到便捷很多Q同Ӟ也大大减M多国语言版本|页的维护?/p>

  <html:link page="/logon.jsp">相当于html语言中的<a herf=xxxxx>。这个tag是在/WEB-INF/struts-html.tld中可以找到ƈ在显C页面的时候,被{义成<a herf=xxxxx>

4.2 dlogon画面

  dҎ跟添加index画面相同。修改内容稍微有些差别?/p>

Logon.jsp的内容:

<taglib>
<%@ page language="java" pageEncoding="UTF-8"%>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
  <head>
    <html:base />
   
    <title>logon.jsp</title>
   
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">   
    <meta http-equiv="keywords"
content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
  </head>
 
  <body>
    <html:form action="/logon.do" method="post"  focus="userName">
      <table border="0">
        <tr>
          <td><bean:message key="prompt.username"/></td>
          <td><html:text property="userName" /></td>
        </tr>
        <tr>
          <td>Password:</td>
          <td><html:password property="password" /></td>
        </tr>
        <tr>
          <td colspan="2" align="center"><html:submit /></td>
        </tr>
      </table>
    </html:form>
  </body>
</html:html>

  其中Q蓝色部分是引用本工E的tag标示库,U色的部分是表单属性名U的修改Q和指定action动作的名U?/p>

4.3 修改WEB-INF/struts-config.xml

  画面上出CformQ那么根据struts的结构要求,必dWEB-INF/struts-config.xml中明这个form的formbeanQ表单内Ҏ验的java classQ是什么。执行这个form的actionQ表单执行的内部逻辑Q是什么,以及action的结果会产生怎样的画面迁UR这些都是在WEB-INF/struts-config.xml中定义的。也是标准的MVC架构所要求的?
<taglib>
<struts-config>
  <form-beans >
    <form-bean name="logonForm" type="com.yourcompany.forms.
LogonForm" />
  </form-beans>


  <global-forwards >
    <forward name="logon" path="/logon.jsp" />
  </global-forwards>


  <action-mappings >
    <action
      path="/logon"
      type="com.yourcompany.actions.LogonAction"
      name="logonForm"
      scope="request"
      input="/logon.jsp">
      <forward name="success" path="/menu.jsp" />
      <forward name="fails" path="/logon.jsp" />
    </action>
  </action-mappings>

  <message-resources parameter="com.yourcompany.struts.
ApplicationResources" />
</struts-config>

  其中<action>部分是说明action的属性?/p>

  Path 指定Action处理的URL

  Type 指定Action的类?/p>

  Name 指定Actiond的ActionForm名,?lt;form-beans >元素的name属性匹配?/p>

  Scope 指定ActionForm存在的范?/p>

  Input 指定包含客户提交表单的网,如果ActionForm的ValidateҎq回错误Q则因该把用戯求{发到q个|页?/p>

  Validate 如果取gؓtrueQ则表示ActionServlet应该调用ActionForm的validateҎ

  Forward 是Action的executeҎ执行完毕后,把客戯求在转发l相应的面?/p>

4.4 dformbean和actionbean

  dҎ跟JSP相同Q但是在选择superclass的时候,formbean要选择ActionForm作ؓcȝ父类。Actionbean的父cLAction

  下面是各自的代码

LogonForm.java文g内容:

<taglib>
package com.yourcompany.forms;
import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

public class LogonForm extends ActionForm {

private static final long serialVersionUID
= 7322786881443789688L;
// ------------------------------
--------------------------- Instance Variables
    private String username = null;
    private String password = null;

// -------------------------
-------------------------------- Methods
    public String getUserName() {
return (this.username);
    }

    public void setUserName(String username) {
        this.username = username;
    }

    public String getPassword() {
return (this.password);
    }

    public void setPassword(String password) {
        this.password = password;
    }

public void reset(ActionMapping mapping,
HttpServletRequest request) {
this.password = null;
this.username = null;
}

}

LogonAction.java文gQ?br />package com.yourcompany.actions;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.yourcompany.forms.LogonForm;

public class LogonAction extends Action {

public ActionForward execute(ActionMapping
mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {

String userName = null;
String password = null;

if (form != null) {
userName = ((LogonForm) form).getUserName();
password = ((LogonForm) form).getPassword();
}
if(userName.equals(“test1? && password.
equals(“test1?){
return (mapping.findForward("success"));
}
else{
return (mapping.findForward("fails"));
}
}

}

4.5 dmenu画面

  与添加index画面的方法相同。下面是menu.jsp文g的内?br />
<taglib>
<%@ page language="java" pageEncoding="UTF-8"%>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
  <head>
    <html:base />
        <title>menu.jsp</title>
        <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">   
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
  </head>
    <body>
  <h3><bean:message key="menu.message"/></h3>
  </body>
</html:html>

5. 调试工程

如果本地机器已经安装了Tomcat5Q那么可以在MyEclilpse的环境下调试工程了?/p>

指定Tomcat5 的web application service 如下图:

 

Enable选项打开Qƈ且指定Tomcat的安装目录?/p>

配置目前的工E到Tomcat中去?/p>

 

炚w工h上的被红U圈出的按钮

在弹出来的对话框中选择Q我们创建的工程Q和dTomcat5 的web application service

 

然后可以按下工h上的启动服务按钮Q调试这个Web工程了?/p>

 

每一ơ改动工E中的文件后Q要想看看改动后的效果,那么在配置工程中,重新发布q个工程到tomecat5厅R?/p>

6. Tomcat下如何配|mysql的数据库q接?/strong>

6.1 配置server.xml

配置Tomcat的server.xml文gQ\径:【TOMCAT_HOME】\common\lib下的server.xml文g?lt;/host>之前加入以下内容以添加JNDI数据源:

<taglib>
<Context path="/DBTest" docBase="DBTest"
        debug="5" reloadable="true" crossContext="true">
  <Logger className="org.apache.catalina.logger.FileLogger"
             prefix="localhost_DBTest_log." suffix=".txt"
             timestamp="true"/>
  <Resource name="jdbc/TestDB"
               auth="Container"
               type="javax.sql.DataSource"/>
  <ResourceParams name="jdbc/TestDB">
    <parameter>
      <name>factory</name>
    <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>
    <!-- Maximum number of dB connections in pool. Make sure you
         configure your mysqld max_connections large enough to handle
         all of your db connections. Set to 0 for no limit.
         -->
    <parameter>
      <name>maxActive</name>
      <value>100</value>
    </parameter>
    <!-- Maximum number of idle dB connections to retain in pool.
         Set to 0 for no limit.
         -->
    <parameter>
      <name>maxIdle</name>
      <value>30</value>
    </parameter>
    <!-- Maximum time to wait for a dB connection to become available
         in ms, in this example 10 seconds. An Exception is thrown if
         this timeout is exceeded.  Set to -1 to wait indefinitely.
         -->
    <parameter>
      <name>maxWait</name>
      <value>10000</value>
    </parameter>
    <!-- MySQL dB username and password for dB connections  -->
    <parameter>
     <name>username</name>
     <value>root</value>
    </parameter>
    <parameter>
     <name>password</name>
     <value> </value>
    </parameter>
    <!-- Class name for mm.mysql JDBC driver -->
    <parameter>
       <name>driverClassName</name>
       <value>org.gjt.mm.mysql.Driver</value>
    </parameter>
    <!-- The JDBC connection url for connecting to your MySQL dB.
         The autoReconnect=true argument to the url makes sure that the
         mm.mysql JDBC Driver will automatically reconnect if mysqld closed the
         connection.  mysqld by default closes idle connections after 8 hours.
         -->
    <parameter>
      <name>url</name> <value>jdbc:mysql://192.168.0.208:3306
/db_test_account?autoReconnect=true</value>
    </parameter>
  </ResourceParams>
</Context>

注意:

*其中蓝色字体表示你这个应用的路径和别?也就是你讉K自己配置的这个web站点的名?注意区分大小?必须一?否则pȝ无法正常q行(?http://localhost:8080/DBTest)

*其中U色字体表示数据源的名字,注意会被web.xml和你讉K数据库的E序调用

6.2 配置web.xml

配置Web用程序的web.xml文g

<taglib>
<?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app PUBLIC
    "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
  <description>MySQL Test App</description>
  <resource-ref>
      <description>DB Connection</description>
      <res-ref-name>jdbc/TestDB</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
  </resource-ref>
</web-app>

6.3 讉K数据库的E序片段

<taglib>
package swt.db.DBUtility;

import javax.naming.*;
import javax.sql.*;
import java.sql.*;

public class DBTest {

  String foo = "Not Connected";
  int bar = -1;
    
  public void init() {
    try{
      Context ctx = new InitialContext();
      if(ctx == null ) 
          throw new Exception("Boom - No Context");
      DataSource ds = 
            (DataSource)ctx.lookup(
               "java:comp/env/jdbc/TestDB");
      if (ds != null) {
        Connection conn = ds.getConnection();     
        if(conn != null)  {
            foo = "Got Connection "+conn.toString();
            Statement stmt = conn.createStatement();
            ResultSet rst = 
                stmt.executeQuery(
                  " select UserName from t_account ");
            if(rst.next()) {
               foo=rst.getString(1);
               bar=208;
            }
            conn.close();
        }
      }
    }catch(Exception e) {
      e.printStackTrace();
    }
}
public String getFoo() { return foo; }
public int getBar() { return bar;}
}

6.4 Jsp面(index.jsp)

<taglib>
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import ="swt.db.DBUtility.*" %>
<html>
  <head>
    <title>DB Test</title>
  </head>
  <body>
  <%
    DBTest tst = new DBTest();
    tst.init();
  %>
  <h2>Results</h2>
    Foo <%= tst.getFoo() %><br>
    Bar <%= tst.getBar() %>
  </body>
</html>

启动Tomcat在浏览器上输?a href="http://localhost:8080/DBTest" target="_blank">http://localhost:8080/DBTest

备注Q?/p>

q接池配|?Database Connection Pool (DBCP) Configurations)
DBCP使用的是Jakarta-Commons Database Connection Pool 要用连接池需要如下的lg即jar文g

Jakarta-Commons DBCP 1.1 对应commons-dbcp-1.1.jar?br />Jakarta-Commons Collections 2.0 对应commons-collections.jar?br />Jakarta-Commons Pool 1.1 对应commons-pool-1.1.jar?br />q三个jar文g要与你的JDBC驱动E序一h到【TOMCAT_HOME】\common\lib目录下以便让tomcat和你的web应用都能够找到?br />7. Tomcat5.0下配|Hibernate3.0应用

7.1 在Tomcat下徏立数据库q接池,?中所C?/strong>

7.2 在Struts应用中添加Hibernate3.0支持

 

 

 

注意Qhibernate.cfg.xml文g一定要存放到跟目录下,默认的也是/web应用/src,q个部vq个应用的时候hibernate.cfg.xml才会出现在classes目录下,也就是hibernate存放配置文g的默认录入下.

 

׃我们采用Tomcat提供的数据库q接池,所以这里我们将是用自己创徏的SessionFactorycR点d成MyEclipse会自动把Hibernate所需的的cd加入到当前应用中。接下来是配置Hibernateq接数据库的所需的参敎ͼ以及性能参数Q可选)?

 

既然我们选用应用服务器所提供的数据库q接池,那么在这里我们只要指定数据源的名字Qjava:comp/env/jdbc/TestDBQ其中jdbc/TestDB是我们在Tomcat中配|的数据源,也就是我们上面提到的jdbc/TestDBQ资源名UC定要匚w。其他的参数׃已经在Tomcat中配|过了,所以在q里׃用配|了QDialect一定要指定跟我们数据库匚w的语a?既然我们选用应用服务器所提供的数据库q接池,那么在这里我们只要指定数据源的名字Qjava:comp/env/jdbc/TestDBQ其中jdbc/TestDB是我们在Tomcat中配|的数据源,也就是我们上面提到的jdbc/TestDBQ资源名UC定要匚w。其他的参数׃已经在Tomcat中配|过了,所以在q里׃用配|了QDialect一定要指定跟我们数据库匚w的语a?/p>

 

我们可以在这里配|Hibernate一些调整性能的参敎ͼ针对不同的数据库有些属性可能无效)?

 

在这里我们设|show_sql为trueQ这样在开发调试过E成控制台可以打印真正在数据库端执行的sql语句便于查找问题。其他一些属性可以参?a target="_blank">http://www.hibernate.org?br />到这里Hibernate的配|已l基本完成,下面创徏SessionFactory用来和数据库q行交互QHibernate官方文档提供Q?
package com.db;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HibernateUtil {

    private static Log log =
LogFactory.getLog(HibernateUtil.class);

    private static final SessionFactory sessionFactory;

    static {
        try {
            sessionFactory = new Configuration().configure().
buildSessionFactory();
        } catch (Throwable ex) {
            log.error("Initial SessionFactory
creation failed.", ex);
            throw new ExceptionInInitializerError(ex);
        }
    }

    public static final ThreadLocal session = new ThreadLocal();

    public static Session currentSession()  {
        Session s = (Session) session.get();
        if (s == null) {
            s = sessionFactory.openSession();
            session.set(s);
        }
        return s;
    }

    public static void closeSession() {
        Session s = (Session) session.get();
        if (s != null)
            s.close();
        session.set(null);
    }
}

后面会提到如何使用HibernateUtil,下面建立我们所需的数据库
Q略Q我们可以?08上的db_test_accountq个数据库中的表message来测试我们的Hibernate配置是否成功。数据库样例Q?

语句Q?

CREATE TABLE `message` (              
           `Id` varchar(50) NOT NULL default '0',   
           `text` varchar(50) default NULL,    
           `nextMessage` int(4) default NULL,  
           PRIMARY KEY  (`Id`)                 
          ) TYPE=MyISAM

创徏O/R Mapping:

 

点击Edit

 

点击NewdMySQL的驱动,保存

 

ȀzDatabase ExplorerQ保存?

选择Database ExplorerQ创建数据库链接Q?

点击创徏新的数据?d所需必要的参?

 

保存Q然后右键点击该数据库选择open databaseQ测试是否配|成功,如果不能q接查看该连接的配置参数?br />

 

 

点击完成后MyEclipse会自动生成POJO和Map文gQƈ更新Hibernate的配|文Ӟ主要是加载Map文gQ。ID Generator选项可以Ҏ你的需要进行选择Q具体含义请参阅hibernate官方文档。下面徏立一个测试用的jsp面来看看Hibernate是否好用?br />//MyJsp.jsp

<%@ page language="java" import="com.db.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+":
//"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
   
    <title>My JSP 'MyJsp.jsp' starting page</title>
   
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="
keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
   
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
  </head>
 
  <body>
    <%   
org.hibernate.Session s = HibernateUtil.currentSession();
String hql = " from Message where text='b'";
try {
org.hibernate.Query query = s.createQuery(hql);
java.util.List msgList = query.list();
hello.Message msg = (hello.Message) msgList.get(0);
out.println(msg.getId());
out.println(msg.getText());
out.println(msg.getNextmessage());
} catch (org.hibernate.HibernateException e) {
e.printStackTrace();
}
HibernateUtil.closeSession();
    %>
  </body>
</html>

正常的结果如下:

 



liaojiyong 2006-06-14 20:43 发表评论
]]>
Eclipse 3 插g大全http://www.aygfsteel.com/liaojiyong/archive/2006/05/24/47776.htmlliaojiyongliaojiyongWed, 24 May 2006 02:58:00 GMThttp://www.aygfsteel.com/liaojiyong/archive/2006/05/24/47776.htmlhttp://www.aygfsteel.com/liaojiyong/comments/47776.htmlhttp://www.aygfsteel.com/liaojiyong/archive/2006/05/24/47776.html#Feedback0http://www.aygfsteel.com/liaojiyong/comments/commentRss/47776.htmlhttp://www.aygfsteel.com/liaojiyong/services/trackbacks/47776.html1.MyEclipse  J2EE开发插Ӟ支持SERVLET/JSP/EJB/数据库操U늭
www.myeclipseide.com
 
2.Properties Editor  ~辑java的属性文Ӟq可以自动存盘ؓUnicode格式
http://propedit.sourceforge.jp/index_en.html
 
3.Colorer Take  Z癄cd的文件按语法着?br />http://colorer.sourceforge.net/
 
4.XMLBuddy ~辑xml文g
www.xmlbuddy.com
 
5.Code Folding  加入多种代码折叠功能Q比eclipse自带的更多)
http://www.coffee-bytes.com/servlet/PlatformSupport
 
6.Easy Explorer  从eclipse中访问选定文g、目录所在的文g?br />http://easystruts.sourceforge.net/
 
7.Fat Jar 打包插gQ可以方便的完成各种打包dQ可以包含外部的包等
http://fjep.sourceforge.net/
 
8.RegEx Test 试正则表达?br />http://brosinski.com/stephan/archives/000028.php
 
9.JasperAssistant 报表插gQ强Q要qQ?br />http://www.jasperassistant.com/
 
10.Jigloo GUI Builder QAQӞ的GQテ~辑插g
http://cloudgarden.com/jigloo/
 
11.Profiler 性能跟踪、测量工P能跟t、测量Q程?br />http://sourceforge.net/projects/eclipsecolorer/
 
12.AdvanQas 提供对if/else{条件语句的提示和快捷帮助(自动更改l构{)
http://eclipsecolorer.sourceforge.net/advanqas/index.html
 
13.Log4E     Log4j插gQ提供各U和Log4j相关的Q务,如ؓҎ、类d一个logger{?br />http://log4e.jayefem.de/index.php/Main_Page
 
 
15.Implementors   提供跌{C个方法的实现c,而不是接中的功能Q实?Q?br />http://eclipse-tools.sourceforge.net/implementors/
 
16.Call Hierarchy 昄一个方法的调用层次Q被哪些Ҏ调,调了哪些ҎQ?br />http://eclipse-tools.sourceforge.net/call-hierarchy/index.html
 
17.EclipseTidy 查和格式化HTML/XML文g
http://eclipsetidy.sourceforge.net/
 
18.Checkclipse 查代码的风格、写法是否符合规?br />http://www.mvmsoft.de/content/plugins/checkclipse/checkclipse.htm
 
19.Hibernate Synchronizer Hibernate插gQ自动映等
http://www.binamics.com/hibernatesync/
 
20.VeloEclipse  Velocity插g
http://propsorter.sourceforge.net/
 
21.EditorList   方便的列出所有打开的Editor
http://editorlist.sourceforge.net/
 
22.MemoryManager 内存占用率的监视
http://cloudgarden.com/memorymanager/




插g列表|站

  • http://www.eclipse-plugins.info/eclipse/index.jsp
Eclipse 正牌插g专门|站Q有插g分类Qtop ratedl计Q以及用户反馈信息?q些_你少走弯路,最快地扑ֈ最好胜的插件了?

推荐插g

?Struts Applications 子项目下Q有人整理了q个东东。即它把 eclipse 常用的开源工h包了Q不需要自己再ȝd装整理了。真的工作? sf.net 的一个旨在开?eclipse 插g的项目?有几个小巧实用的工具了?虽小Q但看v来的实用。比如,你想看看某个cL者方法的实现Q一般是 ctrl Q?左键 Q点d打开q个cL者方法?但如果是接口Ӟ只是到达接口而已Q不能解决问题。我实际应用q程中就遇到q个问题?没有惛_有真的做了q个插g?

J2EE


支持对于 Struts, JSF, Spring, Hibernate

http://www.exadel.com/images/pages/E4W/struts-diagram.gif

J2EE 开发中用得最火的插gQ关键是更新速度很快Q基本上 eclipse IDE 有新版本Q几天之内他可?release 版本。新版本功能也改q不,现在也可以直接在 JSP 中显C标{提示了,甚至语法错误提示。(我一直用q个Q?
随着eclipse的发展,现在的LOMBOZ插g来大了。但是速度成了主要的问题。和Myeclipse、IBM的Eclipse Web Tools Platform相比QLOMBOZ的技术有点落后了。Myeclipse是把整个目的JSP先编译了Q而IBM也是W一ơ把所有的JSP加入索引。虽然每ơ打开的时候,也慢一些,但是q不随着工程的变大,而出现速度成反比的现象。现在用lomboz 打开一个大的项目中的JSP文g的话Q一般h已经受不了它的速度了?

q个l对是一个重量的J2EE的插Ӟ很多论坛上都有它的介l,在此也不多说了。只说几个与众不同的地方Q它是一个唯一打开JSPQ能解释里面的JAVAQHTMLQCSSQJSQTLD的编辑器Q也是唯一能支持JAVA里的CTRL+鼠标单击打开相应c,鼠标停住昄JAVADOC的编辑器。IBM的东西确实不同凡响,是体积大了些,不但用到EMFQ而且q用GEFQXSD{项目,至于里面的XML可视化编辑,WEB SERVICE.....偶也用不着Q幸好也有这样一位大侠LonsenQ在此表C感谢)爱好和偶一P把这个插件减肥了?a class="external" >Eclipse Web Tools Platform减肥?/a> q样改过之后Q这个插件又FREEQ又强大Q速度比LOMBOZ快,首先推荐Q?b>l绝对对?星Q!Q?/b>快快DOWN下来Q加入自qeclipse插g宝库?

虽然 MyEclipse 是个死要q东东Q不q功能确实是不赖啊,其让我无法放手的就是那个自动发布功能,随手保存Q随时发布。这个发布可不是 ant 的那U整站发布,而是针对某些cL?jsp q行发布Q虽说只是一个简单的 copyQ可实方便了很多?br />里面使用的QL~辑器,XML MEN也可以说是一个精品的插gQ但是在当前的XML插g满天飞的情况而言Q优点也不多了。不q,那个 struts 支持倒是使用了这个功能,它不但把 easyStruts 集成q来Q而且q加入了囑ŞQ流E)化struts-config.xml的功能,q支持除错的功能Q这个功能虽然不E_Q但是必竟支持这个功能的插g也仅此一位呀?

如果除其不稳定因素外Q这个STRUTS插g已经是最好用的插件之一了,不但保持了,xsltq个目录的模版文件的支持Qpreferences.iniq个配置文g可以修改生成文g的目录,q些easySTRUTS原有的优点以外,而且在稳定性上也有了明昄改善Q?b>只是q个插g唯一让你受不了的是Q它必须使用它自w带的GEF插g?/b>Q而且你还不能安装比它新的GEF的插ӞQ!q意味着如果你的其它插gQ想使用GEF的话Q能利用它的版本的,q它的版本Q不Ӟ意味着你永q不能用其它用GEF的插ӞQ!

2004q?0月现在的事情变化太快了昨天刚刚不能用的功能可能今天就实现?现在的Myeclipse里面的STRUTS的功能也真的是太强大?我所知道的STRUTScȝ插g应该h的功?它几乎都有了!
现在Myeclipse3.8.2全面集IBM的J2EE插g所以主要的自己的品就那个STRUTS的图形化功能?q回l过l致的加工后无论在界面上q是在功能上都可以说是第一的了只是其附带的JSP的预览的功能好象q是好些问题和WSAD相比好象是有Ҏ土不服比竟IBM的这套工具强大而又不易于操作。下面就是这个插件的美样子 PL的一塌糊?

http://www.myeclipseide.com/modules/ContentExpress/img_repository/docs/sm_overview.gif

Struts

最老牌?Struts 插g了,支持的^台很多。同时支持eclipse2.1?.0!!!而且一直在l护更新。我q是认ؓ它是最好用?Struts 插g。新版本也支?Eclipse IDE 的最新版本。其实对?Struts 关键是完善地支持配置文g地图形化够了,其他关系不大。这个东东对Struts配置文g支持得很完善。另外他也可以相对独立地作ؓ一个程序运行,我现在是q种方式在用它?
  • 不得不提的easy STRUTS
几乎所有的|站说到STRUTS插g的时候都会提到它Q它的功能也的确不赖呀。FORM的模板的支持Q生成目?.{配|文件的支持。真的可以说是STRUTS的一个非常成功的插g。只是网友在使用中,发现竟然有把Struts-config.xml文g信息丢失的现象,q个插g可以说一下子从天堂走向了...但是Q好在myeclipse把它集成了,修正了一些BUG。但与此也带来一些新的BUGQ?( 软g是不是Lq样Q?不过Q随着FILE Model插g的强大,easy struts吸引人的地方来少了,甚至于它的模板不是基于velocity?也成为它必须要重构的一个因素了? q个东东可能用的人ƈ不多一眼看上去好象也没有什么强大的功能.但实际上,它的的确是唯一全支持STRUTS的插?它的支持不仅仅在于struts-config文g的支?它还可以支持JSP中Formbean里面的属?!!!q回当Formbean里面属性一大堆的时候不怕写错了,嘿嘿但目前好象没有出现破解版?

代码辅助

有几综合介l文章,请参考:Eclipse介绍文章?/a>
Jalopy功能实不错Q也是我在用eclipse2pd时必备之一Q不q在eclipse3里面Q格式化有了长的进步,个h认ؓ功能已经不弱于Jalopy?——郁也风
Doclipse is an Eclipse plug-in to help you write Java source files with Javadoc tags, either for documentation purposes or to be processed by a tool such as EJBGen or XDoclet. New tags can be added to the plug-in by writing XML files defining the new tags and their attributes.

XML

排名最高的 XML 插gQ比较好用。标准版免费开放,专业版需要付贏V?

Hibernate

国h开发的一?Hibernte 辅助开发工兗很好用。主要功能是从数据库表中自动建立 hbm 文g。也可以从POJO创徏hbm文g,但是默认ID的类型是hilo.long, 从这个hbm 产生数据库schema的时候会出错? Hibernate Synchronizer可以保证hbm和java文g的同步? http://www.exadel.com/images/pages/orm/orm.gif

GUI 相关

其它 Util 插g

帮助你在代码里?log4j ?log ?eclipse edit 做些功能补充

Q?a class="interwiki" target="_blank">meven 免费Q另一个极好的maven环境!

I18n资源文g~写插gQ超好用


liaojiyong 2006-05-24 10:58 发表评论
]]>
վ֩ģ壺 | | | | | | | | ۷| | | | | | | | ŷ| | | | | | ذ| ɳ| | | ղ| | | | | | ͩ| | | Ž| ̶| ˳| | ·| Ϣ|