You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by David Thielen <da...@windward.net> on 2006/01/20 17:49:37 UTC
A couple of simple questions
Hi;
1) I want my default page to be index.do so I set the following in web.xml:
<welcome-file-list>
<welcome-file>index.do</welcome-file>
</welcome-file-list>
But instead I get a directory of files in my root when I go to the servlet.
I can do this which works:
<welcome-file-list>
<welcome-file>index.txt</welcome-file>
</welcome-file-list>
It appears it wants a file. Not an issue (see item 2) but just wanted to
know what is going on.
2) My main page is a frameset. I tried having that be a do/jsp but when I
pressed refresh on the browser, it went back to the start page. So I made it
a html file and the three frames are .do urls. This works fine, I'm just
asking if this is the best way to do this.
3) I need to have a method called when the servlet first loads. Is a
listener the best way to do this?
4) When using IE on an ASP application, there is a way to click on a word
document in the browser, it brings up Word to edit the document, and when
you save the document in Word, it uploads it back to the website.
a. Is there a way to do this in the J2EE world?
b. And if not, what is the best way to provide similar functionality? I
dislike the idea that they save it locally and then need to browse for the
saved document to upload it - most people have no idea where their temporary
folder is.
5) Is there a way that the appserver can tell me what to use for logging? I
don't want my portal to use log4j if the rest of the app server is using
something else.
6) I will have to create a jpg file that is displayed with some pages. I
want to delete the jpg when it is no longer needed. If the user hits refresh
on their browser, I still need it. Should I delete when the user's session
ends (timeout or logout)?
7) What do you think of hibernate? I have used it once and it seems to me
that it moves the work, but does not reduce it.
Thanks - dave
David Thielen
<http://www.windwardreports.com> www.windwardreports.com
303-499-2544
Re: A couple of simple questions
Posted by Raghu Kanchustambham <kr...@gmail.com>.
> 4) When using IE on an ASP application, there is a way to click on a word
> document in the browser, it brings up Word to edit the document, and when
> you save the document in Word, it uploads it back to the website.
>
> a. Is there a way to do this in the J2EE world?
> b. And if not, what is the best way to provide similar functionality? I
> dislike the idea that they save it locally and then need to browse for the
> saved document to upload it - most people have no idea where their temporary
> folder is.
You can try an ActiveX control and use javascript to interact with it.
I am not too sure if anything in "J2EE" gives you something "out of
the box" for this situation.
> 6) I will have to create a jpg file that is displayed with some pages. I
> want to delete the jpg when it is no longer needed. If the user hits refresh
> on their browser, I still need it. Should I delete when the user's session
> ends (timeout or logout)?
Or regenerate that image if not too expensive an operation and is possible.
> 7) What do you think of hibernate? I have used it once and it seems to me
> that it moves the work, but does not reduce it.
Hibernate is a good OR mapping f/w if you have control over your table
structures and if you are building everything from scratch. Some
people complain that it tends to "dictate" the DB schema design to a
certain extent. Honestly, for the value it brings to the table, I do
not see that the little 'intrusion' is really bothersome.
It ofcourse reduces work. Try implementing caching and other stuff all
yourself, and you might well be re-inventing the wheel ! Try using
XDoclet to generate your mapping files and it should be quite
convenient to maintain it too.
I have not worked on iBATIS but I hear that is also a very good f/w
that you may want to look at and consider.
~raghu
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: A couple of simple questions
Posted by Dave Newton <ne...@pingsite.com>.
David Thielen wrote:
> 3) I need to have a method called when the servlet first loads. Is a
> listener the best way to do this?
>
What servlet?
> 4) When using IE on an ASP application, there is a way to click on a word
> document in the browser, it brings up Word to edit the document, and when
> you save the document in Word, it uploads it back to the website.
>
> a. Is there a way to do this in the J2EE world?
>
I'm not aware that this has anything to do with J2EE. But let me know if
it does, 'cuz we could probably use the same functionality.
> b. And if not, what is the best way to provide similar functionality? I
> dislike the idea that they save it locally and then need to browse for the
> saved document to upload it - most people have no idea where their temporary
> folder is.
>
Hack Word? WebDAV?
> 5) Is there a way that the appserver can tell me what to use for logging? I
> don't want my portal to use log4j if the rest of the app server is using
> something else.
>
I guess that would depend on your appserver.
The Servlet API has two logging methods that I suppose you could use.
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/index.html
But... I'd just use Log4J. A lot of components you'll probably be using
use it too. Handy.
> 6) I will have to create a jpg file that is displayed with some pages. I
> want to delete the jpg when it is no longer needed. If the user hits refresh
> on their browser, I still need it. Should I delete when the user's session
> ends (timeout or logout)?
>
"Should" implies a level of obligation I'm uncomfortable with in this
context.
If you don't want it after the user's session has ended, then sure. If
you only need it here and there, how high is the cost of the image
generation (i.e. is the cost of always creating it to high?) What if you
cached it (i.e. don't persist it to disk), retrieve it with a servlet
(or action), then just let it go away when nobody uses it again?
> 7) What do you think of hibernate? I have used it once and it seems to me
> that it moves the work, but does not reduce it.
>
Compared to what? Does your application demand a full-blown ORM? There
are plenty of other options (iBatis, straight JDBC, JDBC w/ Spring,
Torque, etc.) Heck, I wrote a large intranet app. using JDBC hidden
behind a couple of utility classes that wrapped up exceptions etc.,
threw the result sets into DynaRowSets (or something like that; don't
remember now) and that was more than sufficient.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: A couple of simple questions
Posted by Dave Newton <ne...@pingsite.com>.
David Thielen wrote:
> 3) I am using struts so struts is the servlet and owns the init method,
> unless I have missed something. So my understanding is there is no init
> method for my code???
>
_What_ code? What specifically are you trying to accomplish?
If, say, you're trying to put something into the application context,
then write a servlet, implement its init method, give it a
load-on-startup, and you're all set.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: A couple of simple questions
Posted by David Thielen <da...@windward.net>.
2) That's what I thought too. What is weird is if my main page in a html
file and I click refresh, it does not change the pages in each frameset
(which is what I want). But if that main page was a jsp page, then it set
the frameset pages to what the main page set them too, as opposed to what
they had been changed to by my menu.
3) I am using struts so struts is the servlet and owns the init method,
unless I have missed something. So my understanding is there is no init
method for my code???
Thanks - dave
> 2) My main page is a frameset. I tried having that be a do/jsp but when I
> pressed refresh on the browser, it went back to the start page. So I made
it
> a html file and the three frames are .do urls. This works fine, I'm just
> asking if this is the best way to do this.
What do you mean 'went back to the start page'? Remember that refreshing
a page that uses framesets refreshes the *frameset*, not the frames
within it.
> 3) I need to have a method called when my servlet first loads. Is a
> listener the best way to do this?
If it's your servlet, just implement its init() method. If you want to
call other code on load of an arbitrary servlet there are various
listener interfaces you can implement and register in web.xml.
ServletContextListener [1] is probably the one you want in this case.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: A couple of simple questions
Posted by "David G. Friedman" <hu...@ix.netcom.com>.
I bet you wish more web servers were like WebLogic which have provisions for.
allows Servlets to be used for welcome pages. If interested, the link is:
http://e-docs.bea.com/wls/docs81/webapp/components.html#109211
I remember trying this on Tomcat 5.X after reading that note but I really don't remember if it worked or not. Probably
not.
Regards,
David Friedman / humble@ix.netcom.com
-----Original Message-----
From: news [mailto:news@sea.gmane.org]On Behalf Of Laurie Harper
Sent: Monday, January 23, 2006 4:43 PM
To: user@struts.apache.org
Subject: Re: A couple of simple questions
David Thielen wrote:
> Asking again - thanks - dave
>
> -----Original Message-----
> Hi;
>
> 1) I want my default page to be index.do so I set the following in web.xml:
> <welcome-file-list>
> <welcome-file>index.do</welcome-file>
> </welcome-file-list>
>
> But instead I get a directory of files in my root when I go to the servlet.
> I can do this which works:
> <welcome-file-list>
> <welcome-file>index.txt</welcome-file>
> </welcome-file-list>
>
> It appears it wants a file. Not an issue (see item 2) but just wanted to
> know what is going on.
You're right, you can only use physical files as welcome files. The
servlet spec doesn't support dynamic resources for this use. The
standard solution is to use an index.jsp that simply forwards or
redirects to a Struts action.
> 2) My main page is a frameset. I tried having that be a do/jsp but when I
> pressed refresh on the browser, it went back to the start page. So I made it
> a html file and the three frames are .do urls. This works fine, I'm just
> asking if this is the best way to do this.
What do you mean 'went back to the start page'? Remember that refreshing
a page that uses framesets refreshes the *frameset*, not the frames
within it.
> 3) I need to have a method called when my servlet first loads. Is a
> listener the best way to do this?
If it's your servlet, just implement its init() method. If you want to
call other code on load of an arbitrary servlet there are various
listener interfaces you can implement and register in web.xml.
ServletContextListener [1] is probably the one you want in this case.
L.
[1]
http://tomcat.apache.org/tomcat-5.0-doc/servletapi/javax/servlet/ServletContextListener.html
---------------------------------------------------------------------
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: A couple of simple questions
Posted by Laurie Harper <la...@holoweb.net>.
David Thielen wrote:
> Asking again - thanks - dave
>
> -----Original Message-----
> Hi;
>
> 1) I want my default page to be index.do so I set the following in web.xml:
> <welcome-file-list>
> <welcome-file>index.do</welcome-file>
> </welcome-file-list>
>
> But instead I get a directory of files in my root when I go to the servlet.
> I can do this which works:
> <welcome-file-list>
> <welcome-file>index.txt</welcome-file>
> </welcome-file-list>
>
> It appears it wants a file. Not an issue (see item 2) but just wanted to
> know what is going on.
You're right, you can only use physical files as welcome files. The
servlet spec doesn't support dynamic resources for this use. The
standard solution is to use an index.jsp that simply forwards or
redirects to a Struts action.
> 2) My main page is a frameset. I tried having that be a do/jsp but when I
> pressed refresh on the browser, it went back to the start page. So I made it
> a html file and the three frames are .do urls. This works fine, I'm just
> asking if this is the best way to do this.
What do you mean 'went back to the start page'? Remember that refreshing
a page that uses framesets refreshes the *frameset*, not the frames
within it.
> 3) I need to have a method called when my servlet first loads. Is a
> listener the best way to do this?
If it's your servlet, just implement its init() method. If you want to
call other code on load of an arbitrary servlet there are various
listener interfaces you can implement and register in web.xml.
ServletContextListener [1] is probably the one you want in this case.
L.
[1]
http://tomcat.apache.org/tomcat-5.0-doc/servletapi/javax/servlet/ServletContextListener.html
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: A couple of simple questions
Posted by David Thielen <da...@windward.net>.
The servlet that I have created and am accessing via struts. (So it might be
more correct to say when my struts app is first called via the struts
servlet.)
Thanks - dave
David Thielen
www.windwardreports.com
303-499-2544
-----Original Message-----
From: Dave Newton [mailto:newton@pingsite.com]
Sent: Monday, January 23, 2006 11:53 AM
To: Struts Users Mailing List
Subject: Re: A couple of simple questions
David Thielen wrote:
> 3) I need to have a method called when my servlet first loads. Is a
> listener the best way to do this?
>
What servlet?
Dave
---------------------------------------------------------------------
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: A couple of simple questions
Posted by Dave Newton <ne...@pingsite.com>.
David Thielen wrote:
> 3) I need to have a method called when my servlet first loads. Is a
> listener the best way to do this?
>
What servlet?
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: A couple of simple questions
Posted by David Thielen <da...@windward.net>.
Asking again - thanks - dave
-----Original Message-----
Hi;
1) I want my default page to be index.do so I set the following in web.xml:
<welcome-file-list>
<welcome-file>index.do</welcome-file>
</welcome-file-list>
But instead I get a directory of files in my root when I go to the servlet.
I can do this which works:
<welcome-file-list>
<welcome-file>index.txt</welcome-file>
</welcome-file-list>
It appears it wants a file. Not an issue (see item 2) but just wanted to
know what is going on.
2) My main page is a frameset. I tried having that be a do/jsp but when I
pressed refresh on the browser, it went back to the start page. So I made it
a html file and the three frames are .do urls. This works fine, I'm just
asking if this is the best way to do this.
3) I need to have a method called when my servlet first loads. Is a
listener the best way to do this?
Thanks - dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org