Abebe Belew

Greenhorn
+ Follow
since Jul 21, 2004
Merit badge: grant badges
For More
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 Abebe Belew

Hi all.

I am trying to create a text file from a struts web app.
The owner of the file I create is root as my web app is owned by root.
How can I change the owner to myself? I tried running a shell script but doesnt seem to work. The OS = Linux red hat.

Thanks in advance for your help
16 years ago
Hi all.

I am trying to create a text file from a struts web app.
The owner of the file I create is root as my web app is owned by root.
How can I change the owner to myself? I tried running a shell script but doesnt seem to work. The OS = Linux red hat.

Thanks in advance for your help
16 years ago
Hi all,

I am trying to create a text file on a server from a struts web app.
The owner of the file created is root as the web app is running as root.
I want the owner of the file to be the user (the users have access to the machine). OS = Linux Red hat

Thanks so much
16 years ago
Hellow,
I am trying to integrate cewolf with a working struts app. and I am stuck.
I am not able to render a line chart in the jsp using this code but is seams to produce a bar chart if I change the chart type to verticalbar in the jsp,
what am I doing wrong? Please help. Below is code.

datasetProducer

public class ViewChart implements DatasetProducer, Serializable {

public String[] categories;
private int[] values;
public String[] seriesNames;


public ViewChart(Map map) {

categories = new String[map.size()];
seriesNames = new String[map.size()];
values = new int[map.size()];
Iterator iter = map.keySet().iterator();
int count = 0;
while(iter.hasNext()){
String key = iter.next().toString();
seriesNames[count] = key;
Double currentValue = (Double) map.get(key);
values[count] = currentValue.intValue();
categories[count] = " ";
count++;
}
}

public Object produceDataset(Map arg0) throws datasetProduceException {
DefaultCategoryDataset dataset = new DefaultCategoryDataset();

for (int i = 0; i < categories.length; i++) {
int currentValue = values[i];
dataset.addValue(currentValue, seriesNames[i], categories[i]);
}

return dataset;
}


16 years ago
Thanks for your reply.
I am testing this in two different machines, same browser.
The problem happens if tow users are accessing the app at the same exact time.
16 years ago
I put the userid in session variable at login. the login page is forwarded to setupAction upon successful login. In setupaction I get the session attrbute and display it in jsp.

The problem is with multiple users of the app simultinously. usr A logs in successfully. user B logs in successfully in another browser. when I go back to user A's browser I see user B's info.

16 years ago
does anybody have an example of how to use the property parameter in Action Mapping to solve the above mentioned question?
19 years ago
I am not quite sure what you suggested since I am new to struts.
can you please give me an example?
[ December 03, 2004: Message edited by: Abebe Belew ]
19 years ago
My index page has two links "checking" and "saving" and I want to use the same <action-mapping> in the struts-config.xml file since both do the same thing except for one thing, which is

in my jsp page I have a hidden field:
<input type="hidden" name="check_save" value="1">

when clicking on "checking" I want the value of "check_save" to be "1" and
when clicking on "saving" I want the value of "check_save" to be "2", since the query I do in my bean differes according to the value.

the question is since both links use the same action how do I track where the request is coming from "checking" or "saving" to change the value of "check_save" accordingly?
19 years ago
I am trying to poptulate a drop down list by using html ption but I get this error message when I try to run the app. "Cannot find bean under name glu_bp' " any idea why?

jsp tag:
=======
<html:select name="glucoseForm" property="glucose_bloodPressure">
<html ptions collection="glu_bp" property="id" labelProperty="description"/>
</html:select>

Action
======
HttpSession session = request.getSession(true);
GlucoseForm glucoseForm = (GlucoseForm) form;

GluService service = new GluService();
Collection glu_bp = service.getGlu_bp();
session.setAttribute("glu_bp", glu_bp);
glucoseForm.setGlucose_bloodPressure("Glucose"); //to set the default value

beans
=========
Glucose_bloodPressureBean.java

public class Glucose_bloodPressureBean {

private int id;
private String description;

public Glucose_bloodPressureBean() {
}
public Glucose_bloodPressureBean( int id, String description ) {
this.id = id;
this.description = description;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}


GluService.java

import java.util.Collection;
import java.util.ArrayList;

public class GluService {

public Collection getGlu_bp() {
//call business layer to return Collection of Department beans
//since we aren't dealing with the model layer, we'll mimic it here
ArrayList list = new ArrayList(2);
list.add( new Glucose_bloodPressureBean( 0, "Glucose"));
list.add( new Glucose_bloodPressureBean( 1, "Blood Pressure"));

System.out.println(" this is the array list" + list);
return list;
}


}
19 years ago
in struts application I have a jsp page where I have dropdown list. a query against a db is done according to the selection. My question is I want to display the result of the query in the same page where the dropdwon list is and i want the selected value (from the list) to apper in the dropdown box when the result page is displayed. how do I do this? thanks
19 years ago
I would like to learn a technique to keep track the number of login attempts by a user using session variables. If the user exceed the maximum login attempts, then the account is suspended
19 years ago
Hi all,
I am developing a web application it struts.
In my login page I just want to give 3 chances for users to try to login
using userid and password (meaning unless they provide the correct combination).After three incorrect attempts, I want to record the userid and keep them from logging to the page for the next 24 hours.
how do I do that?

Thanks
19 years ago
Hi,
I want to have connection to two different databases in struts.
in my struts-config.xml file I set up two <data-sources> as

<data-sources>
<data-source>
<set-property property="key" value="mysql"/>
<set-property property="autoCommit" value="true" />
<set-property property="description" value="MySql Datasource" />
<set-property property="driverClass" value="com.mysql.jdbc.Driver" />
<set-property property="maxCount" value="5" />
<set-property property="minCount" value="2" />
<set-property property="user" value="user" />
<set-property property="password" value="pass" />
<set-property property="url" value="jdbc:mysql://url ort/db_name" />
</data-source>

<data-source>
<set-property property="key" value="tiger"/>
<set-property property="autoCommit" value="true" />
<set-property property="description" value="java Datasource" />
<set-property property="driverClass" value="oracle.jdbc.driver.OracleDriver" />
<set-property property="maxCount" value="5" />
<set-property property="minCount" value="2" />
<set-property property="user" value="usr" />
<set-property property="password" value="pass" />
<set-property property="url" value=
jdbc racle:thin:@url ort b_name" />
</data-source>

</data-sources>

I tried to access both connections in my Action as

javax.sql.DataSource dataSource_udb;
java.sql.Connection conn_tiger;
javax.sql.DataSource dataSource_mysql;
java.sql.Connection conn_mysql;

dataSource_udb = getDataSource(request, "tiger");
conn_tiger = dataSource_udb.getConnection();

dataSource_mysql = getDataSource(request);
conn_mysql = dataSource_mysql.getConnection();

but then i get an error message "Servlet action is currently unavailable" and in the log file
javax.servlet.UnavailableException: Initializing application data source org.apache.struts.action.DATA_SOURCE
I have been stuck with this for more than a week now. can anybody help me with this.
thanks so much.
19 years ago
I am writing a java client socket to communicate to C server socket.
The c programme is expecting three parameters sent by client
ie) (type of the parameter, string to be read, length of the string). Is there any way I can write this params. to the socket?