I'm having a problem with my Errai GWT app which I get this error when the page tries to TransitionTo a page, say FormsPage:
No page with a widget type of com.mycompany.myproject.client.local.FormsPage exists
Even if the FormsPage is there in the package and there is no-compile time error (so it was able to locate the page) in:
TransitionTo<FormsPage> formsPage;
What could be the problem?
I forgot the include #Page annotation in the "page" class.
So adding this on it resolved the issue.
Related
Intellij Not Recognizing Model Variables in HTML. How to resolve model variables. I don't get any idea for this issue.
Here is my Controller
#Controller
public void someController {
#RequestMapping("/")
public String someMethod() {
model.addAttribute("message", "message");
return "index";
}
And here is my "index.html"
<p th:text="${message}"> </p>
and of course in my html tag i'm using thymeleaf :
<html xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/html">
the problem is in myth:text="${message}" i see red squiggly lines saying that "Cannot resolve "message" variable..."
For recent versions of IntelliJ:
With the cursor on the variable, press Alt-Enter and you should see a menu option to "Declare external variable in comment annotation". When you select this option, you'll get a comment template with the cursor positioned to type in the data type of the variable.
When complete, you'll have something that looks like this:
<!--/*#thymesVar id="productIds" type="java.util.Map"*/-->
<div data-th-each="p : ${productIds}">
The Alt-enter menu doesn't seem to work within expressions such as ${#maps.isEmpty(productIds)}. In this case, manually creating the comment might make the UI get rid of the "unresolved" indicator.
I've been ignoring that issue for as long as I've been using Thymeleaf. Even though it shows the squiggly lines, it should still work when you run the application.
IntelliJ would almost have to compile the code in the background to be able to automatically (and accurately, since you could have multiple methods who uses the same template) resolve the variables.
I've never given a tip like this, but after reading your comment that you just find the wiggly line annoying, I decided to suggest it anyways:
Disable the tip.
I feel absolutely barbaric for posting this answer, forgive me SO
these red lined could be very annoying I just removed www. from my thymleaf and it worked
In your .html thymeleaf file Replace line 1 with line 2
Line1 : <html xmlns:th="http://www.thymeleaf.org">
Line2 : <html xmlns:th="http://thymeleaf.org">
Just stumbled upon this while having the same problem.
In my case it was caused by having the #SpringBootApplication class not in the same Maven module as the template and controller. Including the application module in the pom.xml with <scope>provided</scope> solved it for me.
I think #TwiN is right. IntelliJ indeed has to compile the whole thing and since it couldn't find an application it had no idea how to make a component lookup.
Short Question, Is it possible to make a database call in the first load of home page using Struts 2? I have this old project of mine, just a simple online shop(wasn't able to finish it though) and i recalled that i was having a hard time with my home page outputting products listed in the database since struts needed to trigger an action before doing anything. Can you like preload some actions before proceeding to the home JSP? I'm a beginner in struts and could just do simple redirect and other basic actions.
You have many ways to do it. But most easiest way is mapping a action with the home page URL. Action class should do whatever database loading or other logic and forward to the JSP page.
Use a list method with s:iterator on your home.jsp.
You can use the s:action tag in your home page. There are 2 different ways it could be approached.
the only thing in your home page is the <s:action/> tag and let it render the result of the action: executeResult="true" attribute.
specify the var="myaction" attribute and set executeResult="false". You can then access everything from the action through the var name. for example <s:property value="%{myaction.myproperty}"/>
The docs for the s:action tag can be found here: https://struts.apache.org/docs/action.html
I am trying to refresh the JSP page after certain operations, I am using DWR to be able to use my classes in Javascripts in the JSP files so I have this code:
function removeDN(numplanindex){
DBOps.removeDN(numplanindex);
relaod(true);
}
the above code will break the removeDN() and it would not refresh the page, I have also tried window.location.reload(true) and document.location.reload(true).
I am not sure about the difference as I barely know any Javascript but according to everything on google this should work. I am wondering if anybody know what is wrong with what I am doing wrong.
Thanks
It should be reload(true) instead of relaod(true)
Also see http://www.w3schools.com/jsref/met_loc_reload.asp
I have a web app, where I have different navigation anchor tags such as Home, Profile and etc.
What I want:
When I press anchor tags like home or profile. I just want to ensure that current user gets its information in that Tags/JSP Page.
Sample Example that I am trying:
Profile
The pageContext is an implicit object available in JSPs. The EL documentation says
The context for the JSP page. Provides access to various objects including:
servletContext: ...
session: ...
request: ...
response: ...
Thus this expression will get the current HttpServletRequest object and get the context path for the current request and append /JSPAddress.jsp to it to create a link (that will work even if the context-path this resource is accessed at changes).
The primary purpose of this expression would be to keep your links 'relative' to the application context and insulate them from changes to the application path.
For example, if your JSP (named thisJSP.jsp) is accessed at http://myhost.com/myWebApp/thisJSP.jsp, thecontext path will be myWebApp. Thus, the link href generated will be /myWebApp/JSPAddress.jsp.
If someday, you decide to deploy the JSP on another server with the context-path of corpWebApp, the href generated for the link will automatically change to /corpWebApp/JSPAddress.jsp without any work on your part.
Include <%# page isELIgnored="false"%> on top of your jsp page.
use request.getContextPath() instead of ${pageContext.request.contextPath} in JSP expression language.
<%
String contextPath = request.getContextPath();
%>
out.println(contextPath);
output: willPrintMyProjectcontextPath
For my project's setup, "${pageContext.request.contextPath}"= refers to "src/main/webapp". Another way to tell is by right clicking on your project in Eclipse and then going to Properties:
I have an include page which is a navigation menu. When i click on those menu i want to refresh the content area of layout with a certain page. How can i pass the page name into a JSF page using include tag
I dont want to switch to facelets and also i tried using $ and calling the backing bean method. It works but no css or richfaces components renders properly.
Thanks
Raj
I am not sure about the RichFaces part, but you can just use EL in <jsp:include> as well.
<jsp:include page="/WEB-INF/#{bean.pagename}.jsp" />
If bean.getPagename() returns for example home, then this will include /WEB-INF/home.jsp. You also need to ensure that the JSF/HTML contents of home.jsp is wrapped by a <f:subview> with an unique ID.
As to the CSS trouble, just ensure that the generated HTML validates and that the CSS imports in the <link> tags are all valid.