JSP <jsp:include /> vs <%# include %> when concatenating with a variable - eclipse

I am new to Java and JSP. I am trying to use eclipse Mars.1 to create a JSP application to see how it compares to using NetBeans 8 IDE.
In NetBeans 8 the following worked to include a file where "action" holds the name of the desired file.
<jsp:include page="<%= "/views/"+session.getAttribute("action")+".jsp" %>"/>
In eclipse Mars.1 this same line gives this error in the browser.
(line: 16, column: 25) Attribute value "/views/" + session.getAttribute("action") + ".jsp" is quoted with " which must be escaped when used within the value
To solve this issue I attempted to use
<%# include file="/views/" + ${sessionScope.action} + ".jsp" %>
I found out some information that using the JSP EL the + is always a math function.
How would I accomplish using the variable sessionScope.action to build a string for the file attribute?

Related

False positive "Missing include" xslt error in eclipse

I have an xslt file in my eclipse project.
The xslt is run using a custom processor, which contains some xslt files as an in-jar resource. The xslt linter does not see those resources, and signals an error.
The offending line in the xslt code:
<xsl:include href="xslt/functions.xslt"/>
The error message:
Missing include: xslt/functions.xslt
I guess that the xslt path for the linter is somehow configureable, but cannot find where and how.
Where and how?
If using the Eclipse XSL Editor (there are also other XSLT editors for Eclipse):
Window > Preferences: XML > XSL > Validation
or on project level:
Project > Properties: Validation > XSLT Validation
It is possible with the XML-Catalog-function "Rewrite Entry" and the imports having a prefix which identifies the folder you want to take the import from.
Window > Preferences : XML > XML Catalog > Rewrite Entry
You have to provide a URI key type and the prefix of the href-value.
Rewrite it with a "file://xxxx" value and the import gets resolved.
Example:
<xsl:include href="imp://xslt/functions.xslt"/>
catalog-rewrite-entry for eclipse
Entry element: Rewrite
Start string: imp://
Rewrite prefix: file:///home/xxx/project/importfolder
Key type: URI

Validating issue: Unknown Tag/Undefined attribute name warnings in Eclipe

The following code presents validation issues for me in Eclipse 4.4.2. This is located in a JSP file.
<svg version="1.1" class="..." xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" x="..." y="..." width="..x" height="..." viewBox="..."
enable-background="..." xml:space="...">
<g>
<polygon fill="#FFFFFF" points="..."></polygon>
<polygon fill="#FFFFFF" points="..."></polygon>
</g>
</svg>
This code produces the following warnings:
"Undefined attribute name (attribute-name)" for every attribute attached to the svg element
"Unknown tag (tag-name)" for the g and polygon tags.
I ran this through an online validator that supports HTML5/SVG1.1, and it told me there were 0 validation issues.
Any ideas why this could be happening? I'm aware that I can choose to ignore the validation issues through Window > Preferences > Validation, but I would prefer to find a way to get Eclipse to actually recognize these tags/attributes because they work just fine.
The namespace http://www.w3.org/2000/svg does not seem to be recognised by your eclipse installation. Try either of:
Adding the namespace to your XML catalog (in Window > Preferences), including the schema for svg, or
Specifying the schema inline, as attributes of the svg element:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://www.w3.org/TR/2002/WD-SVG11-20020108/SVG.xsd"
(or wherever your local copy of the schema is)

Error while connecting Eclipse IDE to run the Flex 4.5.1 SDK

I want to run the Flex SDK 4.5.1 on Eclipse IDE. I have followed this http://www.seanhsmith.com/2010/03/29/flex-for-free-setting-up-the-flex-4-sdk-with-eclipse-ide/
step by step and it was same as it was written.
But then when i first built my sample code and ran it, it gave me these errors. I cant figure out what the problem is:
This is the sample code:
and these are the ERRORS:
Loading configuration file C:\Mario's Files\STF\Flex SDK\flex_sdk_4.5.1.21328\frameworks\flex-config.xml
_application_Styles.as(24): col: 38 Error: Syntax error: expecting rightparen before s.
[Embed(_resolvedSource='C:/Mario's Files/STF/Flex SDK/flex_sdk_4.5.1.21328/frameworks/libs/framework.swc$Assets.swf', symbol='mx.skins.cursor.BusyCursor', source='C:/Mario's Files/STF/Flex SDK/flex_sdk_4.5.1.21328/frameworks/libs/framework.swc$Assets.swf', original='Assets.swf', _line='194', _pathsep='true', _file='C:/Mario's Files/STF/Flex SDK/flex_sdk_4.5.1.21328/frameworks/libs/framework.swc$defaults.css')]
^
Any solutions?
Do we have to get a compatible Eclipse-FlexSDK-Flash version??
The ' in "Mario's Files" throws off the parser, because it assumes the path ends there. Your folder names should not have a ' in it, ever. Call the folder "Marios Files" and you're fine.
Read up on String delimiters and escape characters, it's knowledge you will need anyway at some point.
This question might also be off-topic.

Unable to properly link external Java library in Eclipse

I've been struggling to properly integrate this Netflix Java Client to access Netflix's API into a very basic Eclipse Java Web Project.
Whenever I try to publish any content referring to this library, I get errors like the following, indicating an inability to resolve the type of the classes in the external library I'm trying to use.
Aug 20, 2011 11:48:42 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [jsp] in context with path [/OSNet03] threw exception [Unable to compile class for JSP:
An error occurred at line: 19 in the jsp file: /index.jsp
NetflixAPIClient cannot be resolved to a type
16: String myConsumerKey = new String("cefjbgekg7566cqrp2atua2n");
17: String myConsumerSecret = new String("redacted");
18:
19: NetflixAPIClient apiClient = new NetflixAPIClient(myConsumerKey, myConsumerSecret);
20: String uri = APIEndpoints.MOVIE_URI + "/2361637";
21: String details = null;
At the top of the file I include the proper class directories like this:
<%# page import="com.netflix.api.*" %>
<%# page import="com.netflix.api.client.*" %>
<%# page import="com.netflix.api.client.dal.*" %>
And I don't receive any errors from Eclipse telling me it can't resolve the classes. Only once I publish it to the server does this error occur.
I've tried building with jre7 and jdk1.7.0. The library I'm trying to work with includes elements that are from Java v6 and v5.
I included the library by building it with Maven and placing the directory in my WEB-INF/lib folder and then including the jar netflix-client-2.3-SNAPSHOT.jar in my Build Path.
I've looked all over the web for possible causes and tried every prescribed solution I've found but none have worked.
You may be able to tell I'm very new to using Eclipse and Java Web Programming but I'm trying to figure things out as best I can as I go.
check if build automatically is on :P. if not try turning it on for once.
if yes then check the project build path and look for libraries. check if the correct jars are there.
also check if your jars are not corrupted.
these are the usual problems for more wait for sm1 else to answer.
you could also try searching for the resource class that can't be resolved using Ctrl+Shift+R and see if the class turns up.
if you don't get it, then just extract the jar and see if the class is there for real.

How to Import Namespace on ASP.net Page

I have created a Class named SearchableGridView in my App_Code directory. I'm using
<Assembly: TagPrefix("MyApp.WebControls", "SearchGridView")>
Namespace MyApp.WebControls
I have referenced it in web.config as:
<add namespace="MyApp.WebControls"/>
I have also included the following on my content page:
<%# Import Namespace="MyApp.WebControls" %>
<asp:SearchGridView ID="SearchGridView1" runat="server">
</asp:SearchGridView>
However, when I build the project, I receive the error:
Warning 1 Element 'SearchGridView' is not a known element. This can occur if there is a compilation error in the Web site, or the web.config file is missing.
How do I rectify this situation?
Thanks much for your help and guidance!