how to use ajax displaytag?

2009-11-12 Thread fireapple

Here's my situation:

I used a displaytag to show a table as an ajax result. It works fine.

However, when I click "sort" or go to different page, it opens a new page
with only the displaytag table. I saw something online that there's ajaxTags
or ajaxAnywhere, but it seems they're both not good.

Is JQuery a good solution for this issue? I found this:
http://vijay360.wordpress.com/2008/03/12/displaytag-jquery-displaytagajaxed/



-- 
View this message in context: 
http://old.nabble.com/how-to-use-ajax-displaytag--tp26326770p26326770.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: how to use ajax displaytag?

2009-11-16 Thread fireapple

Thanks, I changed action in requestUri from ajax to a normal one. Now sorting
and paging work fine although it's not ajax.

Is it possible to do the sorting and paging in an ajax way?


Oscar Calderón-2 wrote:
> 
> 
> Well, it depends of the display table's configuration. In display table 
> tag you can set the request uri to get the list that fills the table 
> when you sort column or navigate with pagination. I don't know if you 
> set the display table inside a ajax refresh div or something like that, 
> if that's the case i think that requestUri of your display table must 
> target to action method that gets you to the page, not the method that 
> is called via ajax.
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/how-to-use-ajax-displaytag--tp26326770p26374269.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



how to use one user input in two forms?

2009-11-18 Thread fireapple

Dear all,

I want to use a multiple select to ask user select the item they want.
The items selected will be on a pdf file which will be sent as attachment of
email (user can click "send email" button to send them). The user wants to
confirm if the pdf is right before he sends it. Therefore, I create a "PDF"
button to ask user to check if the PDF attachment is what he wants to send.

Here is the situation:
Since the "PDF" button and "send email" button will both use the selected
item info, I don't want the user to select the same list twice(of course
user doesn't want to do that).

I thought to store the selected info in session when the user click "PDF" so
that they have the info when he clicks "send email". But user may just click
"send email" directly without checking first, then the selected info will be
lost.

Any suggestions about this? Thanks
-- 
View this message in context: 
http://old.nabble.com/how-to-use-one-user-input-in-two-forms--tp26415809p26415809.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



action called twice in IE 8 when using different ajax submit for the same form

2009-11-23 Thread fireapple


Here is the form from my jsp page:

   1.   
   2.   
   3.   
   4.   
   5.   
   6.   
   7.   
   8.


When using firefox, it works fine. When using internet explorer, the form is
submitted twice for the same action.
Example: if the user clicks "Release", public String releaseContract() will
be executed twice.

I saw other's form was submitted twice mostly likely because of Javascript,
but obviously this case is different.

Thanks!

-- 
View this message in context: 
http://old.nabble.com/action-called-twice-in-IE-8-when-using-different-ajax-submit-for-the-same-form-tp26482173p26482173.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Can I implement interface of another project in a struts 2 project?

2010-01-12 Thread fireapple

In project1, I include project2 in order to use interfaces (interface A, B,
C, D.) of project2.
However, the system always claim java.lang.NoClassDefFoundError for
interface of project2.

I also exported project2 to a JAR and include it in project1's build path,
still no luck.

I tried 3 of my projects, all fail with the same error. I was wondering if
it's a struts 2 issue of my configuration problem. 

Thanks
-- 
View this message in context: 
http://old.nabble.com/Can-I-implement-interface-of-another-project-in-a-struts-2-project--tp27131976p27131976.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Can I implement interface of another project in a struts 2 project?

2010-01-13 Thread fireapple

It solved the problem. Thanks!

I wonder what's the difference between putting jar in build path and putting
jar in WEB-INF/lib. Appreciate


Gabriel Belingueres-2 wrote:
> 
> Seems it is not S2 related. This exception is raised when some
> dependency is not found by the JVM. Note that in addition to be
> available in your build path, the dependency must be available at
> runtime too (usually inside the WEB-INF/lib folder)
> 
> 2010/1/12 fireapple :
>>
>> In project1, I include project2 in order to use interfaces (interface A,
>> B,
>> C, D.) of project2.
>> However, the system always claim java.lang.NoClassDefFoundError for
>> interface of project2.
>>
>> I also exported project2 to a JAR and include it in project1's build
>> path,
>> still no luck.
>>
>> I tried 3 of my projects, all fail with the same error. I was wondering
>> if
>> it's a struts 2 issue of my configuration problem.
>>
>> Thanks
>> --
>> View this message in context:
>> http://old.nabble.com/Can-I-implement-interface-of-another-project-in-a-struts-2-project--tp27131976p27131976.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Can-I-implement-interface-of-another-project-in-a-struts-2-project--tp27131976p27151209.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



how to eliminate time in

2010-02-18 Thread fireapple

Dear all, I'm using


where startDate is a java.util.Date field of an object train.

The output is something like this:

http://old.nabble.com/file/p27647328/date.png 

How can I eliminate the 12:00:00 in the textfield? Thanks!
-- 
View this message in context: 
http://old.nabble.com/how-to-eliminate-time-in-%3Cs%3Atextfield%3E-tp27647328p27647328.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: how to eliminate time in

2010-02-19 Thread fireapple

Does that mean I have to create something like:

public String getStartDateStr()
{
...
}

to do this?

I don't want to use this because if I use this getter, I have to create a
setter for this since user can edit the date.

Any other options? Thanks



Brian Thompson-5 wrote:
> 
> Just add a getter to your "train" object that translates the startDate
> into
> the format you'd like.  Use a DateFormat object.
> 
> -Brian
> 
> 
> 
> On Thu, Feb 18, 2010 at 5:07 PM, fireapple  wrote:
> 
>>
>> Dear all, I'm using
>> 
>>
>> where startDate is a java.util.Date field of an object train.
>>
>> The output is something like this:
>>
>> http://old.nabble.com/file/p27647328/date.png
>>
>> How can I eliminate the 12:00:00 in the textfield? Thanks!
>> --
>> View this message in context:
>> http://old.nabble.com/how-to-eliminate-time-in-%3Cs%3Atextfield%3E-tp27647328p27647328.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
> 
> 

-- 
View this message in context: 
http://old.nabble.com/how-to-eliminate-time-in-%3Cs%3Atextfield%3E-tp27647328p27653078.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Any hint of JQuery on struts2 tutorial, thanks!

2009-04-28 Thread fireapple

Because our team is using struts2 to develop the web application and I'm in
charge of the UI part, I have to restrict the UI to struts2.

I heard that JQuery is very popular and I love it. Also, I know some people
are using it in struts2. However, I couldn't find any related tutorial. Any
tutorial online or shall I buy some book about this issue?

Thank you very much!
-- 
View this message in context: 
http://www.nabble.com/Any-hint-of-JQuery-on-struts2-tutorial%2C-thanks%21-tp23277517p23277517.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Any hint of JQuery on struts2 tutorial, thanks!

2009-04-28 Thread fireapple

Hi, Wes, on the table of content of the book, I didn't find anything related
to JQuery and Struts2. Since JQuery is similar with JavaScript, can we say
we can use JQuery in Struts2 as soon as we can use JavaScript in Struts2?
Thank you. I'm a new programmer with stupid questions,:-)



Wes Wannemacher wrote:
> 
> On Tue, Apr 28, 2009 at 9:52 AM, Martin Gainty 
> wrote:
>>
>> Struts2 in Practice book from manning
>>
>> http://www.manning.com/wannemacher
>>
>> feel free to Ping wes or myself offline for any
>> questions/comments/tutorials
>>
>> Thanks,
>> Martin Gainty
> 
> 
> Checking in! Did I hear my name?
> 
> Yeah, I have quite a bit of JQuery coverage, but it's a moving target.
> It is likely that we'll have a fair amount of JQuery integration
> within Struts by the time the book is published (coincidence?) If you
> join the MEAP program and read it as I go, there is at least one
> chapter already with a decent JQuery + Spring + JPA example.
> 
> -Wes
> 
> -- 
> Wes Wannemacher
> Author - Struts 2 In Practice
> Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
> http://www.manning.com/wannemacher
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Any-hint-of-JQuery-on-struts2-tutorial%2C-thanks%21-tp23277517p23278445.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Any hint of JQuery on struts2 tutorial, thanks!

2009-04-28 Thread fireapple

Thank you! It seems I have a lot to learn:-)


Wes Wannemacher wrote:
> 
> On Tue, Apr 28, 2009 at 10:39 AM, fireapple 
> wrote:
>>
>> Hi, Wes, on the table of content of the book, I didn't find anything
>> related
>> to JQuery and Struts2. Since JQuery is similar with JavaScript, can we
>> say
>> we can use JQuery in Struts2 as soon as we can use JavaScript in Struts2?
>> Thank you. I'm a new programmer with stupid questions,:-)
>>
>>
>>
> 
> JQuery is a JavaScript framework/library, so if you are using JQuery
> with Struts2, then you are using JavaScript with Struts2. Depending on
> how new you are to programming, there may be better places to start.
> JQuery isn't similar to JavaScript, it is JavaScript in the same way
> that Struts is Java. JQuery takes many of the things that are
> difficult in JavaScript and makes them easier. You are still using
> JavaScript, but rather than writing 20 lines of code, you write just a
> few. Looking back through the ToC, I guess I don't make it clear that
> there is JQuery coverage specifically, but as I mentioned before, the
> examples so far are already using JQuery. It may be hard to pick
> things up through the examples if you are not already experienced with
> the other topics. The example I mentioned to earlier incorporates
> Struts 2 with Spring, JPA, a generic DAO setup, JSON, Struts 2
> Conventions and JQuery. If you've never used JPA or Spring, there
> would be quite a bit thrown at you in one example.
> 
> Depending on your goal, there are a few other routes you might want to
> take before jumping into an advanced book. If you are looking to learn
> more about Struts 2, my book is a follow-up to another book called
> Struts 2 In Action that is a very well-written introduction and
> reference on Struts 2 core topics. If you are already familiar with
> Struts 2, but want to learn more about AJAX, then start by learning a
> bit about JavaScript core and AJAX... Manning has another book
> (http://manning.com/crane/) that has been a good seller for them.
> 
> My book isn't meant to be a reference only on Struts 2 and AJAX. It is
> meant to give examples and best practices for integration with many of
> the popular topics that come up on this list. Plus, it will give
> examples on more advanced topics that haven't come up yet, but will
> (OSGi?)
> 
> -Wes
> 
> 
> -- 
> Wes Wannemacher
> Author - Struts 2 In Practice
> Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
> http://www.manning.com/wannemacher
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Any-hint-of-JQuery-on-struts2-tutorial%2C-thanks%21-tp23277517p23284541.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Any hint of JQuery on struts2 tutorial, thanks!

2009-04-29 Thread fireapple

Thanks, actually I want more, like examples from this link:
http://www.instantshift.com/2009/02/05/40-excellent-jquery-tutorials/

Is it durable for me to learn how to implement them in struts2?
If there're online tutorial or book tutorial about this issue, it will be
fantastic for me


dusty wrote:
> 
> Perhaps you are looking for some basic "tidbits" you may commonly use:
> 
> a) Calendar pop-up
> b) Ajax calls with JSON response from Struts
> c) Simple element hide/show
> 
> Can you build a list like this of things you need to build your UI or are
> you looking more for skill building sources?
> 
> 
> fireapple wrote:
>> 
>> Thank you! It seems I have a lot to learn:-)
>> 
>> 
>> Wes Wannemacher wrote:
>>> 
>>> On Tue, Apr 28, 2009 at 10:39 AM, fireapple 
>>> wrote:
>>>>
>>>> Hi, Wes, on the table of content of the book, I didn't find anything
>>>> related
>>>> to JQuery and Struts2. Since JQuery is similar with JavaScript, can we
>>>> say
>>>> we can use JQuery in Struts2 as soon as we can use JavaScript in
>>>> Struts2?
>>>> Thank you. I'm a new programmer with stupid questions,:-)
>>>>
>>>>
>>>>
>>> 
>>> JQuery is a JavaScript framework/library, so if you are using JQuery
>>> with Struts2, then you are using JavaScript with Struts2. Depending on
>>> how new you are to programming, there may be better places to start.
>>> JQuery isn't similar to JavaScript, it is JavaScript in the same way
>>> that Struts is Java. JQuery takes many of the things that are
>>> difficult in JavaScript and makes them easier. You are still using
>>> JavaScript, but rather than writing 20 lines of code, you write just a
>>> few. Looking back through the ToC, I guess I don't make it clear that
>>> there is JQuery coverage specifically, but as I mentioned before, the
>>> examples so far are already using JQuery. It may be hard to pick
>>> things up through the examples if you are not already experienced with
>>> the other topics. The example I mentioned to earlier incorporates
>>> Struts 2 with Spring, JPA, a generic DAO setup, JSON, Struts 2
>>> Conventions and JQuery. If you've never used JPA or Spring, there
>>> would be quite a bit thrown at you in one example.
>>> 
>>> Depending on your goal, there are a few other routes you might want to
>>> take before jumping into an advanced book. If you are looking to learn
>>> more about Struts 2, my book is a follow-up to another book called
>>> Struts 2 In Action that is a very well-written introduction and
>>> reference on Struts 2 core topics. If you are already familiar with
>>> Struts 2, but want to learn more about AJAX, then start by learning a
>>> bit about JavaScript core and AJAX... Manning has another book
>>> (http://manning.com/crane/) that has been a good seller for them.
>>> 
>>> My book isn't meant to be a reference only on Struts 2 and AJAX. It is
>>> meant to give examples and best practices for integration with many of
>>> the popular topics that come up on this list. Plus, it will give
>>> examples on more advanced topics that haven't come up yet, but will
>>> (OSGi?)
>>> 
>>> -Wes
>>> 
>>> 
>>> -- 
>>> Wes Wannemacher
>>> Author - Struts 2 In Practice
>>> Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
>>> http://www.manning.com/wannemacher
>>> 
>>> -
>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>> For additional commands, e-mail: user-h...@struts.apache.org
>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Any-hint-of-JQuery-on-struts2-tutorial%2C-thanks%21-tp23277517p23295874.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



how to use struts 2 to redirect jQuery Ajax request

2009-05-18 Thread fireapple

I created a login page with jQuery, I'm sending Ajax request by .getJSON(),
Also, I want to use struts 2's controller to assign to different pages based
on the returned results of action (in this case, if username and password
doesn't match, use an ajax reminder; if match, redirect to another page, say
selectBook.jsp)

in struts.xml, I used 

[code]  
/pages/selectBook.jsp

  
 [/code]

However, it doesn't work (means if the username and password match, it
wouldn't go to page selectBook.jsp).

With google, I know I can solve it in this way: In login.jsp, 
[code]  function login()
{
var unameval = $("#username").val();
var pwordval = $("#password").val();
$.getJSON("Login.action", {username:unameval, 
password:pwordval},
getData);
}

function getData(json) 
{
var data = json;
if(data.redirect == 1)
top.location.href="/Test/pages/selectBook.jsp";//redirection
else
$("#status").html(data.comment);;   
}
[/code]

The problem is, in this way, the controller doesn't determine the redirect
page, which is not what struts 2 should be.

Any suggestions about this issue, instead of the method above(change
callback function of login.jsp based on json data)? Thanks!
-- 
View this message in context: 
http://www.nabble.com/how-to-use-struts-2-to-redirect-jQuery-Ajax-request-tp23605756p23605756.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: how to use struts 2 to redirect jQuery Ajax request

2009-05-19 Thread fireapple

So there is no way to put the control of determining the result to Struts
instead of Javascript?


Steven Yang wrote:
> 
> Actually you went off Struts' scope by using AJAX.because javascript is on
> the client side. by using XHR you have put the control of determining the
> result to javascript and not Struts.
> one other way you can do it is you can let server send the url along with
> other information to client and client decide based on the result to
> redirect or stay on the same page.
> but still the job of determining the result is on your javascript
> 
> 

-- 
View this message in context: 
http://www.nabble.com/how-to-use-struts-2-to-redirect-jQuery-Ajax-request-tp23605756p23616595.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Performance issue with large data(such as images)

2009-06-09 Thread fireapple

Firstly, I persist the portraits (images) of all users in the db as Strings
(large one, say length 5000). Then, I want to get the String and display the
portraits of users on the web page(like a topic in a forum). Here I know
three solutions but none of them is efficient: 
1. Because the image is large, it's not efficient to store it in
objects(beans).
2. Because I have many users(say 300), if I store all the maps(userId and
image) in the session, the session will be huge.
3. Because I have many users(say 300), if I access the db for each user's
image, the worse case is I will have to access db for 300 times.

Is there any solution (such as a design pattern or interceptor) for this
performance issue? Many thanks!
-- 
View this message in context: 
http://www.nabble.com/Performance-issue-with-large-data%28such-as-images%29-tp23945029p23945029.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Performance issue with large data(such as images)

2009-06-09 Thread fireapple



Richard Sayre wrote:
> 
> You should persist the images as bytes, in a binary field or something
> similar.
> 
>> 1. Because the image is large, it's not efficient to store it in
>> objects(beans).
> 
> Well this depends on the Bean.  Is the bean stored in session?  If yes
> then it will take up some memory.  If you dont have alot of memory I
> would not recommend this.
> 
>> 2. Because I have many users(say 300), if I store all the maps(userId and
>> image) in the session, the session will be huge.
> 
> Again if your requirement is low memory usage then dont store large
> objects in momory for a long time
> 
>> 3. Because I have many users(say 300), if I access the db for each user's
>> image, the worse case is I will have to access db for 300 times.
> 
> Well this is the trade off Memory vs Resources to Connect to a DB.
> Even if the images are not stored in session they will still be held
> in memory when getting them from the DB.
> 
> How often do you need to load all 300 images?  If it is forum style I
> would imangine a limited number of posting per page say max 20.  So
> the would be a maximum of 20 images per page load.
> 
> You could also Store the images in the hard drive of the server, and
> store a URL to the image in the database.  This would reduce the
> memory overhead.  Did you try to do any test to see what the impact of
> retrieveing the data from the database is?
> 
> If you must use the least amount of memory as possible, persist the
> images to the hard drive and store the file reference to the url in
> the database.  Or even store the images as userId_avatar.gif.  That
> way you can link the file to a user id and have no need to store the
> url.  Use a base directory for storing the images.
> 
> Before you guess if something is a performance issue, you should test
> to see what the actual cost of each method of image storing and
> retrival is.
> 
> Rich
> 
> 

Thanks, Rich, 

"You should persist the images as bytes, in a binary field or something
similar."
If I use BLOB, I have to make a lot of change to my code. Therefore, I have
to persist it as String. I used base64 to encode and decode the byte[] into
String. Because I resize the images to small ones. I use a VARCHAR length
about 10k~20k to persist the String.

"How often do you need to load all 300 images?  If it is forum style I
would imangine a limited number of posting per page say max 20.  So
the would be a maximum of 20 images per page load."
If this is true, which method is the best among the above three?

"If you must use the least amount of memory as possible, persist the
images to the hard drive and store the file reference to the url in
the database.  "
If I want to persist images to the hard drive of server. Shall I persist the
data inside WAR or outside? Because user can change their portrait, does it
mean it must be persisted outside WAR?


-- 
View this message in context: 
http://www.nabble.com/Performance-issue-with-large-data%28such-as-images%29-tp23945029p23948048.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Performance issue with large data(such as images)

2009-06-10 Thread fireapple



Richard Sayre wrote:
> 
> I should have also mentioned that there are security issues with
> persisting to the hard drive.
> 
> I would recommend saving to the database and loading the images as
> needed.  Do not save them to session.  I do not think you will have a
> performance problem.
> 
> Rich
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> 

Any way to resolve the security issue? If the user save the portrait in the
hard drive(outside of app), I couldn't find a way to display it using URL. 

"" doesn't work at all.
-- 
View this message in context: 
http://www.nabble.com/Performance-issue-with-large-data%28such-as-images%29-tp23945029p23969795.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



RE: Performance issue with large data(such as images)

2009-06-10 Thread fireapple



Security Management wrote:
> 
> I have had problems when trying to show a bunch of thumbnails, because you
> have a URL that points to an action in your jsp that causes a database hit
> to pull the image.  If I'm trying to show 150 thumbnails, the page takes
> forever to load due to the db connections.  Any solution to that?  I'm
> using
> DBCP
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> 
I also use the URL that points to an action in my jsp, such as:

http://www.nabble.com/Performance-issue-with-large-data%28such-as-images%29-tp23945029p23969896.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Struts 2 File upload to store the filedata

2009-06-10 Thread fireapple



Jeromy Evans - Blue Sky Minds wrote:
> 
> 
> Hi Johnson, I think just need to read up a little more on Struts 2 as it 
> seems you're trying to do too much yourself based on Struts1 experiences 
> rather than let the framework do more of the routine work. Ian Roughly's 
> book is a good place to start: 
> http://www.infoq.com/minibooks/starting-struts2
> 
> Anyway, in a previous email you mentioned you know how to open an input 
> stream from the image data in your database:
> 
> InputStream in = rs.getBinaryStream("filedata");   
> 
> 
> The StreamResult requires that an input stream is open and available in 
> a public property in your action.  Here's a section from your new action:
> 
> public class MyAction extends ActionSupport {
> //
> private InputStream imageStream;
> 
> public String execute() {
>// read data from the database ...
>//...
>   imageStream = rs.getBinaryStream("filedata");
>// ...
>return SUCCESS;
> }
> 
> /** Return an InputStream for the StreamResult */
> public InputStream getImageStream() {
>return imageStream;
> }
> 
> That's it. We have an open InputStream in a public property in your 
> action.  You don't do anything other than prepare it for reading.
> 
> Now your struts.xml requires the action and result definition.  The 
> definition below states that when your action returns success, the 
> stream result type (StreamResult) should be used and that the name of 
> the InputStream property is imageStream (ie. getImageStream()).  That 
> ties it back into the code above.
> 
> 
>
> image/jpeg
> imageStream
> filename="image.jpg"
> 1024
>   
> 
> 
> Hope that helps.  After you have that working, you can also experiment 
> with getting the content type and filename from properties in your action.
> Hint:  ${contentType}
> 
> Regards,
>  Jeromy Evans
> 
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> 

Hi, Jeromy, I used the above method to upload and display the images and
succeed. However, if I want to show many images on one page, such as a table
like this:

user_id_1  user_name_1 user_portrait_1(image)
user_id_2  user_name_2 user_portrait_2(image)
user_id_3  user_name_3 user_portrait_3(image)
user_id_4  user_name_4 user_portrait_4(image)
user_id_5  user_name_5 user_portrait_5(image) 

Is there a way to do it?
I used to use display tag to solve similar table display, but with image
URL, it doesn't work.
-- 
View this message in context: 
http://www.nabble.com/Struts-2-File-upload-to-store-the-filedata-tp14168069p23970105.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Performance issue with large data(such as images)

2009-06-11 Thread fireapple



newton.dave wrote:
> 
> 
>> "" doesn't work at
>> all.
> 
> Stream it from an action/servlet/etc?
> 
> Dave
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> 

Yes, I streamed it from an action. However, I could show the above table
using an action to stream images.
-- 
View this message in context: 
http://www.nabble.com/Performance-issue-with-large-data%28such-as-images%29-tp23945029p23981525.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



S2: Ajax tags -- how to return a message to a specific DIV?

2009-07-09 Thread fireapple

I wonder if this is durable with S2:

JSP form:
this form has a button FINALIZE, if all goes well - the result SUCCESS
should be seen in placeA on the page and if it fails the result FAILURE
should be seen in placeB (a different place on the page);
the SUCCESS/FAILURE are just messages but they must be seen on different
places on the page.
(note that the page is using AJAX tags)



.
.




.
.





So, say the end user clicks the finalize button and activates the
finalize-action-method. How can I instruct in the action that for if all
goes well - show the success message on DIV target_id_success,
and if something went wrong - show the FAILURE message on DIV:
target_id_failure. 


public String finalize()
{
 
 //something went wrong
 addActionError("error...sorry"); //this error should be seen only in
DIV target_id_failure
 return "error-message";

  //if all is OK
  addActionMessage("good job"); //this message should be seen only on
DIV target_id_success
  return "success-message";
}


Many thanks!

-- 
View this message in context: 
http://www.nabble.com/S2%3A-Ajax-tagshow-to-return-a-message-to-a-specific-DIV--tp24412933p24412933.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: JQuery UI datepicker doesn't work in a struts 2 ajax page

2009-11-09 Thread fireapple

Thanks, I tried your method and it didn't work out.

I also tried to put all JQuery library and Javascript block in my ajax
page(which is supposed to appear in the s:div). Still doesn't work. 

However, after adding executeScripts="true" in my , if I add
"alert('test');" into my ajax page, I can see it works, which means
Javascript works in my ajax page.

Is it possible this is a JQuery issue?


Sparecreative wrote:
> 
> When using jQuery via ajax you don¹t use jQuery¹s ready function, in you
> case the $(function(){.
> 
> You have two options. The simplest is to set a parameter (eg called
> ajaxRequest) in you action to true, when received via ajax and then change
> your javascript to have a s:if tag and if ajaxRequest is not true then
> include the $(function(){ line.
> 
> For example you javascript block would look like:
> 
> 
>> 
>>   $(function() {
>> 
>> $(".datepicker").datepicker({
>> changeMonth: true,
>> changeYear: true,
>> yearRange: '-5:+5',
>> showOn: 'button', buttonImageOnly: true, buttonImage:
>> 'images/calendar.gif'
>> });
>> 
>> });
>> 
>> 
> 
> 
> The option is to have either separate jsp pages or separate javascript
> blocks.
> 
> 

-- 
View this message in context: 
http://old.nabble.com/JQuery-UI-datepicker-doesn%27t-work-in-a-struts-2-ajax-page-tp26230811p26268920.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: JQuery UI datepicker doesn't work in a struts 2 ajax page

2009-11-10 Thread fireapple

Thanks, Johannes, I tried the plugin of the second link but it didn't work
out. It seems the plugin doesn't work for my struts 2.0.11.

 The build in Datepicker from dojo doesn't work for me because I use
. segmentList[%{#stat.index}].departureDate can transfer value
back(can't display value) while segmentList[#stat.index].departureDate can
display value(can't transfer value back).


Johannes Geppert wrote:
> 
> Long time ago I also have trouble to execute Scripts in AJAX Content.
> http://old.nabble.com/-S2--No-JavaScript-in-TabbedPanel-to14772176.html#a14772176
> 
> So I switch to jQuery also for AJAX functions.
> 
> Why do you mix Dojo and jQuery?
> You can use the build in Datepicker from dojo or switch 
> to one of the two jQuery Plugins they exists for struts2.
> 
> http://code.google.com/p/struts2-jquery/
> 
> or
> 
> http://code.google.com/p/struts2-jquery-plugin/
> 
> Best Regards
> 
> Johannes Geppert
> 
> 
> 
> fireapple wrote:
>> 
>> Thanks Johannes, I'm using struts 2.0.11, this is my ajax submit tag:
>> 
>> > targets="%{'segment_edit_message'+#ind.index}" showLoadingText="false"
>> indicator="%{'loadingImage'+#ind.index}" executeScripts="true" />
>> 
>> I just added executeScripts="true" to it but still doesn't work. Any
>> other possibility may cause this problem?
>> 
>> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/JQuery-UI-datepicker-doesn%27t-work-in-a-struts-2-ajax-page-tp26230811p26284590.html
Sent from the Struts - User mailing list archive at Nabble.com.


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