`
收藏列表
标题 标签 来源
获取来源url地址
<%=request.getHeader("referer") %>
struts2保留两位小数
<s:text name="format.number">
	<s:param value="appTotalmoney*0.01"/>
</s:text>
eval 将字符串转为json 用于服务端返回json数据时.
var s='{"webname":"homehf","url":"www.homehf.com","qq":"744348666"}';
var tst=eval("("+s+")");  //使用eval()函数,一定要注意这里的双引号
alert(tst.contact.mail);
eval 将字符串转为json
var s='{"webname":"homehf","url":"www.homehf.com","qq":"744348666"}';
var tst=eval("("+s+")");  //使用eval()函数,一定要注意这里的双引号
alert(tst.contact.mail);
${cookie.userName.value }
${cookie.userName.value }  
${cookie.userName.name }  
struts2标签调用静态方法
静态方法:<s:property value="@com.appbox.util.finalproperty.FinalField@getOrderStatus(appState)" />
静态变量:<s:propteryvalue="@com.work.core.QxglConstants@TOP_LEVEL_TOP"/> 
静态map变量中的key值:<s:property value="@com.appbox.util.finalproperty.FinalField@shenhestate.get('shenhetongguo')"/>
$.ajax
$.ajax({
   type: "POST",
   url: "enter/producttypejson/product!listdatabytypeid.action",
   data: "typeid="+catid,
   dataType: "json",
   async: false,
   timeout: 1000,
   error: function () {
	   alert("错误");
   },
   success: function(msg){
		alert("成功");
   }
}); 

   }
}); 
 $("#cateTips").show();
struts返回结果配置下载的文件类型及文件名
<action name="CollectionAct*" class="CollectionAct" method="{1}">
    <result name="list" type="json">
	<param name="contentType">text/plain</param>
	<param name="contentDisposition">attachment;filename="json.txt"</param>
    </result>
</action>
struts2文件拦截的成功配置
<action name="SaiDanActadd" class="SaiDanAct" method="add">
	<!-- 晒单  -->
	<interceptor-ref name="whoStack">
		<!--
			配置允许上传的文件类型,多个用","分隔
		-->
		<param name="fileUpload.allowedTypes">
			image/bmp,image/png,image/gif,image/jpeg,image/jpg ,image/x-png,
			image/pjpeg
		</param><!--
		 配置允许上传的文件大小,单位字节 
		-->
		<param name="fileUpload.maximumSize">1024000</param>
	</interceptor-ref>
	<result name="input">/customer/jsoninput.jsp</result>
	<result name="add" type="json">
		<param name="contentType">text/plain</param>
		<param name="contentDisposition">attachment;filename="info.txt"</param>
		<param name="includeProperties">msg,state</param>
	</result>
</action>
通过setHeader设置下载时的文件名
        response.setContentType("application/x-excel");
//        response.setContentType("application/vnd.ms-excel");
       
        OutputStream  out = response.getOutputStream();
       
        ExcelBussiness eb = new ExcelBussiness();
       
        try {
            response.setHeader("Content-Disposition", "attachment; filename="+"xxx.xls");

            eb.responseExcel(out);
        } catch (RowsExceededException e) {
            // export excel exception
            e.printStackTrace();
        } catch (WriteException e) {
            // export excel exceptin
        }
wxwidget helloworld程序 wxwidget http://www.wxwidgets.org/docs/tutorials/hello.htm
#include "wx/wx.h"

/*声明app*/ 
class MyApp: public wxApp
{
    virtual bool OnInit();
};
/*声明frame*/ 
class MyFrame: public wxFrame
{
public:

    MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);

    void OnQuit(wxCommandEvent& event);
    void OnAbout(wxCommandEvent& event);

    DECLARE_EVENT_TABLE()//使用宏来声明事件table 
};
/*定义事件ID,用于事件响应与事件处理函数的绑定*/ 
enum
{
    ID_Quit = 1,
    ID_About,
};

BEGIN_EVENT_TABLE(MyFrame, wxFrame)
    EVT_MENU(ID_Quit,  MyFrame::OnQuit)
    EVT_MENU(ID_About, MyFrame::OnAbout)
END_EVENT_TABLE()

/*使用宏来实现一个main方法,在这个main方法中创建一个应用实例并且启动程序*/
IMPLEMENT_APP(MyApp)

/*实现app*/ 
bool MyApp::OnInit()
{
    MyFrame *frame = new MyFrame( _("Hello World"), wxPoint(50, 50), wxSize(450, 340) );
    frame->Show(true);
    SetTopWindow(frame);
    return true;
}
/*实现MyFrame*/ 
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
       : wxFrame(NULL, -1, title, pos, size)
{
    wxMenu *menuFile = new wxMenu;

    menuFile->Append( ID_About, _("&About...") );
    menuFile->AppendSeparator();
    menuFile->Append( ID_Quit, _("E&xit") );

    wxMenuBar *menuBar = new wxMenuBar;
    menuBar->Append( menuFile, _("&File") );

    SetMenuBar( menuBar );

    CreateStatusBar();
    SetStatusText( _("Welcome to wxWidgets!") );
}
/*实现MyFrame成员方法*/ 
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
    Close(true);
}
/*实现MyFrame成员方法*/ 
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
    wxMessageBox( _("This is a wxWidgets Hello world sample"),
                  _("About Hello World"), 
                  wxOK | wxICON_INFORMATION, this );
}
jquery 访问 iframe 父框架
$(window.parent.document).find("input[@type='radio']").attr("checked","true");
Global site tag (gtag.js) - Google Analytics