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.
Related
I am looking at an Adobe forum post where the link rewrite is happening. How is the LinkTransformer class triggered? For example if I am testing this in local, and put a debug inside the class does a page refresh get to this class?
Thanks..
The Link Transformer will run on every request that renders HTML. It is used to rewrite all of the configured HTML elements.
It will for example rewrite the href attribute of all <a> HTML tags. But there are several more HTML elements and attributes that are rewritten.
So in theory your debugger should halt at a breakpoint on every request. (Except if you call the page through the Dispatcher which usually will cache the HTML after the first request. So every subsequent request would not be answered by AEM and therefore, the debugger will not halt.)
I am new to Scala and am trying to build an href link to another page within a website that was already built with HTML and JavaScript. All the links are set up as:
<a href="mypage.html">
I have been researching Scala and understand that it is more routing and configuration than just referring to a another page. I also understand that the other html pages seem to be used as a Single Page Application setup using the #content tag in the main.scala.html page. I may be wrong on this description, but this is how it makes sense to me.
I have set up a new Scala page and am referencing it in my HTML:
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-6 col-ss-12 margbot30">
<a class="services_item" href="#views.html.login3(loginForm)">
<p>
<b>New</b> User Account
</p> <span>Sign up for a user account</span>
</a>
</div>
It does not give me an error, but actually show that login3.scala.html page in that <div> tag. I wanted to have the text clicked and then open that page.
How do I get this link or route to work correctly?
I found this post, but I am still not sure what to do:
Play! Framework - creating simple html links
I appreciate the help and any code examples.
What "#views.html.login3(loginForm)" is doing is invoking the Scala function login3 and the resulting content is being rendered into the page.
Instead of thinking of pages linking to pages, think of pages linking to controllers.
If you have a controller like this:
package controllers;
class FooController extends Controller {
def foo = Action { request =>
Ok(views.html.foo())
}
def bar = Action { request =>
Ok(views.html.bar())
}
}
This is exposed via the routes file as
GET /foo controllers.FooController.foo
POST /bar controllers.FooController.bar
In your views, you then define your hyperlinks using the generated routing:
whatever
So in your case, instead of using
<a class="services_item" href="#views.html.login3(loginForm)">
you would instead have
<a class="services_item" href="#routes.SomeController.theFunctionThatRendersLogin3()">
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");
...
%>
...
I have a pure GWT based website and as we are aware the search engines cannot index pure gwt based websites. Thus, I have created an alternate web page as shown below which is stored as a separate html in the war folder. The purpose of this webpage is to enlist and index details regarding my website. This page is never displayed on my website, but instead is meant only for indexing. The url leading to this web page is part of the Sitemaps.xml. Thus I am assuming that the below html will be indexed because it's a part of Sitemaps. So here are my questions:
Will the content I give in the div with id "crawler" be indexed given the fact that it is scheduled for removal onload and that the browser is redirected to another url on load?
Is there a better way to get the content indexed for a pure GWT website which does not have any html based user interface?
I can also have urls that will invoke a servlet and return a response that is meant for indexing. But then the same url will be displayed in search results, which is not useful. In other words, I am trying to figure out a way in which the content gets indexed, but when the user clicks the search result he should be redirected to the home page instead of showing the indexed content.
<head>
<script>
function load(){
element = document.getElementById("crawler");
element.parentNode.removeChild(element);
window.location.href='http://<mysite>.com';
}
</script>
</head>
<body onLoad='load()'>
<div id="crawler">
<CONTENT TO BE INDEXED>......
</div>
</body>
As you can see here the div (crawler) that contains all the content that is meant for indexing, is removed as soon as the body loads. Apart from this the page also redirects to the home page of the site on load.
The crawler will read in the entire contents of the page for indexing, so it will have no trouble picking up the portion within the div. The onload is not executed by the crawler prior to reading the page.
A method I have used in the past was to generate static html versions of the pages and reference these through the sitemap.xml. Users landing on the html page would then be directed to the equivalent dynamic page when they click on a link (ie: Buy or Specifications). This worked well for search engine placement with many pages appearing in the top ten.
The best solution to notify the search engines about an undiscoverable website's content is to create a HTML website (as you did). If you create redirects based on the crawler, search engines will not love you. I think you have to fill out your HTML with content with relevant information and add
<link rel="canonical" href="https://gwtsite.com/exact_url"/>
tag to your website's head section. This will notify the search engines that the other site has to appear in the SERP-s instead of the HTML one.
I currently have a JSP Page with a form in it.
On submission of this form I want to reload this same page with the form being populated with the user input values before the form was submitted.
The Search results will then be outputted on the page.
I have successfully got the search results to output on the page but would like some advice on how to keep the input values in the form elements on page reload.
I did load the search results via the struts 2 Ajax library however if there was a validation error the ajax request would return the full jsp page itself, rather than the search results, as on error the page should reload itself displaying the action errors. As a result I have abandoned using Ajax for loading the search results.
#1: Classic way
If you send a form from search.jsp to search.action , and on SUCCESS you will load the result in searchResult.jsp, and searchResult.jsp contains the same form with the search criteria (and obviously the grid with the search results), in order to preserve and automatically re-populate the criteria you've written in the previous page, you need:
the same Struts2 tags with the same name/value attribute in both search.jsp and searchResult.jsp; actually, I suggest you to create a JSP snippet and to include it in both the JSPs with <jsp:include/>, to avoid code redundancy (two identical forms in two different pages);
the Getters and Setters for all the variables in your search.action, to be set by search.jsp, and to be read by searchResult.jsp.
No AJAX is involved in this, and as said by Dave, it's trivial.
#2: AJAX way
If you instead are using AJAX, then your form will be posted but your page will remain the same, only a target div (the div containing the results of the search) will be populated.
In this case, the data will be preserved because the page will not be reloaded.
Theoretically, in your searchAJAX.action you would only need the Setters for the search criteria, because they will only need to be set, and not read back.
Being your SUCCESS result loaded in a div, by the way, will result in the need of loading a JSP snippet, not a whole JSP. The JSP snippet returned will be injected into the body of the original page, then it should contain only the relevant HTML (and the struts-tags definition), without DTD, <html>, <head> nor <body> elements.
This is valid for the SUCCESS, but for the ERROR result too.
If you return a whole JSP page as global error, or action local error result, you will have a page inside a page, as you had.
The solution is to use
a full JSP as error page for ERROR result returned by classic Actions;
a JSP snippet as error page for ERROR result returned by AJAX Actions.
an example of a JSP snippet for ERROR:
<%# page contentType="text/html; charset=UTF-8" %>
<%# taglib prefix="s" uri="/struts-tags" %>
<strong>OOOOPS an error occurred !</strong>
Obviously another way would be returning a JSON array of data, parsing it and building the HTML client-side with Javascript, to reduce the load of network traffic, but you can easily start with the old way.