Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp page appears in xml tree format. how can i fix this?

 
Joe Marchi
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello, im trying to run a simple example using JSP document using xml syntax but cannot display the content output as jsp. the page loads in xml tree format in the browser.

how do i display the content as jsp/html?

here is my html


it goes to a /searchcontroller.jsp file with the following code


public String getView() {
return "/emptysearch.jsp";
}



which forwards to this /emptysearch.jsp page



now when i enter the first html form it takes me to a page with xml tree for the above jsp instead of displaying it in jsp or html format. I have added the jsp:directive.page contentType="text/html; charset=ISO-8859-1" but it still doesnt display the page as a jsp..

please help
thanks


 
Devaka Cooray
ExamLab Creator
Marshal
Pie
Posts: 4117
195
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe Marchi wrote:I have added the jsp:directive.page contentType="text/html; charset=ISO-8859-1".....

Can you show us that code?
 
Joe Marchi
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the code for <jsp:directive.page contentType="text/html; charset=ISO-8859-1"/> is displayed in the jsp pages itself.

the web.xml simply redirects to a jsp page



thanks
 
Devaka Cooray
ExamLab Creator
Marshal
Pie
Posts: 4117
195
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe Marchi wrote:the code for <jsp:directive.page contentType="text/html; charset=ISO-8859-1"/> is displayed in the jsp pages above.

Sorry I didn't see that before.

I guess the problem is with the charset. I suggest you to replace ISO-8859-1 with UTF-8.
 
Joe Marchi
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Devaka, I tried replacing it by UTF-8 but still get the same xml tree in the browser i have tried IE and Firefox also to no avail.
 
Devaka Cooray
ExamLab Creator
Marshal
Pie
Posts: 4117
195
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Strange!
What's the server/container are you using?
Can you show us the exact output which is produced?

[Edited: to fix typo]
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, are you sure your container supports JSP XML (or whatever that's called)?
 
Joe Marchi
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using weblogic server 10.3. the page output is this:

---------------------------------------------------
This XML file does not appear to have any style information associated with it. The document tree is shown below.

−-----------------------------------------------
<html>

<head>
<title>Using Search Bean: no items found</title>
</head>

<body>
<h1>No items found</h1>

<form action="search">

<p>
Your search for "drege" returned no items. Try another search to find a match.
</p>

<p>
Search keywords:
<input type="text" size="30" name="keywords" value="drege"/>
</p>
<input value="Submit"/>
</form>
</body>
</html>


my web.xml looks like this:



my weblogic.xml looks like this



this example is out of the book j2ee applications and bea weblogic server second edition which would have probably worked for weblogic 8.1 but i am using weblogic 10.3.

not sure how to fix this!!!
 
Joe Marchi
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the weblogic container should display jsp documents for xml as its part of the jsp specification but something is not being flagged here or is not compatible ive tried to change the jsp:root version to 1.2 but i still get the same xml tree instead.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happens if you name the JSP file with a .jspx extension?
 
Joe Marchi
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it produces the same result could i send you the code perhaps to review?
 
Devaka Cooray
ExamLab Creator
Marshal
Pie
Posts: 4117
195
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe Marchi wrote:could i send you the code perhaps to review?

Please UseTheForumNotEmail

I've no clue of how this is happening. But I'm still thinking that it has something to do with the content type.
Just try this out:

 
Joe Marchi
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my bad this was actually resolved using the context type directive that i had used ealier.

i feel stupid for mentioning what mistake i made so i will keep it to myself
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe Marchi wrote:i feel stupid for mentioning what mistake i made so i will keep it to myself

That's too bad, because now nobody else will know at least one thing to avoid.
 
Devaka Cooray
ExamLab Creator
Marshal
Pie
Posts: 4117
195
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:That's too bad, because now nobody else will know at least one thing to avoid.

+1
 
Joe Marchi
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
out of respect to you, i actually created a second project with another context root and was making changes to it but displaying the output from the first context root therefore not really seeing the changes. Hey, caffeine can only do soo much at 3:00 am in the morning.

 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hopefully people will avoid changing one project and running another ;)

(I think we've all done that at one point or another--opened a file from another project by accident, edited it, then been baffled why the change "doesn't work". I've been doing it for decades :)
 
Devaka Cooray
ExamLab Creator
Marshal
Pie
Posts: 4117
195
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:we've all done that at one point or another

+1 again for that
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic