Pawan Singh

Greenhorn
+ Follow
since Jun 05, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Pawan Singh

First of all Thanks for your quick reply.
I already read the documentation. ok, here is what I have done.

added
1- slf4j-api-1.6.6.jar, slf4j-simple-1.6.6.jar in my lib folder of WEB-INF/lib
2- log4j.properties file under src folder. ie inside classes foder. "src\log4j.properties"
log4j.properties consist of:
# [
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.rootLogger=DEBUG, stdout, R
#log4j.rootLogger=ERROR, stdout, R
log4j.appender.R.File=D:\\Projects\\SimpleJAVA\\Struts_Hibernate\\log4j.log
log4j.appender.R.MaxFileSize=10MB
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.MaxBackupIndex=100
log4j.appender.R.layout.ConversionPattern=%d %p %t %c - %m%n
log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.R=org.apache.log4j.RollingFileAppender
# ]
3- I used it as in my code like:
[
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HelloWorld {
public static void main(String[] args) {
Logger logger = LoggerFactory.getLogger(HelloWorld.class);
logger.info("Hello World");
logger.debug("In debug"); } }
]

4- What I want: whole logging output should be write to log4j.log file as mentioned in log4j.properties file
5- What's Happening whole logging out is visible in ide console, but not in log4j.log file. In log4j.log file only a very small output is there about 30-40 lines..which is meaningless.

Please help me , I think there is some mistake in log4j.properties file.
11 years ago
Form bean is neccessary in Struts 1.3, if you don't need to fetch the data, just create a FormBean without any Property.
11 years ago

I want to add Logger in my Application. I want every description of application or flow in my XXX.log file.
but since I am very new to it, I don't know anythink about it.
I added slf4j-api.jar + slf4j-simple.jar in my lib folder .... now after that what should I do for proper working of logger.

I also used in my classes as following code.

Logger logger=LoggerFactory.getLogger(HelloWorldAction.class);
logger.debug("ncjkdfbvkb");

other than this I don't know any think, please guide me.
please help me.
11 years ago
thanks this is working, for conform password, but I didn't resolve for issue I asked that what value we should place in

<var-name>****</var-name>
<var-value>****</var-value>

Thanks and regards,
Pawan Singh
11 years ago
Hi,
suppose you have 3 text fields in your jsp file, as *Name, *Age, *sex.
I want to validation at server-side. but I want to apply validation over *Sex field only when , *Age field returnes true at validation.
please reply by your comment.
11 years ago
init parameters are loaded along with servlet, that is at it's one time instanciation time, while attribute are the object which are passed , set, and get at run time when we need them......
11 years ago
I found the solution by my own
you just have to set the object in pagecontext.setattribute(String arg0, Object arg1)
then <html:link action="......" paramid="XXX" paramName="String arg0"/>

you can retrieve this parameter in your action class as :
request.getParameter("XXX"/paramid);


here in code view:


<%String mail=sf.getEmailid();
pageContext.setAttribute("emailid",mail);%>

<html:link action="/information" onfocus="focus()" paramId="mailid" paramName="emailid" scope="request"><font color="#00FF00">

<%= sf.getEmailid() %></font></html:link></td>
<%}%>



here sf.getEmailid() is a String type Object which i have to pass as a parameter from a jsp to action class in link form.
hope you like this , and definetly it will work.
11 years ago
I found the solution by my own
you just have to set the object in pagecontext.setattribute(String arg0, Object arg1)
then <html:link action="......" paramid="XXX" paramName="String arg0"/>

you can retrieve this parameter in your action class as :
request.getParameter("XXX"/paramid);


here in code view:


<%String mail=sf.getEmailid();
pageContext.setAttribute("emailid",mail);%>

<html:link action="/information" onfocus="focus()" paramId="mailid" paramName="emailid" scope="request"><font color="#00FF00">

<%= sf.getEmailid() %></font></html:link></td>
<%}%>



here sf.getEmailid() is a String type Object which i have to pass as a parameter from a jsp to action class in link form.
hope you like this , and definetly it will work.
11 years ago
Hi everyone,
Say you have a hyperlink list that's built in a loop. The number of items in the list can vary based on the records in the database use to build the list. The text for each link is created based on a database lookup.
Each element in the list has it's own personnel information. Clicking on any of the links in the list would take you to another JSP page, where I want to display "Detail" information for the link clicked in the previous JSP page.
Therefore, my (basic?) question is how can you send the next JSP page specific information about the link that was clicked to call it?
I have code in jsp like:

<%
List<SelectForm> list=(List<SelectForm>)request.getAttribute("list");
Iterator ir =list.iterator();
%><html:form>
<table cellpadding="1" cellspacing="1" border="1" align="left" style="font-family: cursive;">
<tr style="color: maroon;"><th bgcolor="Pink" style="width: 100px;"> Firstname </th><th bgcolor="Pink" style="width: 100px;"> Lastname </th><th bgcolor="Pink" style="width: 100px;"> Country </th><th bgcolor="Pink" style="width: 200px;"> EmailId </th></tr>
<%
while(ir.hasNext())
{
sf=(SelectForm)ir.next();
<tr><td>
<%= sf.getFirstname() %>
</td><td>
<%= sf.getLastname() %>
</td><td>
<%= sf.getCountry() %>
</td><td>
<html:link action="/information" onfocus="focus()"><font color="#00FF00">
<%= sf.getEmailid() %></font></html:link>
</td>
<%
}
%>
</table></html:form>
here sf.getemailid() is in link form.

Thanks in advance for any ideas.
11 years ago