cancel
Showing results for 
Search instead for 
Did you mean: 

Static XSL getting ERROR RUNNING SERVLET without query in the servlet tag

Former Member
0 Kudos

Hi there,

I am attempting to have the page title bar included in the page dynamically from a static source.

For MII, the SERVLET tag seems perfect. So I did the code shown below.

When I include a QueryTemplate on the SERVLET it works fine. When I don't include the query

I get the ERROR RUNNING SERVLET message.

So the question is how do I include static html without running a query?

And a related question: In the welcomeMsg paragraph the doesn't get resolved to the value of the session param. It shows the string "".

(OK, so semi-static xsl. LOL)

Is there a way to have the actual displayname show up?

Thanks all,

--Amy Smith

--Haworth


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<ht   ml>
<he   ad>
<me  ta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</he  ad>
<bo  dy>
<SERVLET NAME="Illuminator">
<PARAM NAME="QueryTemplate" VALUE="APEX/Queries/EX/plantSelectionQuery"/>
<PARAM NAME="StyleSheet" VALUE="http://localhost:50000/XMII/CM/APEX/xsl/test.xsl"/>
<PARAM NAME="Content-Type" VALUE="text/xml"/>
</SERVLET>
</ht   ml>


<?xm  l ver   sion="1.0" encoding="UTF-8"?>
<xs  l:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xs  l:output method="html" media-type="text/html"/>
<x  sl:template match="/">
<x  sl:text disable-output-escaping="yes">
<![CD   ATA[
<di  v id="titleBar">
<di  v id="branding"></div>
<p id="welcomeMsg">Hello {displayname}</p>
<!-- Div hack to show the background color because other divs are floated -->
<div id="spacer"></div>
</div>




]]>

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I'd use a JSP page, not an IRPT page...you have direct access to session parameters from within JSP, plus you can do different types of includes...

Former Member
0 Kudos

Hi Rick,

I hadn't considered JSPs. Hmmm.

This would mean that all my pages would have to be JSPs. I hate to go way outside the norm.

I do like to stay on the fringes! The irpt seems to have some nice functionality.

I will search around the forum for discussions of the plus and minus and the how tos.

Any advice from your end?

Thanks Rick,

--Amy Smith

--Haworth

Former Member
0 Kudos

I revisited Rick's post

about server side includes. Great post BTW.

I'm going to try the BLS way. I'm assuming I can access session variables in BLS.

This may be the best way to go...

Thanks all,

--Amy Smith

--Haworth

Former Member
Former Member
0 Kudos

Hi again, Jeremy came up with a great way to do what I was trying to do because we can pass

params to the xsl.

The irpt file, note the use of the Simulator/Mode=List and the param holding the session variable value


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<htm l>
<he ad>
<m eta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</he ad>
<bo dy>
	<SER VLET NAME="Illuminator">
		<PARAM NAME="Server" VALUE="Simulator"/>
		<PARAM NAME="Mode" VALUE="ModeList"/>
		<PARAM NAME="Content-Type" VALUE="text/xml"/>
		<PARAM NAME="displayname" VALUE="{displayname}"/>
		<PARAM NAME="StyleSheet"
VALUE="http://localhost:50000/XMII/CM/APEX/test/xsl/test.xsl"/>
	</SER VLET>
</ht ml>

The xsl file, note the param declaration and the value-of with the $paramname


<?x ml version="1.0" encoding="UTF-8"?>
<x sl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xs l:output method="html" media-type="text/html"/>
<x sl:param name="displayname" />
<xs l:template match="/">
	<d iv id="titleBar">
	<di v id="branding"></div>
		<p id="welcomeMsg">Hello 
			<xsl:value-of select="$displayname"/>
		</p>
<!-- Div hack to show the background color because other divs are floated -->
		<di v id="spacer"></div>
	</di v>
</x sl:template>
</xs l:stylesheet>

This will make our title bar maintenance much easier. Every page will have a <SERVLET> where the

title bar goes. Today I learned how to pass params to xsl from the servlet tag. What did you

learn today?

Thanks,

--Amy Smith

--Haworth

jcgood25
Active Contributor
0 Kudos

Amy,

For transportability, this is the relative format you should use for referencing the xsl, so as to not lock yourself into http(s) or a fixed port number:

<PARAM NAME="StyleSheet" VALUE="/XMII/CM/APEX/test/xsl/test.xsl"/>

Glad to know your <SERVLET/> includes do the trick for your divyed up header.

Regards,

Jeremy

jcgood25
Active Contributor
0 Kudos

Amy,

I think you're missing some of the fundamental concepts here.

1. The SERVLET section is intended to run a query and effectively uses the Stylesheet as your 'display template' and in doing so write our server side generated dynamic html from the Rowsets/Rowset/Row dataset.

2. In an IRPT page curly brace tokens like will be automatically replaced by the server before streaming the web page content to the browser (it renders the SERVLET blocks at the same time). SCRIPT and STYLE blocks within the html syntax are ignored because they also contain . 3. Since you've embedded the token in your xsl output this will not work because it is treated as static text. It doesn't do the SERVLET and replacements in a recursive capacity - just the one level.

4. Since your xsl file just produces basic html objects and doesn't require any query dataset, why not just throw your syntax into the irpt page and let things happen naturally. If is in your session (see example page from your earlier post then it should be automatically substituted by the server before the browser ever gets the page. Simple test would also be ..PageName.irpt?displayname=Amy but this only does the pass-through and does not change the session. I believe or will give you the same 'Last, First' user name from the session as the standard MII personalization home page.

Regards,

Jeremy

Former Member
0 Kudos

Hey Jeremy

I DO understand the intent of the components. I also know that there is a significant amount of

information that is not documented. I also understand some fundamentals of app design. I believe refactoring is the one at work in this instance.

The title bar works just fine when embedded in the irpt page, the displayname shows up great.

Why would I copy the title bar to EVERY page in the system and then have to maintain it on

EVERY page in the system? I prefer to refactor stuff like that into a single source.

So, that said, I am trying to find a way to do that with MII. The irpt page with SERVLET tags

seems the way for me to accomplish this goal in MII. It works great, but seems to require I run

the query whose output I will never use and the {} didn't get replaced.

I was asking two questions. I am assuming from your response that the answer to both of these is no.

1. Can I run the SERVLET tag without a query? (I saw a post from Rick about this so copied the code.)

2. Will the {} work in the xsl?

As the answers are both no, I have a followup question.

In order to get the displayname into xsl is there a query I can run that will put the displayname into the rowset result of the query. Then I could use it in the xsl.

--Amy Smith

--Haworth

Former Member
0 Kudos

Is this an htm or irpt page?

If it is an htm page, change it to irpt and see if anything changes.