read/replace jboss system properties in a jsp file - jboss

I have set system properties in JBoss 6. I have deployed a war file and everything works fine. The next step I'd like to take is to read those system properties replacing variables in the default index.jsp file to show in the users browser. First, I'll admit I may not be going at this correctly but I need certain properties to display based on what instance the user is connecting to. Maybe there's a better way than what I'm thinking. Any help would be totally appreciated.

I was stuck with the idea that the javascript would be client side so I was having difficulty understanding how it would be done. Here's a snippet of my jsp file and how I was able to get it to work.
<html>
<head>
<meta http-equiv="CACHE-CONTROL" content="NO-CACHE">
<%# page import="javax.naming.Context" %>
<%# page import="javax.naming.InitialContext" %>
<%
...
String dbUrl = System.getProperty("jboss.db.connectionString");
...
%>
...

Related

Kentico 7 create content placeholder in Portal Master to use in ASCX in inherited page

Working in Kentico 7 on an Ad-Hoc page that inherits from Portal Master. I want to insert some literal script or code right before the </body> tag in the rendered ad-hoc page.
I thought I'd have to do this by editing the portal master and adding the following:
<cms:CMSPagePlaceholder ID="plcBodyEnd" runat="server">
<LayoutTemplate>
</LayoutTemplate>
</cms:CMSPagePlaceholder>
and then in the layout of the Ad-Hoc page do this:
<cms:CMSContent runat="server" id="cntLeft" PagePlaceholderID="plcBodyEnd">
<script type="text/javascript">
ProviderConnections.Transparency.initializeWidget({ });
</script>
</cms:CMSContent>
This worked fine until I went to the design tab on the Ad-Hoc page, where I got the following error:
Object reference not set to an instance of an object.
I don't want to register script blocks. I just want to put text in the Ad-Hoc page that goes there before the </body> tag, which is controlled by Portal Master.
What am I doing wrong?
I'm not 100% sure what you are trying to achieve. Giving an example or attaching a screenshot would be very helpful.
Here are the ways of attaching JavaScript in Kentico:
Through portal engine:
Use JavaScript web part - that gives you an option of choosing where the script should be located
Programmatically from code-behind:
Use CMS.Helpers.ScriptHelper API (wrapper around ASP.NET's ClientScriptManager)
ScriptHelper.RegisterStartupScript() to put the script at the end of the page
ScriptHelper.RegisterClientScriptBlock() to put the script before page's elements
The difference between the two is well explained here.
Programmatically from ASPX markup:
Put your <script> block to a desired location in your .aspx / .ascx files
Evaluate a code-behind variable containing script
<asp:Button ID="btnOK" runat="server" Text="OK" />
<script type="text/javascript">
<%= fieldWithActualScript %>
</script>

Facebook Page Tab external URL

What should contain a HTML file to display it on a Facebook Page's Tab. I have added the tab, but I get blank page, I have tried everything, searched hours, my URL is HTTPS, so I really don't know...
Could you paste anybody a full HTML code that works, appears in a Page's Tab with an app? Thanks!
That would be the minimum, it definitely works:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
hello there
</body>
</html>
As you can see, nothing fancy there. Without any test URL, we can only tell you to open the browser console and search for errors.
We found the answer, the server doesn't enable the iframing, so what I tried was good, but
Console's JavaScript error: Load denied by X-Frame-Options: https://www.... does not permit cross-origin framing.
So we contacted to our hosting company to solve this.
UPDATE: Hosting support added the following code to my .htaccess file: Header always unset X-Frame-Options, what solved my problem.

using .php with .css or some thing better?

I have a log in page for my web site. The log in file is "index.php" this will be the first page you come to when comming to my site. The rest of my site is HTML with a style.css file providing the look for my site. Now my questions is how do I get my index.php file too look like the rest of my web site?
Right now when you come to mydomain.com/index.php it is just a white page with a log in and password box. I would like my log in page to look like the rest of my web site. Can some one please refer me as how to do this?
I have other .php files that would also need to be linked with the .css such as register.php and so forth. thanks guys.
If there is a different/better method of doing what I need please feel free to chime in, I'm all ears at this point I've been trying to do this for 2 days.
Like you would do in every other html page you will have to link the file the same way.
I guess that you have already seen that in every php file there is html code?
Just stay out of the php brackets
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body
<?php
"php code in here"
?>
</body>
</html>
If you don't find the usual html markup somewhere search for a include function in the php file.
Maybe the html header is in other php file and it is being called from there.
They would be included like this
include '_header.php';
You can use the CSS file, similar to how you use it in your HTML files. You can either post the CSS tag below your PHP code, or you can use an echo "cssTagHere"; call within your PHP code.
If you're using a login page, though, are you maintaining that security with the rest of your site by using PHP on your other pages?

MVC2: Non-view aspx page in iframe

I have a contradiction to deal with:
I need to make a stylesheet load for a reporting object (for ASP.NET -- it requires runat), however, it won't compile when I have <% %> tags in . I need the <% %> stuff in to load stylesheets and jscripts for the rest of the page.
So, I'm going to load the reporting object into an wrapped in a non-view, non-master-bound aspx page -- so I don't need the other CSS stuff (it's in the Site.Master outside of the iframe)... however, I'm getting a 404 when I load /APP/Reports/viewer.aspx... so it seems to be a controller thing.
I tried googling for the answer, but I'm not sure how to ask the question.

(ASP.NET 2008) opens the file within browser rather than showing a Open/SaveAs dialog

we have image files in IIS6.0 server, and wanted to open in browser using ASP.NET2008.
My problem is that it always shows the open/saveas dialog, but what I wanted is, it should open the file in the browser directly. we are using ASP.NET2008. It would be great if you provide the sample code.
thanks
You could try to embed those file(s) into a simple HTML page. This will make browsers display it without prompting the user.
Making your code output bare bones like:
<html>
<head><title>YOUR_IMAGE_NAME</title></head>
<body>
<img src = 'YOUR_IMAGE' alt='YOUR IMAGE DESC' />
</body>
</html>
to the browser should be sufficent.
HTH