在我的index.html.erb页面中,当从 MSSQL 查询数据时,它显示为
Me&Mine. 我试过这个:
$("#3").text("<%= escape_javascript(raw render(:partial => "var") %>");
Run Code Online (Sandbox Code Playgroud)
但它不起作用。
index.html.erb :
<%= link_to "Link", {:action => "AjaxView",:col => "colname"},
:update => "Ajaxcall", :remote => true %>
<tr>
<td id="#3" style="height:25px">data displayed here</td>
Run Code Online (Sandbox Code Playgroud)
控制器:
def AjaxView
@vars= Var.find(:all,:conditions => { :varName=> "one" },:select=>(params[:col]))
respond_to do |format|
format.js { render :layout=>false }
end
end
Run Code Online (Sandbox Code Playgroud)
AjaxView.js.erb:
if ( @col.to_s == "colName") {
$("#3").text("<%= escape_javascript(render(:partial => "var") %>");
}
elsif ( @col.to_s == "colName1")
{
$("#2").text("<%= escape_javascript(render(:partial => …Run Code Online (Sandbox Code Playgroud) 在Java中使用MessageFormat类在字符串中传递不同的变量时
System.out.println(MessageFormat.format("I want to resolve this statement "{ {0}, {1} }", "this", "this"));
Run Code Online (Sandbox Code Playgroud)
当您打印此内容时,它将显示 --> { {0}, {1} } 并且由于包裹在大括号中而不会解析带有值的参数。