相关文章
更多最近更新
更多页面获取ACTION的属性,页面不能弹出JS
2019-03-25 13:49|来源: 网路
action定义一个属性,get set后 对属性赋值,值是JS,页面用<s:property/>获取,结果不弹出JS 而是值
public class TestAction extends ActionSupport{
private ItestBiz testbiz=null;
private String show="";
public String getShow() {
return show;
}
public void setShow(String show) {
this.show = show;
}
public ItestBiz getTestbiz() {
return testbiz;
}
public void setTestbiz(ItestBiz testbiz) {
this.testbiz = testbiz;
}
public String execute()throws Exception
{
int i=testbiz.getP();
System.out.println("iiiiiiiiiiiiiiiiiiiiii--->"+i);
Person p=testbiz.getList();
System.out.println(p.getUsername());
System.out.println(p.getPassword());
System.out.println(p.getAddress());
show="<script>alert('你好吗?');</script>";
return SUCCESS;
}
}
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.objectFactory" value="spring" />
<constant name="struts.custom.i18n.resources" value="globalMessages">
</constant>
<constant name="struts.i18n.encoding" value="GBK"></constant>
<package name="action" extends="struts-default">
<!-- 定义拦截器 -->
<interceptors>
<!-- 定义拦截器栈 -->
<interceptor-stack name="filter1">
<!-- 引用默认的拦截器 -->
<interceptor-ref name="defaultStack"></interceptor-ref>
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="filter1"></default-interceptor-ref>
<action name="test" class="tttaction">
<result name="success">index.jsp</result>
</action>
</package>
</struts>
index.jsp页面
<%@ taglib prefix="s" uri="/struts-tags"%>
<s:property value="show"/>
运行工程页面显示<script>alert('你好吗?');</script>
实际我想要的结果是 在页面弹出一个JS对话框 内容为 你好吗? 曾经搭建的框架是可以实现弹出的,现在刚进了一家公司,自己搭建框架的时候发现这样是不行了,现在只能用EL获取这个属性可以实现弹出,请问大家有什么办法可以解决吗?
知道的请告知我,谢谢 我QQ 350101319
public class TestAction extends ActionSupport{
private ItestBiz testbiz=null;
private String show="";
public String getShow() {
return show;
}
public void setShow(String show) {
this.show = show;
}
public ItestBiz getTestbiz() {
return testbiz;
}
public void setTestbiz(ItestBiz testbiz) {
this.testbiz = testbiz;
}
public String execute()throws Exception
{
int i=testbiz.getP();
System.out.println("iiiiiiiiiiiiiiiiiiiiii--->"+i);
Person p=testbiz.getList();
System.out.println(p.getUsername());
System.out.println(p.getPassword());
System.out.println(p.getAddress());
show="<script>alert('你好吗?');</script>";
return SUCCESS;
}
}
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.objectFactory" value="spring" />
<constant name="struts.custom.i18n.resources" value="globalMessages">
</constant>
<constant name="struts.i18n.encoding" value="GBK"></constant>
<package name="action" extends="struts-default">
<!-- 定义拦截器 -->
<interceptors>
<!-- 定义拦截器栈 -->
<interceptor-stack name="filter1">
<!-- 引用默认的拦截器 -->
<interceptor-ref name="defaultStack"></interceptor-ref>
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="filter1"></default-interceptor-ref>
<action name="test" class="tttaction">
<result name="success">index.jsp</result>
</action>
</package>
</struts>
index.jsp页面
<%@ taglib prefix="s" uri="/struts-tags"%>
<s:property value="show"/>
运行工程页面显示<script>alert('你好吗?');</script>
实际我想要的结果是 在页面弹出一个JS对话框 内容为 你好吗? 曾经搭建的框架是可以实现弹出的,现在刚进了一家公司,自己搭建框架的时候发现这样是不行了,现在只能用EL获取这个属性可以实现弹出,请问大家有什么办法可以解决吗?
知道的请告知我,谢谢 我QQ 350101319
相关问答
更多-
弹出页面如何实现?[2022-01-20]
增加一个onclick,然后加js代码alert -
如何通过jquery获取js动态append到html页面的dom属性[2022-06-14]
jsp中 分享文案编辑: 点击一次添加按钮页面多一个文本框 ———————————————————————————————————————— JS中 $("#content1") .append( '' + '' + '' + '' + '' + ' 分享语句' + type + ' 删除 '); -
如何通过jquery获取js动态append到html页面的dom属性[2024-03-10]
jsp中 分享文案编辑: 点击一次添加按钮页面多一个文本框 ———————————————————————————————————————— JS中 $("#content1") .append( '' + '' + '' + '' + '' + ' 分享语句' + type + ' 删除 '); -
js页面跳转,跳转后能获取上一页面的值?[2022-07-27]
"; -
如何用selenium 和 js 结合修改页面input属性?[2023-07-20]
那有name属性吗?要是连name属性都没有那在页面中在第几个的位置上能判断吗?如果位置也不能判断那除了它有readonly属性外别的input还有这个属性吗?这三点随便哪一个能确定都能把readonly属性给去掉~ -
不,没有办法做到这一点。 与网页类似,弹出式作用域在其显示时被创建,并在不可见时被销毁。 您将需要使用JavaScript来恢复您希望与上次打开时相同的任何状态。 您希望在弹出窗口被销毁后保留的任何信息,您将需要存储在其他地方(例如背景页面或StorageArea )。 No, there is no way to do that. Similar to a web page, the popup scope is created when it is shown and destroyed when it ...
-
为每个项目赋予id并移动light并从id和class fade 。 然后,在执行单击功能时,按项目id查找light和fade 。 请参阅以下示例。 function getParent(itemChild) { // Get parent. var item = itemChild.parentElement; return item; } function itemquantity(itemChild) { var item = getParent(itemChild); // ...
-
它是客户端的所有HTML,当用户提交HTML表单时,它就像从HttpServletRequest对象获取参数一样简单。 我希望你明白我的观点。 所以,不要把自己与Velocity混淆。 Its all HTML on the client side, and when user submit the HTML form, it work as simple as getting the parameters from the HttpServletRequest object. I hope you are ...
-
如何在页面操作弹出窗口时单击页面操作(How to tell when a page action is clicked when the page action has a popup)[2023-08-05]
设置弹出窗口后,单击该按钮将导致加载并显示弹出页面。 同时,不会触发onClicked事件。 因此,如果要在设置弹出窗口时检测到单击,请在popup.js中放入一些代码。 例如:如果没有弹出窗口的代码如下所示: // background/event page chrome.pageAction.onClicked.addListener(function(tab) { // Do something }); 然后从后台 / 事件页面中删除该段代码,并将代码放在popup.js中: documen ... -
你必须阻止表单的默认操作:有两种方法可以做到这里有两个jQuery和Vanilla JS: jQuery的 $('#form').submit(function (event) { event.preventDefault(); window.history.back(); }); JS if (element.addEventListener) { element.addEventListener("submit", function(event) { event ...