struts2 image button cannot calculate source of image - struts2

I need embed image button to page under Struts2.
Unfortunately absolute path cannot be used, so I need application-related url, but <s:submit type="image" src="i/go_btn.gif" doesn't work and expected url: app/i/go_btn.gif is not resolved. On other hand <s:url cannot be used because of error: "src does not accept any expressions"
So question: how to specify url of image in s:submit tag in application relative format?

use a root relative path perhaps.
placing "/" before the url means the root of the app. See http://www.coderanch.com/how-to/java/RelativeLinks

I've found my own solution. It is appeared that template for submit control (submit.ftl) contains following line for src attribute:
<#if parameters.src??>
src="${parameters.src?html}"<#rt/>
</#if>
That is why code for <input type="image" always generated with specified URL. It have to be changed as follow:
<#if parameters.src??>
src='<#s.url value="${parameters.src?html}" includeParams="none" />'<#rt/>
</#if>

Related

Upload file using Jenkins Active Choices Reactive References plugin

I am using Jenkins Active Choice plugin. I want to provide a file upload function based on reference variable
The below setting allows me to enter text when i select reference parameter scan_type as vulnerability-Web
What i want is , instead of taking text input it should upload file , and content of the file should be assigned to SELENIUM_RECORDED_FILE
I tried using below groovy
if (scan_type.equals("Vulnerability-Web")) {
inputBox = "<body> <form action='upload.php' method='post' enctype='multipart/form-data'> Select file to upload: <input type='file' name='fileToUpload' id='fileToUpload'> </form>"
return inputBox
}
its adding file upload option but the file content is not stored in SELENIUM_RECORDED_FILE
Please let me know how can we achieve this
Reading through HERE, it looks like you must have
<input type="file" name="file">

Inside Splash, how to use src attribute to append to a url

------------ORIGINAL QUESTION------------------
In my Splash Script, I am trying to use "splash:go" on a new url that is based on the "src" attribute of an "img" tag. How can I access this "src" relative url and join it to a start_url?
For example, imagine that the img element has the following contents:
<img id="ImageViewer1_docImage" onload="BlockerResize('ImageViewer1_ContentBlocker1','ImageViewer1_WaterMarkImage');" src="ACSResource.axd?SCTTYPE=ENCRYPTED&SCTKEY=gMYed5OWqcT9I1Y2fM85DvB48X5U1DQ5mOUiJoUH4rioyau0nJdxt0PHFfGVTMiUsork/YD+Cw0F6ZzcviP4sG09xrqWM8/zJlyEeVRFkKXVnkyHYWgwNJzCSUE4Kh4yCsqw6mCuIxWxPj6BAI7Hbw==&CNTWIDTH=849&CNTHEIGHT=684&FITTYPE=Height&ZOOM=1" alt="Please wait" style="border-width:0px;cursor: url(images/Cursors/hmove.cur); z-index: 1000">
Here I am trying to extract the src attribute and add it to start_url:
https://i2a.uslandrecords.com/ME/Cumberland/D/
I want all of this inside the Splash script. I need it to be done inside of Splash because otherwise I lose my security/encryption or something--it renders "Bad Data" instead of the new webpage. Do you have any recommendations?
------------UPDATE------------------
So I managed to obtain the url I needed from the src attribute using the following code:
var = splash:evaljs("document.getElementById('ImageViewer1_docImage').src;")
splash:go(var)
However, the problem is that this is producing a error message. All I find in the snapshot is a white page with the following message:
Failed loading page (Frame load interrupted by policy change)
https://i2a.uslandrecords.com/ME/Cumberland/D/ACSResource.axd?SCTTYPE=ENCRYPTED&SCTKEY=gMYed5OWqcSvEWOJA6wGVmb642s2oZHqkYmT6VTpORTzMY7CgvDU5jsjJG/xp0X3eQ9BiDnbaTdAmISeLkC3hyjxGjcSnXOKgGDa8cI2fniY0ILT+NqvQToMGIB+/X3ZIs7Q+D4ppTSZGYZ2L4M/
Webkit error #102
Any idea why?
The image src attribute is exactly the URL you need to access or as stated by the question title you need to append it to some other URL parts?
If that is the case, you can do it by '..'
Ex.: splash:go(base_url..var) -- concatenation
ISSUE RESOLVED:
Here is the solution. The GET request was breaking down because it didn't know how to render the image in html given the webkit settings. If you execute the GET request without rendering the page, the response.body has the image.
CODE:
local response = splash:http_get(var)
return {
body = response.body
}

ioArgs in Dojo 1.10, dojox DialogSimple

Got myself a bit of a problem (only occurring in Tomcat 8.5, but I'll need to handle it)...
I'm trying to open up a dojox.widget.DialogSimple, using an href, that has a long url/data string. Setting the HREF on instantiation causes it to fail as a malformed URL, because it's too long. So, I want to be able to do it as an xhrPost. Is there a way to set this up using the ioArgs property? I haven't been able to find any documentation giving examples of this.
You are correct. An over-long URL string for an HTTP "GET" can cause problems: Web Services: maximum length of HTTP GET request?. In general, the solution is to do a "POST" instead.
Would this solution work for you?
Dojo - how to submit data using a Dialog form
<div dojotype="dijit.Dialog" id="subscription" title="subscription form" execute="alert('Transmitted');">
<form action="PATH_TO_PHP_PAGE" method="POST">
<!--input widgets-->
<!--submit button widgets-->
</form>
</div>

Use liferay-ui:message tag in template freemarker

I am a newbie in Liferay 7. I created a navbar in my site. I need to set the labels in my navbar e.g. "Name" in japanese. In jsp, liferay-ui:message is avaialable to get the value of the labels. So I added this tags in my init.ftl file.
<#assign liferay_ui = taglibLiferayHash["/WEB-INF/tld/liferay-ui.tld"] />
However, I am having an error below.
freemarker.template.TemplateModelException: Error while loading tag library for URI "/WEB-INF/tld/liferay-ui.tld" from TLD location "servletContext:/WEB-INF/tld/liferay-ui.tld"; see cause exception. FTL stack trace ("~" means nesting-related):
- Failed at: #assign liferay_ui = taglibLiferayHas... [in template "vsp-theme_SERVLET_CONTEXT_/templates/init.ftl" at line 333, column 2]
Maybe try this:
<#assign msg = languageUtil.get(locale, "my-custom-message-blah-blah") />
Taglib not required, just us below tags.
<#liferay_ui["message"] key="popular" />
or
<#liferay.language key="next" />

img src inside MVC View does not work. Could not find the path

<img src="/content/images/page/looding.gif" >
Within another .cshtml, same image tag works fine. But it fails on this one. Gives the error:
Could not find a part of the path 'C:\content\images\page\looding.gif'. I tried this:
<img src="#Url.Content("~/Content/images/page/fastercv-logo.png")"
I got same error. Any suggestion?

Resources