You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by jamestastic <ja...@gmail.com> on 2007/10/26 20:00:42 UTC

What actually processes a JSP file?

Digging down into the code, I'm trying to figure out exactly what class(es)
open a .jsp file, and populate it with values from the OgnlValueStack.

Any ideas?
-- 
View this message in context: http://www.nabble.com/What-actually-processes-a-JSP-file--tf4698875.html#a13432429
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [struts] What actually processes a JSP file?

Posted by Dale Newfield <Da...@Newfield.org>.
I believe there are lots of ways that JSP engines work.  Here's how the 
one in tomcat works:
In my app I have a file named login.jsp.
Inside $CATLINA_HOME (at work/Catalina/localhost/myapp/org/apache/jsp) 
it automatically creates login_jsp.java
Which it then compiles to login_jsp.class
Which it then loads and uses.  This java code calls tag libraries, etc. 
where the OGNL you were asking about earlier might get evaluated.

That class extends org.apache.jasper.runtime.HttpJspBase and implements 
org.apache.jasper.runtime.JspSourceDependent.

HttpJspBase implements javax.servlet.jsp.HttpJspPage, 
javax.servlet.jsp.JspPage, java.io.Serializable, javax.servlet.Servlet, 
javax.servlet.ServletConfig so I assume that's the Servlet you're 
looking for, and likely dictates the lifecycle of org.apache.jsp.login_jsp.

I think this process is related to why you can't serve .jsp content from 
inside .jar's (causing strife to those building struts2 plugins).

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: What actually processes a JSP file?

Posted by Dave Newton <ne...@yahoo.com>.
--- jamestastic <ja...@gmail.com> wrote:
> The problem is I'm trying to integrate Struts2 into
> an application which has a different servlet
container
> already embedded in it.

What do you mean, a "different servlet container"?

What Java app server are you using that doesn't
process JSP files?

d.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: What actually processes a JSP file?

Posted by jamestastic <ja...@gmail.com>.
The problem is I'm trying to integrate Struts2 into an application which has
a different servlet container already embedded in it.

This servlet container, when it receives the forward() from the
ServletDispatcherResult, looks for a servlet to handle the new request.  I
now see this new servlet should be a JspServlet (or equivalent).

I just need to figure out how to properly instantiate a JspServlet so it
will happily process the new request.


Wes Wannemacher wrote:
> 
> On 10/26/07, jamestastic <ja...@gmail.com> wrote:
>>
>> But Tomcat doesn't directly know about ValueStacks.  It seems there must
>> be
>> some Struts2 component which handles this part.  Not to mention all the
>> Struts2 helper classes for processing Struts2 markup in JSP files.
> 
> You're right, tomcat doesn't know about the ValueStack, but the
> Struts2 tags do.
> 
>>
>> After my Action has completed, I've traced the ServletDispatcherResult to
>> call dispatcher.forward(request, response), but I can't figure out what
>> happens next.
>>
>> It's almost like there's another servlet which takes the result, opens &
>> processes the JSP, and writes it to the servletResponse output stream.
>>
>> I'm really stuck here.
>>
> 
> I think you're overthinking things. There is definitely magic that
> happens, but struts2 doesn't do anything to the JSP files (AFAIK). A
> good place to start if you are really curious is -
> 
> http://struts.apache.org/2.0.9/docs/big-picture.html
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/What-actually-processes-a-JSP-file--tf4698875.html#a13434593
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: What actually processes a JSP file?

Posted by Wes Wannemacher <we...@wantii.com>.
On 10/26/07, jamestastic <ja...@gmail.com> wrote:
>
> But Tomcat doesn't directly know about ValueStacks.  It seems there must be
> some Struts2 component which handles this part.  Not to mention all the
> Struts2 helper classes for processing Struts2 markup in JSP files.

You're right, tomcat doesn't know about the ValueStack, but the
Struts2 tags do.

>
> After my Action has completed, I've traced the ServletDispatcherResult to
> call dispatcher.forward(request, response), but I can't figure out what
> happens next.
>
> It's almost like there's another servlet which takes the result, opens &
> processes the JSP, and writes it to the servletResponse output stream.
>
> I'm really stuck here.
>

I think you're overthinking things. There is definitely magic that
happens, but struts2 doesn't do anything to the JSP files (AFAIK). A
good place to start if you are really curious is -

http://struts.apache.org/2.0.9/docs/big-picture.html

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: What actually processes a JSP file?

Posted by Chris Pratt <th...@gmail.com>.
On 10/26/07, jamestastic <ja...@gmail.com> wrote:
>
> org.apache.jasper.servlet.JSPServlet looks interesting.
>
> Could the RequestDispatcher be invoking a JSPServlet to compile a JSP on the
> fly, then populate it according to my ValueStack?
>

Yes, Jasper is a very common JSP Servlet (but it's not the only one).
But it never access the ValueStack itself (in fact it knows nothing
about it).  The ValueStack access happens in the tag libraries.
  (*Chris*)

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: What actually processes a JSP file?

Posted by jamestastic <ja...@gmail.com>.
org.apache.jasper.servlet.JSPServlet looks interesting.

Could the RequestDispatcher be invoking a JSPServlet to compile a JSP on the
fly, then populate it according to my ValueStack?




jamestastic wrote:
> 
> But Tomcat doesn't directly know about ValueStacks.  It seems there must
> be some Struts2 component which handles this part.  Not to mention all the
> Struts2 helper classes for processing Struts2 markup in JSP files.
> 
> After my Action has completed, I've traced the ServletDispatcherResult to
> call dispatcher.forward(request, response), but I can't figure out what
> happens next.
> 
> It's almost like there's another servlet which takes the result, opens &
> processes the JSP, and writes it to the servletResponse output stream.
> 
> I'm really stuck here.
> 
> 
> 
> Wes Wannemacher wrote:
>> 
>> Your app server (tomcat, WAS, etc.) compiles/serves the JSP files. The
>> request is dispatched to the app server eventually.
>> 
>> -W
>> 
>> On 10/26/07, jamestastic <ja...@gmail.com> wrote:
>>>
>>> Digging down into the code, I'm trying to figure out exactly what
>>> class(es)
>>> open a .jsp file, and populate it with values from the OgnlValueStack.
>>>
>>> Any ideas?
>>> --
>>> View this message in context:
>>> http://www.nabble.com/What-actually-processes-a-JSP-file--tf4698875.html#a13432429
>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>> 
>> 
>> -- 
>> Wesley Wannemacher
>> President, Head Engineer/Consultant
>> WanTii, Inc.
>> http://www.wantii.com
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/What-actually-processes-a-JSP-file--tf4698875.html#a13433739
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: What actually processes a JSP file?

Posted by jamestastic <ja...@gmail.com>.
But Tomcat doesn't directly know about ValueStacks.  It seems there must be
some Struts2 component which handles this part.  Not to mention all the
Struts2 helper classes for processing Struts2 markup in JSP files.

After my Action has completed, I've traced the ServletDispatcherResult to
call dispatcher.forward(request, response), but I can't figure out what
happens next.

It's almost like there's another servlet which takes the result, opens &
processes the JSP, and writes it to the servletResponse output stream.

I'm really stuck here.



Wes Wannemacher wrote:
> 
> Your app server (tomcat, WAS, etc.) compiles/serves the JSP files. The
> request is dispatched to the app server eventually.
> 
> -W
> 
> On 10/26/07, jamestastic <ja...@gmail.com> wrote:
>>
>> Digging down into the code, I'm trying to figure out exactly what
>> class(es)
>> open a .jsp file, and populate it with values from the OgnlValueStack.
>>
>> Any ideas?
>> --
>> View this message in context:
>> http://www.nabble.com/What-actually-processes-a-JSP-file--tf4698875.html#a13432429
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 
> -- 
> Wesley Wannemacher
> President, Head Engineer/Consultant
> WanTii, Inc.
> http://www.wantii.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/What-actually-processes-a-JSP-file--tf4698875.html#a13433156
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: What actually processes a JSP file?

Posted by Wes Wannemacher <we...@wantii.com>.
Your app server (tomcat, WAS, etc.) compiles/serves the JSP files. The
request is dispatched to the app server eventually.

-W

On 10/26/07, jamestastic <ja...@gmail.com> wrote:
>
> Digging down into the code, I'm trying to figure out exactly what class(es)
> open a .jsp file, and populate it with values from the OgnlValueStack.
>
> Any ideas?
> --
> View this message in context: http://www.nabble.com/What-actually-processes-a-JSP-file--tf4698875.html#a13432429
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Wesley Wannemacher
President, Head Engineer/Consultant
WanTii, Inc.
http://www.wantii.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: What actually processes a JSP file?

Posted by Chris Pratt <th...@gmail.com>.
The JSP is processed by your servlet container, but it delegates to
the tag libraries whenever it encounters a custom tag.  The OGNL Value
Stack access happens (mostly) in the Struts 2 <s:...> tag library.
  (*Chris*)

On 10/26/07, jamestastic <ja...@gmail.com> wrote:
>
> It looks like there's a ServletHolder which tells a servlet to process the
> JSP file.  I just can't figure out what that servlet is.
>
> Hmm...
>
>
>
>
> jamestastic wrote:
> >
> > Digging down into the code, I'm trying to figure out exactly what
> > class(es) open a .jsp file, and populate it with values from the
> > OgnlValueStack.
> >
> > Any ideas?
> >
>
> --
> View this message in context: http://www.nabble.com/What-actually-processes-a-JSP-file--tf4698875.html#a13433406
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: What actually processes a JSP file?

Posted by jamestastic <ja...@gmail.com>.
It looks like there's a ServletHolder which tells a servlet to process the
JSP file.  I just can't figure out what that servlet is.

Hmm...




jamestastic wrote:
> 
> Digging down into the code, I'm trying to figure out exactly what
> class(es) open a .jsp file, and populate it with values from the
> OgnlValueStack.
> 
> Any ideas?
> 

-- 
View this message in context: http://www.nabble.com/What-actually-processes-a-JSP-file--tf4698875.html#a13433406
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org