Extraneous new lines in HTML output of JSP page
Hi
I have bunch of JSP fragments that I use while creating a composite view..Each one of them has server side comments that I use to document their functionality...
However when final JSP is generated and when I look at the HTML source (which I often need to) it is "chunked" - there is a about 50 blank lines inserted at the top of the page and then on each fragment about 10 or more blank lines.... Initially, I thought that the server side comments created new lines but after removing the comments and redeploying the problem still persists......
Is there a way to prevent these new lines from being generated? Especially the ones at the start of the document....
Thanks
That is not the only way. In your server's default web.xml, there should be a servlet definition for JSPs, something like this:
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>There is a possible init-param called trimSpaces which will do the job:
<init-param>
<param-name>trimSpaces</param-name>
<param-value>true</param-value>
</init-param>This may be only a Tomcat 5 feature, however.
Similar Messages
-
How can i render a dynamic html file in jsp page
Hi everybody,
i am trying to render a dynamic html file in jsp page with the result of querying a database.
The response of the query is a xml document. And i have a stylesheet to transfer it to html.
How can i render the html in a jsp file?I am using below code for HTML files
private var appFile:String="index.html";
if (StageWebView.isSupported)
currentState = "normal";
webView.stage = stage;
webView.viewPort = new Rectangle( 10, 130, (stage.stageWidth)-20, 750 );
var fPath:String = new File(new File("app:/assets/html/aboutus/"+ appFile).nativePath).url;
webView.loadURL(fPath);
addEventListener(ViewNavigatorEvent.REMOVING,onRemove);
else {
currentState = "unsupported";
lblSupport.text = "StageWebView feature not supported";
above code is working fine for me. -
Capture generated html output from jsf page in bean
Hi Member,
I have need to capture the html output coming form jsf page. means aftr rendering what html is displayed before user, we have need to get it in programm.
like if we use:
<h:dataTable......>
<h:colum>heloo</h:column>
</h:dataTable>
then their ouput will be:
<table>
<tr><td>heloo</td></tr>
</table>
and i have need of these complete line with <table> ......</table>
Please help me...
Thanks
Shailendra KumarThnx for quick reply.
But i want to capture it in render response phase. May it will be possible??? Is render response phase is responsible for generation of HTML format?? If yes then how can we capture output coming from this phase.
URLConnection if fine but it still hit server once. I don't want that. I want to store page html format during its view preparation for html.
Thanks
Shailendra Kumar -
Conditional HTML in a JSP page?
I've been scouring the help and web for about 2 hours and haven't found a way to do this yet.
What I'm trying to do is to conditionally generate attributes to a html tag via JSP, but everything I've tried (even stuff that's valid JSP) won't pass the JDeveloper HTML checks and it won't compile the JSP page.
Specifically, I'm trying to add a bgcolor attribute to a <tr> tag if conditions are met in data in the row, but everything I've tried to get the added data in the tag results in some error.
I've tried something like this in the HTML:
<tr <%= color %> >
and this from the java side:
if (rowCont > 20) {
out.prinln("<tr bgcolor=\"#c0c0c0\">);
else {
out.prinln("<tr>");
Both methods result in lots and lots of HTML errors and JDeveloper won't even compile the page. The hmtl way resutls in "name expected" errors, and the java way results in a bunch of "end tag doesn't match start tag" errors.
Any clues on ways to do this?
ThanksCan you send me a larger snippet of code from your JSP? I do pretty much the exact same thing in all of our JSP's in our app. If you have a uix:form tag, you'll need to wrap all html inside uix:rawText tags.
String colText = "class=\"OraTableCellText\" style=\"border-left:1px solid #CCCCCC;border-bottom:1px solid #CCCCCC\"";
<td <%=colText%> >Text here </td>
<td <%=colText%> >More Text </td>
-Teri
[email protected] -
Displaying html code in JSP page
Hi.
How do I display HTML code in an jsp page, so that the actual code is printet on the screen
fx:
<html>
<head>
</head>
<body>
</body>
</html>I can't get my reply to show properly, but the answer is;
Change < into < ; and > into > ;
but with the semi-colons stuck next to the < and > if you get my drift -
Access HTML Output of BSP Pages
Hi BSP Experts
We want to pass the (already rendered) HTML ouput from a BSP Page to a file because we want to use an external programm to make pdf files. (html to pdf creator)
What is the best way to achieve this? I was playing around with the classes CL_BSP_PAGE_CONTEXT and CL_BSP_WRITER_HTTP but I did not have success.
Any Ideas?
Thanks a lot
Rgds
Timo
Edited by: Timo Höllwarth on Nov 9, 2009 6:45 PMare you trying to get the html of the same page?
if yes
in onmanipulation event you can capture the final HTML using
DATA: httpbody TYPE string .
CALL METHOD response->if_http_entity~get_cdata
RECEIVING
data = httpbody.
or from some other page?
if yes
either using AJAX call or using cl_http_client class
Regards
Raja -
Inserting new line in script output based on character count
Dear All,
I want to print amount in words on cheque. Condition is if on the first line the character
count reaches 40 the rest words should be printed in next line. Also amount in word
should be printed on the same line.
I have the internal table values itab-amtwords(amount in words and ) itab-rbetr(amount in number)
I want to print them something like this -
Sixty seven crore eighty five lakh twelve thousand
fourty five 678512045.00
the amount in word should come in second line only. The amount in word if reaches certain point
the rest word should print in second line.
How to write the logic in script editor
Regards,
Sandeepthe amount in number should print in the second line.
2163126312.00
regards
sandeep
Edited by: Sandeep Sahoo on Apr 17, 2009 4:34 PM
Edited by: Sandeep Sahoo on Apr 17, 2009 4:38 PM -
How to display a html report on jsp page---urgent
i want to display a html report wen a tab is clicked.can any tell me how to do tat.
Didn't quite get your requirement. What do you mean by an HTML report?
-
Parse XML and Output to JSP page
I have a number of XML documents which are all formatted in the same way, just with different information in the fields.
I wish to parse the XML documents using DOM and output them to an XML page.
How would i go about doing this?
If you could write a small example or any websites that you think might help.
Thanks.I have the parsing working but i cant seem to figure out how to get information out of the parsed document and into variables.
This is a sample of my XML file
<?xml version="1.0"?>
<product code="QB-1226-AB">
<productName>Professional Floodlights</productName>
<description>PIR floodlights that are designed for professional installation. A faulty light requiring a return visit will cost far more than a quality light does in the first place. 3 year guarantee.</description>
<price>120</price>
<manufacturer>Black and Decker</manufacturer>
</product>I can get the productCode value out without any problems using
String name = attrs.getValue("code");
But if i try the same for any of the others i get null. I can accomplish this using DOM easily but i cant find anything at all about getting values out of it using SAX.
Any help would be greatly appreciated. -
Accessing session attribute in output jsp page
Hi i am not getting any output in jsp page...
i am getting just heading
i think some problem with Session attribute..
if so how to access session been in jsp page
my code is here
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%--
The taglib directive below imports the JSTL library. If you uncomment it,
you must also add the JSTL library to the project. The Add Library... action
on Libraries node in Projects view can be used to add the JSTL 1.1 library.
--%>
<%--
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
--%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Tauvex Search Output</title>
</head>
<body>
Tauvex Search Output
<table>
<c:forEach items="${myDataList}" var="myData">
<tr>
<td>${myData.Fitsfilename}</td>
<td>${myData.RA_START}</td>
<td>${myData.RA_END}</td>
<td>${myData.DEC_START}</td>
<td>${myData.DEC_END}</td>
<td>${myData.telescope}</td>
<td>${myData.STARTOBS}</td>
<td>${myData.ENDOBS}</td>
<td>${myData.FILTER}</td>
</tr>
</c:forEach>
</table>
<%--
This example uses JSTL, uncomment the taglib directive above.
To test, display the page like this: index.jsp?sayHello=true&name=Murphy
--%>
<%--
<c:if test="${param.sayHello}">
<!-- Let's welcome the user ${param.name} -->
Hello ${param.name}!
</c:if>
--%>
</body>
</html>
plz reply soon
thanks a lotthis is what i set in servlet
request.setAttribute("myDataList", myDataList);
request.getRequestDispatcher("someJspFile.jsp").forward(request, response);
how can i access that session attribute in jsp -
New line in echo in PHP?
Having finally got Apache and PHP, and a number of virtual
sites set up, I tried
David's file to print the date, and when it worked I started
to experiment. I
am starting to get the hang of it, but I can't get the
newline to work. It
would appear to me that the following test program should
have two new lines,
but they are both ignored.
<?php
echo "Time is ", date('H:i'), " on ", date(' F jS, Y'),"\n";
echo "\nThis should be on a new line";
?>
The page incorporating these lines can be seen at
http://www.corybas.com/Phptest2.php
ClancyIt doesn't when you see it in a browser. If you are going to
look at the
rendering in a browser, you need to use HTML, e.g.,
<?php echo 'Time is '.date('H:i').' on '.date("F jS,
Y').'<br />'; ?>
Using the \n\r combo, or any variant, will only show those
new lines when
you see the printed page, or the element is sent in an email.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"Clancy" <[email protected]> wrote in message
news:[email protected]..
> Joe Makowiec <[email protected]> wrote:
>
>><p><?php echo 'Time is ' . date('H:i') . '
on ' . date(' F jS, Y'); ?>
>></p>
>><p><?php echo 'This should be on a new
line'; ?> </p>
>>
>>PHP is used to create dynamic content; it's up to
you, the web
>>developer, to provide the html structure to display
that content.
>
> So although an escape sequence for \n is defined it
doesn't actually do
> anything?
>
>
> Clancy -
I added a line on Apple and ordered an Iphone 5s, this was on the 20th, still no email about the new line, nowhere on the my Verizon page about it. I talked to a person at a Verizon store, they said when my phone shipped it should show up, however it shipped 2 days ago and nothing, so what happens? Any help please, preferably from Verizon.
is your mute switch turned on (above the volume) ? remove case and screen protecter.
is volume turned up?
if so do this
account security
Please call apple @ 1-800-692-7753 in USA
ask for the account security team
you may want to add a credit card to your iTunes account before calling; so they will have a way to verify your identity.
Peace, Clyde
check # for your country
http://support.apple.com/kb/HE57
<Edited by Host> -
Struts can't display the input jsp page
Hello,
I'm using Struts 1.3.8 to construct a simple user registration system, in which the user could input his info (such as uuname and gpin, both are strings) in a jsp page, and after the submit, the system should go to a success page. However, somehow, when I access the url, it goes directly to the success page, but not stay at the input page.
Here is my {color:#ff0000}struts-xml.config{color}
bq. <?xml version="1.0" encoding="UTF-8"?> \\ <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd"> \\ <struts-config> \\ <form-beans> \\ <form-bean name="{color:#ff0000}anotherUserForm{color}" type="com.visualbuilder.struts.beans.AnotherUser" /> \\ </form-beans> \\ <!-- Global Exceptions --> \\ <global-exceptions></global-exceptions> \\ <!-- Global Forwards --> \\ <global-forwards> \\ <forward name="success" path="success.jsp"/> </global-forwards> \\ <!-- Action Mappings --> \\ <action-mappings> \\ <action path="/{color:#ff0000}addanotheruser{color}" type="com.visualbuilder.struts.action.AddAnotherUserAction" name="{color:#ff0000}anotherUserForm{color}" attribute="user" input="{color:#ff0000}/addanotheruser.jsp{color}" cancellable="true"> \\ </action> \\ </action-mappings> \\ <!-- Message Resources --> \\ <message-resources \\ parameter="registration.resources.ApplicationResources" /> \\ </struts-config>
My action class is:
package com.visualbuilder.struts.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.visualbuilder.struts.beans.AnotherUser;
public class AddAnotherUserAction extends Action {
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
if (isCancelled(request)) {
return mapping.findForward("welcome");
{color:#ff0000}AnotherUser anotherUser = (AnotherUser) form;{color}
System.out.println("UUName: " + anotherUser.getUuname() + "\tGPIN: " + anotherUser.getGpin());
{color:#ff0000}return mapping.findForward("success");{color}
My ActionForm class is:
package com.visualbuilder.struts.beans;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
public class AnotherUser extends ActionForm {
private static final long serialVersionUID = 1058901817587421984L;
private String uuname;
private String gpin;
public String getGpin() {
return gpin;
public void setGpin(String gpin) {
this.gpin = gpin;
public String getUuname() {
return uuname;
public void setUuname(String uuname) {
this.uuname = uuname;
@Override
public void reset(ActionMapping mapping, HttpServletRequest request) {
uuname = null;
gpin = null;
@Override
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
return errors;
The input jsp page is addanotheruser.jsp:
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Another User Registration</title>
</head>
<body>
<h1>Another User Registration</h1>
<html:errors />
<table>
{color:#ff0000}<html:form action="addanotheruser">{color}
<tr>
<td>UUName</td>
<td>{color:#ff0000}<html:text property="uuname"></html:text>{color}*</td>
</tr>
<tr>
<td>GPIN</td>
<td>{color:#ff0000}<html:text property="gpin"></html:text>{color}*</td>
</tr>
<tr>
<td><html:submit/></td>
<td><html:cancel/></td>
</tr>
</html:form>
</table>
</body>
</html>
Everytime I access http://localhost:9080/addanotheruser.do, it jumps to the success.jsp, but not stay at addanotheruser.jsp to wait for the user input, and in the server's console, I could see the output "UUName: null GPIN: null"
I've been stuck at this simple program for three days, could anybody help to find the errors? Thanks a lot.sorry, the post looks ugly. Does anybody know how to make the indent not disappear?
-
How to use extends attribute in jsp page directive
Can anybody tell how to extend a existing .jsp file from another .jsp file. I have tried but it gives error.
I have used Extends attribute of page directive as below:
<%@ page extends = "MyAnotherJsp.jsp"%>
I also tried : <%@ page extends = "MyAnotherJsp"%>
I am using Tomcat as a web server
Also tell where to put those files.
Thanks.Hi I am using Netbeans 5.5, Sun Java System Application Server 9.
ABC.java
package javapackage;
public class ABC{
public String show(){
return "Sandip Gaikwad";
index.jsp
<%@ page extends="javapackage.ABC" %>
<html>
<head>
<title>JSP Page</title>
</head>
<body>
<h1>JSP Page </h1>
</body>
</html>
Above code throws following exception at runtime:-
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
Generated servlet error:
[javac] F:\Sun\AppServer\domains\domain1\generated\jsp\j2ee-modules\Page_Extends_Attribute_Example\org\apache\jsp\index_jsp.java:36: getPageContext(javax.servlet.Servlet,javax.servlet.ServletRequest,javax.servlet.ServletResponse,java.lang.String,boolean,int,boolean) in javax.servlet.jsp.JspFactory cannot be applied to (org.apache.jsp.index_jsp,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,,boolean,int,boolean)
[javac] pageContext = _jspxFactory.getPageContext(this, request, response,
[javac] ^
[javac] 1 error
Server log
StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: Unable to compile class for JSP
Generated servlet error:
[javac] F:\Sun\AppServer\domains\domain1\generated\jsp\j2ee-modules\Page_Extends_Attribute_Example\org\apache\jsp\index_jsp.java:36: getPageContext(javax.servlet.Servlet,javax.servlet.ServletRequest,javax.servlet.ServletResponse,java.lang.String,boolean,int,boolean) in javax.servlet.jsp.JspFactory cannot be applied to (org.apache.jsp.index_jsp,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,<nulltype>,boolean,int,boolean)
[javac] pageContext = _jspxFactory.getPageContext(this, request, response,
[javac] ^
[javac] 1 error
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:94)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:384)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:461)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:528)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:507)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:495)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:530)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:412)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:318)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:278)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
If I delete the line <%@ extends="javapackage.ABC"%> it works fine. Please tell me what is wrong with this line. -
In producing a report table, for example, I'd like to have the JSP page access the
rowset from the Bean and then walk through the rowset a row at a time, formatting
output. All the examples I've found create the table code in the servlet. I'd like to
avoid that, creating the html in the JSP page only.hi,
I think You can do it in this way.
Store the values that you get from rowset in a hash table and set the return type of your bean method to hashtable. When you call the method in jsp assign the return value to a hash table. From there you can manipulate the objects in hash table.
Hope this works,
chandu
Maybe you are looking for
-
Difference between DESCRIBE TABLE..... and SY-DBCNT
Hi, i want to know the difference between DESCRIBE TABLE.. command and SY-DBCNT.
-
Ipod touch to control idvd-front row?
Hi everybody: Is there a way to have my Ipod touch control iDVD and Frontrow, I bought an early 09 imac and it didn't come with the remote. thanks Mike
-
Cannot Change Desktop Picture Anymore
Hi - Problem is described in the Header. And goes for ALL accounts incl. ROOT Account. Scenario: I open Sys Pref. Go to Desktop/ScreenSaver - it opens fine and I can click the images. They will even show in the little preview window in the top. The o
-
Cannot manage newly swapped STB from Android phone
Hi, Our single STB died the other day, and we just successfully installed the replacement. We can also see and manage (set up programs to record) on the replacement STB from the Verizon web site, so I know it's reachable from the Web. However, we ca
-
Swf works on desktop but nowhere else
I embedded a video in a flash swf file and published it to my desktop. Works fine--by itself and in the html file I created. But when I copy it to another directory, it will not work. I copied all of the files--the swf file, the html file and the "St