Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic VRML with JSP?

Status
Not open for further replies.

HoMyGod

Programmer
Jul 17, 2000
59
0
0
CH
Hello,

I would like to make my VRML more dynamic and I wonder if it is possible to use JSP to do that? and how?

Thank you for any answers

P.
 
The output of a JSP is simple text regardless of its content. Have the JSP selectively include VRML code to suit your needs. The simplest example I can think of is when you want the VRML to contain one of two objects but not both. Use an if statement in the JSP and have two branches which output the appropriate object's code. Ive tried to represent this logic below.

You may need database access or something to provide data on which to make a conditional statement. Alternatively you could have a servlet do this, which could then take data from a form and selectively include objects as necessary.

if(favouriteShape==cube && favouriteColor==red)
{
//add red cube to world
}

Im sure you get the idea :)
 
Thanks I totaly agree with you.

But now my problem is that if I am using a .jsp file, I can not launch the VRML player (Cosmo) with such an extension. To execute the jsp (the dynamic action), the user must call a .jsp file. How can I return a .WRL file (considering there can be multiple user at the same moment, I can not store a .WRL file on the harddisk!)

???

P.
 
P,

I've never worked with VRML but I would assume you need to set the content-type HTTP header correctly to identify the content of the HTTP response to the browser as VRML. This is no different than producing an image inside a JSP page and returning it's byte stream to the browser.

HttpServletResponse.setContentType("img/gif");

Hope this helps
-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top