Win a copy of Event Streams in Action this week in the Java in General forum!

prabhat kumar

Ranch Hand
+ Follow
since Apr 11, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by prabhat kumar

Originally posted by N Nanda:
Hi all,

I am using struts 1.1 with Tomcat5.0.16 for my project. I have configured tomcat's server.xml file and set my own context (its in D:\myweb). Not I want to have my own log file in D:\myweb\WEB-INF\logs folder. can anyone help me how i can do it. Its an urgency.

Thanks in advance.

N Nanda



download log4j, place in lib directory of webapps/lib

configure your log4j.properties like below and put it under web-inf/classes

# Global logging configuration
log4j.rootLogger=WARN, fileout, stdout
# replace com.lecare with your package names for which you want logging support
log4j.logger.com.lecare=DEBUG

# Console output...
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p %d{HH:mm:ss} [%t] - %m%n

# Rolling log file output...
log4j.appender.fileout=org.apache.log4j.RollingFileAppender
log4j.appender.fileout.File=c:/actions.log
#log4j.appender.fileout.File=c:/webserve/log/actions.log
log4j.appender.fileout.MaxFileSize=1024KB
log4j.appender.fileout.MaxBackupIndex=5
log4j.appender.fileout.layout=org.apache.log4j.PatternLayout
log4j.appender.fileout.layout.ConversionPattern=%5p %d{dd MMM HH:mm:ss} [%t] (%F:%L) - %m%n



import logging classes:
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

declare logger for the class
private Log logger = LogFactory.getLog(this.getClass());


for more information on using log4j read log4j documentation.
15 years ago
as i understood the problem .. you need to first know the value of user then do some work and then deliver the image.
this can be done in this way ..

1. create a servlet with the name gif in package test .. so that it can be called like
2. set the contenttype for gif image type like this
response.setContentType("image/jpeg"); //change for fig images
3. extract parameter
String user = request.getParameter("user");
4. forward to actual image
response.sendRedirect("http://www.abc.com/grafik/pic.jpg");
15 years ago
JSP
use collection instead of Vector.
15 years ago
use this class to know the general properties of image files.
everything is included in the code. just go through it. :-)

15 years ago
JSP
download sqlserver jdbc driver from micrsoft.
use thise code to connect:
replace the respective variables.

one possibility is to use applicationresources. like this:
struts finds the client language from the request and calls the specific applicationresource file automatically.
suppose the name of your application resource file is
ApplicationResources.properties => this file is used for default language/English
now if oyu want to add support German language the create a new resource file with same name .. but add _de at the end like this:
ApplicationResources_de.properties => now when struts finds an german request then it will load the resources from ApplicationResources_de.properties file.

===========
using resources:
resources can be used by bean:message tag like :
<bean:message key="title.login"/>
entries in respectives files looks like =>
default:
title.login=New Admin console
_de:
title.login=Admin Konsole
15 years ago
one possibility is to use applicationresources. like this:
struts finds the client language from the request and calls the specific applicationresource file automatically.
suppose the name of your application resource file is
ApplicationResources.properties => this file is used for default language/English
now if oyu want to add support German language the create a new resource file with same name .. but add _de at the end like this:
ApplicationResources_de.properties => now when struts finds an german request then it will load the resources from ApplicationResources_de.properties file.

===========
using resources:
resources can be used by bean:message tag like :
<bean:message key="title.login"/>
entries in respectives files looks like =>
default:
title.login=New Admin console
_de:
title.login=Admin Konsole
15 years ago

Originally posted by Zak Nixon:
After logging the user out, can I send the browser to another URL like
http://www.google.com or something to that nature, but not another page within the application....

Thanks

Zak[/QB]



You can do that like this in action code and struts-config

Action code:

struts-config:
remember to set the redirect="true"
15 years ago

Originally posted by Zak Nixon:
I do the following:


But using the response.sendRedirect(..), seems not to work.

Is there any other way to accomplish that?
Zak[/QB]



it can be done like this:
declare a global forward like this in struts config;

<global-forwards>
<forward name="login" path="/Login.do"/>

Login.do has an entry under action mappings
<action-mappings>
<action path="/Login" forward="/admin/login.jsp" type="org.apache.struts.actions.ForwardAction"/>

you may declare actions mappings to suit your needs.

15 years ago
it is simple ..
use
getServletContext().getRealPath("/") ;
16 years ago
use blob fields to store binary data.
i am pasting some code. hope u can figure out hot to to the things..
for converting to sql.Date type
look at xml.apache.org
in FOP project
[ October 30, 2002: Message edited by: prabhat kumar ]
16 years ago
JSP
one more thing can also be done is to use page cachinng mechanism.
16 years ago
it is not possible to give any predefined value to "input type=file" for security reasons. as you do not have any rights on client machine.
if you want.. then use activex controls, this is the only way.
16 years ago
JSP