• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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


 
Sheriff
Posts: 7134
1360
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 7134
1360
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 7134
1360
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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]
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, are you sure your container supports JSP XML (or whatever that's called)?
 
Joe Marchi
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What happens if you name the JSP file with a .jspx extension?
 
Joe Marchi
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it produces the same result could i send you the code perhaps to review?
 
Devaka Cooray
Sheriff
Posts: 7134
1360
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 7134
1360
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 7134
1360
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:we've all done that at one point or another


+1 again for that
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic